Module: Msf::Exploit::DHCPServer

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

Overview

This mixin provides a DHCPServer

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dhcpObject

Returns the value of attribute dhcp


50
51
52
# File 'lib/msf/core/exploit/dhcp.rb', line 50

def dhcp
  @dhcp
end

Instance Method Details

#initialize(info = {}) ⇒ Object


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

def initialize(info = {})
  super(update_info(info,
    'Stance' => Msf::Exploit::Stance::Passive,
  ))

  register_options(
    [
      OptString.new('SRVHOST',     [ true,  "The IP of the DHCP server" ]),
      OptString.new('NETMASK',     [ true,  "The netmask of the local subnet" ]),
      OptString.new('DHCPIPSTART', [ false, "The first IP to give out" ]),
      OptString.new('DHCPIPEND',   [ false, "The last IP to give out" ]),
      OptString.new('ROUTER',      [ false, "The router IP address" ]),
      OptString.new('BROADCAST',   [ false, "The broadcast address to send to" ]),
      OptString.new('DNSSERVER',   [ false, "The DNS server IP address" ]),
      OptString.new('DOMAINNAME',  [ false, "The optional domain name to assign" ]),
      OptString.new('HOSTNAME',    [ false, "The optional hostname to assign" ]),
      OptString.new('HOSTSTART',   [ false, "The optional host integer counter" ]),
      OptString.new('FILENAME',    [ false, "The optional filename of a tftp boot server" ])
    ], self.class)

  @dhcp = nil
end

#start_service(hash = {}, context = {}) ⇒ Object


37
38
39
40
41
42
43
# File 'lib/msf/core/exploit/dhcp.rb', line 37

def start_service(hash = {}, context = {})
  @dhcp = Rex::Proto::DHCP::Server.new(hash, context)
  vprint_status("Starting DHCP server")
  @dhcp.start
  add_socket(@dhcp.sock)
  @dhcp
end

#stop_serviceObject


45
46
47
48
# File 'lib/msf/core/exploit/dhcp.rb', line 45

def stop_service
  vprint_status("Stopping DHCP server")
  @dhcp.stop
end