Class: Msf::Module::Target::Bruteforce

Inherits:
Hash
  • Object
show all
Defined in:
lib/msf/core/module/target.rb

Overview

Target-specific brute force information, such as the addresses to step, the step size (if the framework default is bad), and other stuff.

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Bruteforce

Initializes a brute force target from the supplied brute forcing information.


24
25
26
# File 'lib/msf/core/module/target.rb', line 24

def initialize(hash)
  update(hash)
end

Instance Method Details

#default_directionObject

Returns the default step direction. -1 indicates that brute forcing should go toward lower addresses. 1 indicates that brute forcing should go toward higher addresses.


66
67
68
69
70
71
72
73
74
# File 'lib/msf/core/module/target.rb', line 66

def default_direction
  dd = self['DefaultDirection']

  if (dd and dd.to_s.match(/(-1|backward)/i))
    return -1
  end

  return 1
end

#delayObject

The delay to add between attempts


79
80
81
# File 'lib/msf/core/module/target.rb', line 79

def delay
  self['Delay'].to_i || 0
end

#start_addressesObject

Returns a hash of addresses that should be stepped during exploitation and passed in to the bruteforce exploit routine.


33
34
35
36
37
38
39
# File 'lib/msf/core/module/target.rb', line 33

def start_addresses
  if (self['Start'] and self['Start'].kind_of?(Hash) == false)
    return {'Address' => self['Start'] }
  else
    return self['Start']
  end
end

#step_sizeObject

The step size to use, or zero if the framework should figure it out.


57
58
59
# File 'lib/msf/core/module/target.rb', line 57

def step_size
  self['Step'] || 0
end

#stop_addressesObject

Returns a hash of addresses that should be stopped at once they are reached.


45
46
47
48
49
50
51
# File 'lib/msf/core/module/target.rb', line 45

def stop_addresses
  if (self['Stop'] and self['Stop'].kind_of?(Hash) == false)
    return {'Address' => self['Stop'] }
  else
    return self['Stop']
  end
end