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.



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

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.



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

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



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

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.



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

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.



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

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

#stop_addressesObject

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



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

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