Module: Msf::Exploit::DHCPServer

Defined in:
lib/msf/core/exploit/dhcp_server.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.



49
50
51
# File 'lib/msf/core/exploit/dhcp_server.rb', line 49

def dhcp
  @dhcp
end

Instance Method Details

#initialize(info = {}) ⇒ Object



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

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



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

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



44
45
46
47
# File 'lib/msf/core/exploit/dhcp_server.rb', line 44

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