Skip to content

Commit 75dfcb2

Browse files
committed
Merge remote-tracking branch 'upstream/staging/electro-release' into staging/electro-release
2 parents 38c6e2d + ceaffce commit 75dfcb2

File tree

9 files changed

+23
-12
lines changed

9 files changed

+23
-12
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
metasploit-framework (4.9.3.pre.dev)
4+
metasploit-framework (4.10.0.pre.dev)
55
activesupport (>= 3.0.0, < 4.0.0)
66
bcrypt
77
json

app/concerns/metasploit/credential/core/to_credential.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ def to_credential
1313
private: private.try(:data),
1414
private_type: private.try(:type).try(:demodulize).try(:underscore).try(:to_sym),
1515
realm: realm.try(:value),
16-
realm_key: realm.try(:key)
16+
realm_key: realm.try(:key),
17+
parent: self
1718
)
1819
end
1920

lib/metasploit/framework/command/base.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ def self.require_environment!
4949
parsed_options.environment!
5050
ARGV.replace(parsed_options.positional)
5151

52-
# @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/commands.rb#L39-L40
53-
require Pathname.new(__FILE__).parent.parent.parent.parent.parent.join('config', 'application')
52+
# allow other Rails::Applications to use this command
53+
if !defined?(Rails) || Rails.application.nil?
54+
# @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/commands.rb#L39-L40
55+
require Pathname.new(__FILE__).parent.parent.parent.parent.parent.join('config', 'application')
56+
end
5457

5558
# have to configure before requiring environment because
5659
# config/environment.rb calls initialize! and the initializers will use

lib/metasploit/framework/credential.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ def ==(other)
8787
end
8888

8989
def to_credential
90-
self
90+
self.parent = self
91+
self
9192
end
9293

9394
private

lib/metasploit/framework/login_scanner/base.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ def each_credential
8383
# This could be a Credential object, or a Credential Core, or an Attempt object
8484
# so make sure that whatever it is, we end up with a Credential.
8585
credential = raw_cred.to_credential
86-
credential.parent = raw_cred
8786

8887
if credential.realm.present? && self.class::REALM_KEY.present?
8988
credential.realm_key = self.class::REALM_KEY

lib/metasploit/framework/parsed_options/base.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def configure(application)
5757
#
5858
# @return [void]
5959
def environment!
60-
if defined?(Rails) && Rails.instance_variable_defined?(:@_env)
60+
if defined?(Rails) && Rails.instance_variable_defined?(:@_env) && Rails.env != options.environment
6161
raise "#{self.class}##{__method__} called too late to set RAILS_ENV: Rails.env already memoized"
6262
end
6363

@@ -85,14 +85,16 @@ def options
8585
options.database.disable = false
8686
options.database.migrations_paths = []
8787

88+
# If RAILS_ENV is set, then it will be used, but if RAILS_ENV is set and the --environment option is given, then
89+
# --environment value will be used to reset ENV[RAILS_ENV].
90+
options.environment = ENV['RAILS_ENV'] || DEFAULT_ENVIRONMENT
91+
8892
options.framework = ActiveSupport::OrderedOptions.new
8993
options.framework.config = nil
9094

9195
options.modules = ActiveSupport::OrderedOptions.new
9296
options.modules.path = nil
9397

94-
options.environment = DEFAULT_ENVIRONMENT
95-
9698
@options = options
9799
end
98100

lib/metasploit/framework/version.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ module Metasploit
22
module Framework
33
module Version
44
MAJOR = 4
5-
MINOR = 9
6-
PATCH = 3
5+
MINOR = 10
6+
PATCH = 0
77
PRERELEASE = 'dev'
88
end
99

spec/lib/msf/core/framework_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
describe Msf::Framework do
77

88
describe "#version" do
9-
CURRENT_VERSION = "4.9.3-dev"
9+
CURRENT_VERSION = "4.10.0-dev"
1010

1111
subject do
1212
described_class.new

spec/support/shared/examples/credential/core/to_credential.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
).to be_a Metasploit::Framework::Credential
1717
end
1818

19+
it "should set the parent to the credential object" do
20+
expect(
21+
crednetial_core.to_credential.parent
22+
).to eq(crednetial_core)
23+
end
1924
end
2025
end
2126
end

0 commit comments

Comments
 (0)