2005-12-14 05:15:06 +00:00
|
|
|
module Msf
|
|
|
|
|
|
|
|
###
|
|
|
|
#
|
|
|
|
# This module allows a compatible exploit to be called once for every valid target,
|
|
|
|
# in succession, until no targets are left.
|
|
|
|
#
|
|
|
|
###
|
|
|
|
module Exploit::BruteTargets
|
|
|
|
|
|
|
|
|
|
|
|
# Compatible exploit modules define a method call exploit_target, which is called once
|
|
|
|
# for every target in the list. The very first target should always be a stub for enabling
|
|
|
|
# the brute force mode.
|
|
|
|
|
|
|
|
def exploit(*args)
|
|
|
|
# Brute force through every available target
|
|
|
|
if (not datastore['TARGET'] or datastore['TARGET'].to_i == 0)
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2008-12-19 07:11:08 +00:00
|
|
|
print_status("Brute forcing with #{(targets.length - 1)} possible targets")
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2005-12-14 05:15:06 +00:00
|
|
|
targets.each_index do |i|
|
|
|
|
next if i == 0
|
2005-12-31 18:03:02 +00:00
|
|
|
break if session_created?
|
2005-12-14 05:15:06 +00:00
|
|
|
print_status("Trying target #{targets[i].name}...")
|
|
|
|
exploit_target(targets[i])
|
|
|
|
end
|
2011-11-20 01:32:06 +00:00
|
|
|
|
2005-12-14 05:15:06 +00:00
|
|
|
# Otherwise, only try the specified target
|
|
|
|
else
|
|
|
|
exploit_target(target())
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
2011-11-20 01:32:06 +00:00
|
|
|
end
|