Module: Msf::Exploit::BruteTargets

Defined in:
lib/msf/core/exploit/brutetargets.rb

Overview

This module allows a compatible exploit to be called once for every valid target, in succession, until no targets are left.

Instance Method Summary collapse

Instance Method Details

#exploit(*args) ⇒ Object

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.


17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/msf/core/exploit/brutetargets.rb', line 17

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)} possible targets")

    targets.each_index do |i|
      next if i == 0
      break if session_created?
      print_status("Trying target #{targets[i].name}...")
      exploit_target(targets[i])
    end

  # Otherwise, only try the specified target
  else
    exploit_target(target())
  end

end