metasploit-framework/modules/auxiliary/server/dhcp.rb

50 lines
1.0 KiB
Ruby
Raw Normal View History

##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
require 'rex/proto/dhcp'
2016-03-08 13:02:44 +00:00
class MetasploitModule < Msf::Auxiliary
2013-08-30 21:28:54 +00:00
include Msf::Exploit::Remote::DHCPServer
include Msf::Auxiliary::Report
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'
)
2013-08-30 21:28:54 +00:00
end
2013-08-30 21:28:54 +00:00
def run
@dhcp = Rex::Proto::DHCP::Server.new(datastore)
2013-08-30 21:28:54 +00:00
print_status("Starting DHCP server...")
@dhcp.start
add_socket(@dhcp.sock)
2013-08-30 21:28:54 +00:00
# Wait for finish..
while @dhcp.thread.alive?
select(nil, nil, nil, 2)
end
2013-08-30 21:28:54 +00:00
print_status("Stopping DHCP server...")
@dhcp.stop
end
end