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 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) def cmd_run_tabs(str, words)
return [] if words.length > 1 return [] if words.length > 1
@@auxiliary_opts.fmt.keys @@auxiliary_opts.fmt.keys
@ -105,15 +126,25 @@ class Auxiliary
jobify = true jobify = true
end 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 begin
mod.run_simple( # Check whether run a scanner module.
'Action' => action, if mod.class.included_modules.include?(Msf::Auxiliary::Scanner)
'OptionStr' => opts.join(','), run_single(mod, opts)
'LocalInput' => driver.input, # For multi target attempts.
'LocalOutput' => driver.output, else
'RunAsJob' => jobify, rhosts_range.each do |rhost|
'Quiet' => quiet nmod = mod.replicant
) nmod.datastore['RHOST'] = rhost
vprint_status("Running module against #{rhost}")
run_single(nmod, opts)
end
end
rescue ::Timeout::Error rescue ::Timeout::Error
print_error("Auxiliary triggered a timeout exception") print_error("Auxiliary triggered a timeout exception")
print_error("Call stack:") print_error("Call stack:")