Support multiple rhosts for auxiliary modules.

GSoC/Meterpreter_Web_Console
Green-m 2018-12-25 17:39:50 +08:00
parent d18c6bd158
commit 689355e47f
No known key found for this signature in database
GPG Key ID: 7A4A0E684B5D6747
1 changed files with 40 additions and 9 deletions

View File

@ -60,8 +60,29 @@ class Auxiliary
end
#
# Tab completion for the run command
# Reloads an auxiliary module and executes it
#
# Launches an auxiliary module for single attempt.
#
def run_single(mod, opts)
begin
mod.run_simple(
'Action' => action,
'OptionStr' => opts.join(','),
'LocalInput' => driver.input,
'LocalOutput' => driver.output,
'RunAsJob' => jobify,
'Quiet' => quiet
)
rescue
raise $!
end
end
#
# Tab completion for the run command
def cmd_run_tabs(str, words)
return [] if words.length > 1
@@auxiliary_opts.fmt.keys
@ -105,15 +126,25 @@ class Auxiliary
jobify = true
end
rhosts_range = Rex::Socket::RangeWalker.new(mod.datastore['RHOSTS'])
unless rhosts_range && rhosts_range.length
print_error("Auxiliary failed: option RHOSTS failed to validate.")
return false
end
begin
mod.run_simple(
'Action' => action,
'OptionStr' => opts.join(','),
'LocalInput' => driver.input,
'LocalOutput' => driver.output,
'RunAsJob' => jobify,
'Quiet' => quiet
)
# Check whether run a scanner module.
if mod.class.included_modules.include?(Msf::Auxiliary::Scanner)
run_single(mod, opts)
# For multi target attempts.
else
rhosts_range.each do |rhost|
nmod = mod.replicant
nmod.datastore['RHOST'] = rhost
vprint_status("Running module against #{rhost}")
run_single(nmod, opts)
end
end
rescue ::Timeout::Error
print_error("Auxiliary triggered a timeout exception")
print_error("Call stack:")