Skip to content

Commit 8511dc4

Browse files
committed
Merge branch 'landing/4135' into upstream-master
Land rapid7#4135 * Improve Bundle management: * Option to install w/out DB group * Option to install w/out pcap support
2 parents 1844b39 + b5220c8 commit 8511dc4

File tree

6 files changed

+136
-25
lines changed

6 files changed

+136
-25
lines changed

Gemfile

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
source 'https://rubygems.org'
22
# Add default group gems to `metasploit-framework.gemspec`:
33
# spec.add_runtime_dependency '<name>', [<version requirements>]
4-
gemspec
4+
gemspec name: 'metasploit-framework'
55

66
group :db do
7-
# Needed for Msf::DbManager
8-
gem 'activerecord', '>= 3.0.0', '< 4.0.0'
9-
10-
# Metasploit::Credential database models
11-
gem 'metasploit-credential', '~> 0.12.0'
12-
# Database models shared between framework and Pro.
13-
gem 'metasploit_data_models', '~> 0.21.1'
14-
# Needed for module caching in Mdm::ModuleDetails
15-
gem 'pg', '>= 0.11'
7+
gemspec name: 'metasploit-framework-db'
168
end
179

1810
group :development do
@@ -43,9 +35,7 @@ group :development, :test do
4335
end
4436

4537
group :pcap do
46-
gem 'network_interface', '~> 0.0.1'
47-
# For sniffer and raw socket modules
48-
gem 'pcaprub'
38+
gemspec name: 'metasploit-framework-pcap'
4939
end
5040

5141
group :test do

Gemfile.lock

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ PATH
2020
rubyzip (~> 1.1)
2121
sqlite3
2222
tzinfo
23+
metasploit-framework-db (4.10.1.pre.dev)
24+
activerecord (< 4.0.0)
25+
metasploit-credential (~> 0.12.0)
26+
metasploit-framework (= 4.10.1.pre.dev)
27+
metasploit_data_models (~> 0.21.1)
28+
pg (>= 0.11)
29+
metasploit-framework-pcap (4.10.1.pre.dev)
30+
metasploit-framework (= 4.10.1.pre.dev)
31+
network_interface (~> 0.0.1)
32+
pcaprub
2333

2434
GEM
2535
remote: https://rubygems.org/
@@ -218,18 +228,14 @@ PLATFORMS
218228
ruby
219229

220230
DEPENDENCIES
221-
activerecord (>= 3.0.0, < 4.0.0)
222231
aruba
223232
cucumber-rails
224233
factory_girl (>= 4.1.0)
225234
factory_girl_rails
226235
fivemat (= 1.2.1)
227-
metasploit-credential (~> 0.12.0)
228236
metasploit-framework!
229-
metasploit_data_models (~> 0.21.1)
230-
network_interface (~> 0.0.1)
231-
pcaprub
232-
pg (>= 0.11)
237+
metasploit-framework-db!
238+
metasploit-framework-pcap!
233239
pry
234240
rake (>= 10.0.0)
235241
redcarpet

lib/metasploit/framework/require.rb

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,18 @@ def self.optionally_include_metasploit_credential_creation(including_module)
8080
# @return [void]
8181
def self.optionally_require_metasploit_db_gem_engines
8282
optionally(
83-
'metasploit/credential/engine',
84-
'metasploit-credential not in the bundle',
85-
)
83+
'metasploit/credential',
84+
'metasploit-credential not in the bundle',
85+
) do
86+
require 'metasploit/credential/engine'
87+
end
88+
8689
optionally(
87-
'metasploit_data_models/engine',
88-
'metaspoit_data_models not in the bundle'
89-
)
90+
'metasploit_data_models',
91+
'metasploit_data_models not in the bundle'
92+
) do
93+
require 'metasploit_data_models/engine'
94+
end
9095
end
9196

9297
#

metasploit-framework-db.gemspec

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# coding: utf-8
2+
3+
# During build, the Gemfile is temporarily moved and
4+
# we must manually define the project root
5+
if ENV['MSF_ROOT']
6+
lib = File.realpath(File.expand_path('lib', ENV['MSF_ROOT']))
7+
else
8+
# have to use realpath as metasploit-framework is often loaded through a symlink and tools like Coverage and debuggers
9+
# require realpaths.
10+
lib = File.realpath(File.expand_path('../lib', __FILE__))
11+
end
12+
13+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
14+
require 'metasploit/framework/version'
15+
16+
Gem::Specification.new do |spec|
17+
spec.name = 'metasploit-framework-db'
18+
spec.version = Metasploit::Framework::GEM_VERSION
19+
spec.authors = ['Metasploit Hackers']
20+
spec.email = ['[email protected]']
21+
spec.summary = 'metasploit-framework Database dependencies'
22+
spec.description = 'Gems needed to access the PostgreSQL database in metasploit-framework'
23+
spec.homepage = 'https://www.metasploit.com'
24+
spec.license = 'BSD-3-clause'
25+
26+
# no files, just dependencies
27+
spec.files = []
28+
29+
# The Metasploit ecosystem is not ready for Rails 4 as it uses features of Rails 3.X that are removed in Rails 4.
30+
rails_version_constraint = '< 4.0.0'
31+
32+
spec.add_runtime_dependency 'activerecord', rails_version_constraint
33+
# Metasploit::Credential database models
34+
spec.add_runtime_dependency 'metasploit-credential', '~> 0.12.0'
35+
# Database models shared between framework and Pro.
36+
spec.add_runtime_dependency 'metasploit_data_models', '~> 0.21.1'
37+
# depend on metasploit-framewrok as the optional gems are useless with the actual code
38+
spec.add_runtime_dependency 'metasploit-framework', "= #{spec.version}"
39+
# Needed for module caching in Mdm::ModuleDetails
40+
spec.add_runtime_dependency 'pg', '>= 0.11'
41+
end

metasploit-framework-full.gemspec

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# coding: utf-8
2+
3+
# During build, the Gemfile is temporarily moved and
4+
# we must manually define the project root
5+
if ENV['MSF_ROOT']
6+
lib = File.realpath(File.expand_path('lib', ENV['MSF_ROOT']))
7+
else
8+
# have to use realpath as metasploit-framework is often loaded through a symlink and tools like Coverage and debuggers
9+
# require realpaths.
10+
lib = File.realpath(File.expand_path('../lib', __FILE__))
11+
end
12+
13+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
14+
require 'metasploit/framework/version'
15+
16+
Gem::Specification.new do |spec|
17+
spec.name = 'metasploit-framework-full'
18+
spec.version = Metasploit::Framework::GEM_VERSION
19+
spec.authors = ['Metasploit Hackers']
20+
spec.email = ['[email protected]']
21+
spec.summary = 'metasploit-framework with all optional dependencies'
22+
spec.description = 'Gems needed to access the PostgreSQL database in metasploit-framework'
23+
spec.homepage = 'https://www.metasploit.com'
24+
spec.license = 'BSD-3-clause'
25+
26+
# no files, just dependencies
27+
spec.files = []
28+
29+
metasploit_framework_version_constraint = "= #{spec.version}"
30+
31+
spec.add_runtime_dependency 'metasploit-framework', metasploit_framework_version_constraint
32+
spec.add_runtime_dependency 'metasploit-framework-db', metasploit_framework_version_constraint
33+
spec.add_runtime_dependency 'metasploit-framework-pcap', metasploit_framework_version_constraint
34+
end

metasploit-framework-pcap.gemspec

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# coding: utf-8
2+
3+
# During build, the Gemfile is temporarily moved and
4+
# we must manually define the project root
5+
if ENV['MSF_ROOT']
6+
lib = File.realpath(File.expand_path('lib', ENV['MSF_ROOT']))
7+
else
8+
# have to use realpath as metasploit-framework is often loaded through a symlink and tools like Coverage and debuggers
9+
# require realpaths.
10+
lib = File.realpath(File.expand_path('../lib', __FILE__))
11+
end
12+
13+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
14+
require 'metasploit/framework/version'
15+
16+
Gem::Specification.new do |spec|
17+
spec.name = 'metasploit-framework-pcap'
18+
spec.version = Metasploit::Framework::GEM_VERSION
19+
spec.authors = ['Metasploit Hackers']
20+
spec.email = ['[email protected]']
21+
spec.summary = 'metasploit-framework packet capture dependencies'
22+
spec.description = 'Gems needed to capture packets in metasploit-framework'
23+
spec.homepage = 'https://www.metasploit.com'
24+
spec.license = 'BSD-3-clause'
25+
26+
# no files, just dependencies
27+
spec.files = []
28+
29+
# depend on metasploit-framewrok as the optional gems are useless with the actual code
30+
spec.add_runtime_dependency 'metasploit-framework', "= #{spec.version}"
31+
# get list of network interfaces, like eth* from OS.
32+
spec.add_runtime_dependency 'network_interface', '~> 0.0.1'
33+
# For sniffer and raw socket modules
34+
spec.add_runtime_dependency 'pcaprub'
35+
end

0 commit comments

Comments
 (0)