Skip to content

Commit f2fc0d8

Browse files
committed
Lands rapid7#3943, changes to engine require
2 parents f7e709d + 0bb4eac commit f2fc0d8

File tree

5 files changed

+45
-20
lines changed

5 files changed

+45
-20
lines changed

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ group :db do
88
gem 'activerecord', '>= 3.0.0', '< 4.0.0'
99

1010
# Metasploit::Credential database models
11-
gem 'metasploit-credential', '~> 0.10.1'
11+
gem 'metasploit-credential', '~> 0.12.0'
1212
# Database models shared between framework and Pro.
13-
gem 'metasploit_data_models', '~> 0.20.1'
13+
gem 'metasploit_data_models', '~> 0.21.0'
1414
# Needed for module caching in Mdm::ModuleDetails
1515
gem 'pg', '>= 0.11'
1616
end
@@ -39,7 +39,7 @@ group :development, :test do
3939
gem 'rspec', '>= 2.12', '< 3.0.0'
4040
# Define `rake spec`. Must be in development AND test so that its available by default as a rake test when the
4141
# environment is development
42-
gem 'rspec-rails' , '>= 2.12', '< 3.0.0'
42+
gem 'rspec-rails' , '>= 2.12', '< 3.0.0'
4343
end
4444

4545
group :pcap do

Gemfile.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ PATH
77
bcrypt
88
jsobfu (~> 0.2.0)
99
json
10-
metasploit-concern (~> 0.2.1)
11-
metasploit-model (~> 0.27.1)
10+
metasploit-concern (~> 0.3.0)
11+
metasploit-model (~> 0.28.0)
1212
meterpreter_bins (= 0.0.7)
1313
msgpack
1414
nokogiri
@@ -91,32 +91,32 @@ GEM
9191
hike (1.2.3)
9292
i18n (0.6.11)
9393
journey (1.0.4)
94-
jsobfu (0.2.0)
94+
jsobfu (0.2.1)
9595
rkelly-remix (= 0.0.6)
9696
json (1.8.1)
9797
mail (2.5.4)
9898
mime-types (~> 1.16)
9999
treetop (~> 1.4.8)
100-
metasploit-concern (0.2.1)
100+
metasploit-concern (0.3.0)
101101
activesupport (~> 3.0, >= 3.0.0)
102102
railties (< 4.0.0)
103-
metasploit-credential (0.10.1)
104-
metasploit-concern (~> 0.2.1)
105-
metasploit-model (~> 0.27.0)
106-
metasploit_data_models (~> 0.20.0)
103+
metasploit-credential (0.12.0)
104+
metasploit-concern (~> 0.3.0)
105+
metasploit-model (~> 0.28.0)
106+
metasploit_data_models (~> 0.21.0)
107107
pg
108108
railties (< 4.0.0)
109109
rubyntlm
110110
rubyzip (~> 1.1)
111-
metasploit-model (0.27.1)
111+
metasploit-model (0.28.0)
112112
activesupport
113113
railties (< 4.0.0)
114-
metasploit_data_models (0.20.1)
114+
metasploit_data_models (0.21.0)
115115
activerecord (>= 3.2.13, < 4.0.0)
116116
activesupport
117117
arel-helpers
118-
metasploit-concern (~> 0.2.1)
119-
metasploit-model (~> 0.27.0)
118+
metasploit-concern (~> 0.3.0)
119+
metasploit-model (~> 0.28.0)
120120
pg
121121
railties (< 4.0.0)
122122
meterpreter_bins (0.0.7)
@@ -218,9 +218,9 @@ DEPENDENCIES
218218
factory_girl (>= 4.1.0)
219219
factory_girl_rails
220220
fivemat (= 1.2.1)
221-
metasploit-credential (~> 0.10.1)
221+
metasploit-credential (~> 0.12.0)
222222
metasploit-framework!
223-
metasploit_data_models (~> 0.20.1)
223+
metasploit_data_models (~> 0.21.0)
224224
network_interface (~> 0.0.1)
225225
pcaprub
226226
pg (>= 0.11)

lib/metasploit/framework/common_engine.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
require 'fileutils'
66

7+
#
8+
# Metasploit gem engines
9+
#
10+
11+
require 'metasploit/model/engine'
12+
require 'metasploit/concern/engine'
13+
Metasploit::Framework::Require.optionally_require_metasploit_db_gem_engines
14+
715
# `Rails::Engine` behavior common to both {Metasploit::Framework::Application} and {Metasploit::Framework::Engine}.
816
module Metasploit::Framework::CommonEngine
917
extend ActiveSupport::Concern
@@ -73,4 +81,4 @@ def merge_meterpreter_extensions(engine)
7381
end
7482
end
7583
end
76-
end
84+
end

lib/metasploit/framework/require.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,23 @@ def self.optionally_include_metasploit_credential_creation(including_module)
7272
end
7373
end
7474

75+
# Tries to require gems necessary for using a database with the framework.
76+
#
77+
# @example
78+
# Metasploit::Framework::Require.optionally_require_metasploit_db_gems
79+
#
80+
# @return [void]
81+
def self.optionally_require_metasploit_db_gem_engines
82+
optionally(
83+
'metasploit/credential/engine',
84+
'metasploit-credential not in the bundle',
85+
)
86+
optionally(
87+
'metasploit_data_models/engine',
88+
'metaspoit_data_models not in the bundle'
89+
)
90+
end
91+
7592
#
7693
# Instance Methods
7794
#

metasploit-framework.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ Gem::Specification.new do |spec|
6060
# Needed for some admin modules (scrutinizer_add_user.rb)
6161
spec.add_runtime_dependency 'json'
6262
# Metasploit::Concern hooks
63-
spec.add_runtime_dependency 'metasploit-concern', '~> 0.2.1'
63+
spec.add_runtime_dependency 'metasploit-concern', '~> 0.3.0'
6464
# Things that would normally be part of the database model, but which
6565
# are needed when there's no database
66-
spec.add_runtime_dependency 'metasploit-model', '~> 0.27.1'
66+
spec.add_runtime_dependency 'metasploit-model', '~> 0.28.0'
6767
# Needed for Meterpreter on Windows, soon others.
6868
spec.add_runtime_dependency 'meterpreter_bins', '0.0.7'
6969
# Needed by msfgui and other rpc components

0 commit comments

Comments
 (0)