Land #11486, fix running non-scanner aux modules

Merge remote-tracking branch 'upstream/pr/11486' into upstream-master
GSoC/Meterpreter_Web_Console
Brent Cook 2019-02-26 09:40:53 -06:00
commit e2298393b3
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
1 changed files with 12 additions and 10 deletions

View File

@ -62,7 +62,7 @@ class Auxiliary
#
# Launches an auxiliary module for single attempt.
#
def run_single(mod, opts)
def run_single(mod, action, opts)
begin
mod.run_simple(
'Action' => action,
@ -123,23 +123,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
if mod.datastore['RHOSTS']
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
end
begin
# Check whether run a scanner module.
if mod.class.included_modules.include?(Msf::Auxiliary::Scanner)
run_single(mod, opts)
# For multi target attempts.
# Check if this is a scanner module.
if mod.class.included_modules.include?(Msf::Auxiliary::Scanner) || rhosts_range.nil?
run_single(mod, action, opts)
else
# For multi target attempts.
rhosts_range.each do |rhost|
nmod = mod.replicant
nmod.datastore['RHOST'] = rhost
vprint_status("Running module against #{rhost}")
run_single(nmod, opts)
run_single(nmod, action, opts)
end
end
rescue ::Timeout::Error