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

View File

@ -21,7 +21,7 @@ class Exploit
"-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." ],
"-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." ])
#
@ -79,7 +79,7 @@ class Exploit
when '-p'
payload = val
when '-t'
target = val.to_i
target = val
when '-z'
bg = true
when '-h'