Land #10041, target selection by name updates

4.x
William Vu 2018-05-16 12:52:54 -05:00 committed by Metasploit
parent 6e71f5c5fd
commit 4a93947b1a
No known key found for this signature in database
GPG Key ID: CDFB5FA52007B954
2 changed files with 13 additions and 17 deletions

View File

@ -109,13 +109,9 @@ module Exploit
# Verify the payload options # Verify the payload options
driver.payload.options.validate(driver.payload.datastore) driver.payload.options.validate(driver.payload.datastore)
# If we still have no target index, try to use the datastore's index # Set the target and then work some magic to derive index
target_idx = opts['Target'] || exploit.default_target exploit.datastore['TARGET'] = opts['Target'] if opts['Target']
target_idx = exploit.target_index
# Convert it to an integer if it's valid
if (target_idx)
target_idx = target_idx.to_i
end
if (target_idx == nil or target_idx < 0) if (target_idx == nil or target_idx < 0)
raise MissingTargetError, raise MissingTargetError,

View File

@ -14,15 +14,15 @@ class Exploit
include Msf::Ui::Console::ModuleCommandDispatcher include Msf::Ui::Console::ModuleCommandDispatcher
@@exploit_opts = Rex::Parser::Arguments.new( @@exploit_opts = Rex::Parser::Arguments.new(
"-e" => [ true, "The payload encoder to use. If none is specified, ENCODER is used." ], "-e" => [ true, "The payload encoder to use. If none is specified, ENCODER is used." ],
"-f" => [ false, "Force the exploit to run regardless of the value of MinimumRank." ], "-f" => [ false, "Force the exploit to run regardless of the value of MinimumRank." ],
"-h" => [ false, "Help banner." ], "-h" => [ false, "Help banner." ],
"-j" => [ false, "Run in the context of a job." ], "-j" => [ false, "Run in the context of a job." ],
"-n" => [ true, "The NOP generator to use. If none is specified, NOP is used." ], "-n" => [ true, "The NOP generator to use. If none is specified, NOP is used." ],
"-o" => [ true, "A comma separated list of options in VAR=VAL format." ], "-o" => [ true, "A comma separated list of options in VAR=VAL format." ],
"-p" => [ true, "The payload to use. If none is specified, PAYLOAD is used." ], "-p" => [ true, "The payload to use. If none is specified, PAYLOAD is used." ],
"-t" => [ true, "The target index to use. If none is specified, TARGET is used." ], "-t" => [ true, "The target index or name to use. If none is specified, TARGET is used." ],
"-z" => [ false, "Do not interact with the session after successful exploitation." ]) "-z" => [ false, "Do not interact with the session after successful exploitation." ])
# #
# Returns the hash of exploit module specific commands. # Returns the hash of exploit module specific commands.
@ -79,7 +79,7 @@ class Exploit
when '-p' when '-p'
payload = val payload = val
when '-t' when '-t'
target = val.to_i target = val
when '-z' when '-z'
bg = true bg = true
when '-h' when '-h'