Skip to content

Commit 38c6e2d

Browse files
committed
Merge remote-tracking branch 'upstream/staging/electro-release' into staging/electro-release
2 parents 73ed9f8 + 6a72572 commit 38c6e2d

File tree

6 files changed

+38
-25
lines changed

6 files changed

+38
-25
lines changed

lib/metasploit/framework/command.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@
22
# Gems
33
#
44

5-
# have to be exact so minimum is loaded prior to parsing arguments which could influence loading.
5+
# have to be exact so minimum is loaded prior to parsing arguments which could
6+
# influence loading.
67
require 'active_support/dependencies/autoload'
78

8-
# @note Must use the nested declaration of the {Metasploit::Framework::Command} namespace because commands need to be
9-
# able to be required directly without any other part of metasploit-framework besides config/boot so that the commands
10-
# can parse arguments, setup RAILS_ENV, and load config/application.rb correctly.
9+
# @note Must use the nested declaration of the
10+
# {Metasploit::Framework::Command} namespace because commands need to be able
11+
# to be required directly without any other part of metasploit-framework
12+
# besides config/boot so that the commands can parse arguments, setup
13+
# RAILS_ENV, and load config/application.rb correctly.
1114
module Metasploit
1215
module Framework
1316
module Command
14-
# Namespace for commands for metasploit-framework. There are corresponding classes in the
15-
# {Metasploit::Framework::ParsedOptions} namespace, which handle for parsing the options for each command.
17+
# Namespace for commands for metasploit-framework. There are
18+
# corresponding classes in the {Metasploit::Framework::ParsedOptions}
19+
# namespace, which handle for parsing the options for each command.
1620
extend ActiveSupport::Autoload
1721

1822
autoload :Base
1923
autoload :Console
2024
end
2125
end
22-
end
26+
end

lib/metasploit/framework/command/base.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ class Metasploit::Framework::Command::Base
3434
# Class Methods
3535
#
3636

37-
# @note {require_environment!} should be called to load `config/application.rb` to so that the RAILS_ENV can be set
38-
# from the command line options in `ARGV` prior to `Rails.env` being set.
37+
# @note {require_environment!} should be called to load
38+
# `config/application.rb` to so that the RAILS_ENV can be set from the
39+
# command line options in `ARGV` prior to `Rails.env` being set.
3940
# @note After returning, `Rails.application` will be defined and configured.
4041
#
41-
# Parses `ARGV` for command line arguments to configure the `Rails.application`.
42+
# Parses `ARGV` for command line arguments to configure the
43+
# `Rails.application`.
4244
#
4345
# @return (see parsed_options)
4446
def self.require_environment!
@@ -50,8 +52,9 @@ def self.require_environment!
5052
# @see https://github.com/rails/rails/blob/v3.2.17/railties/lib/rails/commands.rb#L39-L40
5153
require Pathname.new(__FILE__).parent.parent.parent.parent.parent.join('config', 'application')
5254

53-
# have to configure before requiring environment because config/environment.rb calls initialize! and the initializers
54-
# will use the configuration from the parsed options.
55+
# have to configure before requiring environment because
56+
# config/environment.rb calls initialize! and the initializers will use
57+
# the configuration from the parsed options.
5558
parsed_options.configure(Rails.application)
5659

5760
# support disabling the database
@@ -104,4 +107,4 @@ def initialize(attributes={})
104107
def start
105108
raise NotImplementedError
106109
end
107-
end
110+
end

lib/metasploit/framework/parsed_options.rb

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@
44

55
require 'active_support/dependencies/autoload'
66

7-
# # @note Must use the nested declaration of the {Metasploit::Framework::ParsedOptions} namespace because commands,
8-
# which use parsed options, need to be able to be required directly without any other part of metasploit-framework
9-
# besides config/boot so that the commands can parse arguments, setup RAILS_ENV, and load config/application.rb
10-
# correctly.
7+
# @note Must use the nested declaration of the
8+
# {Metasploit::Framework::ParsedOptions} namespace because commands, which
9+
# use parsed options, need to be able to be required directly without any
10+
# other part of metasploit-framework besides config/boot so that the
11+
# commands can parse arguments, setup RAILS_ENV, and load
12+
# config/application.rb correctly.
1113
module Metasploit
1214
module Framework
13-
# Namespace for parsed options for {Metasploit::Framework::Command commands}. The names of `Class`es in this
14-
# namespace correspond to the name of the `Class` in the {Metasploit::Framework::Command} namespace for which this
15-
# namespace's `Class` parses options.
15+
# Namespace for parsed options for {Metasploit::Framework::Command
16+
# commands}. The names of `Class`es in this namespace correspond to the
17+
# name of the `Class` in the {Metasploit::Framework::Command} namespace
18+
# for which this namespace's `Class` parses options.
1619
module ParsedOptions
1720
extend ActiveSupport::Autoload
1821

lib/metasploit/framework/parsed_options/base.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@
1717
require 'metasploit/framework/parsed_options'
1818
require 'msf/base/config'
1919

20-
# Options parsed from the command line that can be used to change the `Metasploit::Framework::Application.config` and
21-
# `Rails.env`
20+
# Options parsed from the command line that can be used to change the
21+
# `Metasploit::Framework::Application.config` and `Rails.env`
2222
class Metasploit::Framework::ParsedOptions::Base
2323
#
2424
# CONSTANTS
2525
#
2626

27-
# msfconsole boots in production mode instead of the normal rails default of development.
27+
# msfconsole boots in production mode instead of the normal rails default of
28+
# development.
2829
DEFAULT_ENVIRONMENT = 'production'
2930

3031
#
@@ -179,4 +180,4 @@ def option_parser
179180
end
180181
}
181182
end
182-
end
183+
end

lib/metasploit/framework/parsed_options/console.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ def option_parser
7070

7171
@option_parser
7272
end
73-
end
73+
end

lib/msf/ui/console/command_dispatcher/db.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,8 @@ def cmd_creds_help
690690
print_line " creds add-ntlm alice 5cfe4c82d9ab8c66590f5b47cd6690f1:978a2e2e1dec9804c6b936f254727f9a"
691691
print_line " # Add a user with a blank password and a domain"
692692
print_line " creds add-password bob '' contosso"
693+
print_line " # Add a user with an SSH key"
694+
print_line " creds add-ssh-key root /root/.ssh/id_rsa"
693695
print_line
694696
end
695697

0 commit comments

Comments
 (0)