2010-08-06 17:37:28 +00:00
|
|
|
##
|
|
|
|
# $Id$
|
|
|
|
##
|
|
|
|
|
|
|
|
##
|
|
|
|
# This file is part of the Metasploit Framework and may be subject to
|
|
|
|
# redistribution and commercial restrictions. Please see the Metasploit
|
|
|
|
# Framework web site for more information on licensing and terms of use.
|
|
|
|
# http://metasploit.com/framework/
|
|
|
|
##
|
|
|
|
|
|
|
|
require 'msf/core'
|
|
|
|
require 'rex/proto/dhcp'
|
|
|
|
|
|
|
|
class Metasploit3 < Msf::Auxiliary
|
|
|
|
|
|
|
|
include Msf::Exploit::Remote::DHCPServer
|
|
|
|
include Msf::Auxiliary::Report
|
|
|
|
|
|
|
|
def initialize
|
|
|
|
super(
|
|
|
|
'Name' => 'DHCP File Server',
|
|
|
|
'Version' => '$Revision$',
|
|
|
|
'Description' => %q{
|
|
|
|
This module provides a DHCP service
|
|
|
|
},
|
|
|
|
'Author' => [ 'scriptjunkie' ],
|
|
|
|
'License' => MSF_LICENSE,
|
|
|
|
'Actions' =>
|
|
|
|
[
|
2010-09-20 08:05:50 +00:00
|
|
|
[ 'Service' ]
|
2010-08-06 17:37:28 +00:00
|
|
|
],
|
|
|
|
'PassiveActions' =>
|
|
|
|
[
|
2010-09-20 08:05:50 +00:00
|
|
|
'Service'
|
2010-08-06 17:37:28 +00:00
|
|
|
],
|
2010-09-20 08:05:50 +00:00
|
|
|
'DefaultAction' => 'Service'
|
2010-08-06 17:37:28 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
register_options(
|
|
|
|
[
|
2010-08-26 19:34:53 +00:00
|
|
|
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" ]),
|
2010-08-06 17:37:28 +00:00
|
|
|
OptString.new('DHCPIPEND', [ false, "The last IP to give out" ]),
|
2010-08-26 19:34:53 +00:00
|
|
|
OptString.new('ROUTER', [ false, "The router IP address" ]),
|
|
|
|
OptString.new('BROADCAST', [ false, "The broadcast address to send to" ]),
|
2010-08-13 03:11:30 +00:00
|
|
|
OptString.new('DNSSERVER', [ false, "The DNS server IP address" ]),
|
2010-08-26 19:34:53 +00:00
|
|
|
OptString.new('FILENAME', [ false, "The optional filename of a tftp boot server" ])
|
2010-08-06 17:37:28 +00:00
|
|
|
], self.class)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run
|
|
|
|
@dhcp = Rex::Proto::DHCP::Server.new(datastore)
|
|
|
|
|
|
|
|
print_status("Starting DHCP server...")
|
|
|
|
@dhcp.start
|
2010-08-14 04:58:27 +00:00
|
|
|
add_socket(@dhcp.sock)
|
2010-08-06 17:37:28 +00:00
|
|
|
|
|
|
|
# Wait for finish..
|
2010-08-14 04:58:27 +00:00
|
|
|
while @dhcp.thread.alive?
|
|
|
|
select(nil, nil, nil, 2)
|
|
|
|
end
|
|
|
|
|
|
|
|
print_status("Stopping DHCP server...")
|
|
|
|
@dhcp.stop
|
2010-08-06 17:37:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|