2010-08-06 17:37:28 +00:00
|
|
|
##
|
2014-10-17 16:47:33 +00:00
|
|
|
# This module requires Metasploit: http://metasploit.com/download
|
2013-10-15 18:50:46 +00:00
|
|
|
# Current source: https://github.com/rapid7/metasploit-framework
|
2010-08-06 17:37:28 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
require 'rex/proto/dhcp'
|
|
|
|
|
2016-03-08 13:02:44 +00:00
|
|
|
class MetasploitModule < Msf::Auxiliary
|
2010-08-06 17:37:28 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
include Msf::Exploit::Remote::DHCPServer
|
|
|
|
include Msf::Auxiliary::Report
|
2010-08-06 17:37:28 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'DHCP Server',
|
|
|
|
'Description' => %q{
|
|
|
|
This module provides a DHCP service
|
|
|
|
},
|
|
|
|
'Author' => [ 'scriptjunkie', 'apconole@yahoo.com' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Actions' =>
|
|
|
|
[
|
|
|
|
[ 'Service' ]
|
|
|
|
],
|
|
|
|
'PassiveActions' =>
|
|
|
|
[
|
|
|
|
'Service'
|
|
|
|
],
|
|
|
|
'DefaultAction' => 'Service'
|
|
|
|
)
|
2010-08-06 17:37:28 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
end
|
2010-08-06 17:37:28 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
def run
|
|
|
|
@dhcp = Rex::Proto::DHCP::Server.new(datastore)
|
2010-08-06 17:37:28 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("Starting DHCP server...")
|
|
|
|
@dhcp.start
|
|
|
|
add_socket(@dhcp.sock)
|
2010-08-06 17:37:28 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
# Wait for finish..
|
|
|
|
while @dhcp.thread.alive?
|
|
|
|
select(nil, nil, nil, 2)
|
|
|
|
end
|
2010-08-14 04:58:27 +00:00
|
|
|
|
2013-08-30 21:28:54 +00:00
|
|
|
print_status("Stopping DHCP server...")
|
|
|
|
@dhcp.stop
|
|
|
|
end
|
2010-08-06 17:37:28 +00:00
|
|
|
|
|
|
|
end
|