From f2582ac38e153c93da37b1ff44a2a5ed63e4a3cb Mon Sep 17 00:00:00 2001 From: HD Moore Date: Wed, 14 Dec 2005 05:15:06 +0000 Subject: [PATCH] /me feels slapped around git-svn-id: file:///home/svn/incoming/trunk@3226 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/exploit/brutetargets.rb | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lib/msf/core/exploit/brutetargets.rb diff --git a/lib/msf/core/exploit/brutetargets.rb b/lib/msf/core/exploit/brutetargets.rb new file mode 100644 index 0000000000..148ea0cf64 --- /dev/null +++ b/lib/msf/core/exploit/brutetargets.rb @@ -0,0 +1,39 @@ +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) + + print_status("Brute forcing with #{(targets.length - 1).to_s} possible targets") + + targets.each_index do |i| + next if i == 0 + + print_status("Trying target #{targets[i].name}...") + exploit_target(targets[i]) + end + + # Otherwise, only try the specified target + else + exploit_target(target()) + end + +end + + + +end +end