fixes #2435, add BROADCAST option to DHCP server, use in cases where sending to 255.255.255.255 fails

git-svn-id: file:///home/svn/framework3/trunk@10159 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
Joshua Drake 2010-08-26 19:34:53 +00:00
parent aee73a3129
commit 6e48076249
2 changed files with 15 additions and 7 deletions

View File

@ -49,7 +49,12 @@ class Server
dnsserv = hash['DNSSERVER'] || source
self.dnsserv = Rex::Socket.addr_aton(dnsserv)
self.broadcasta = Rex::Socket.addr_itoa( self.start_ip | (Rex::Socket.addr_ntoi(self.netmaskn) ^ 0xffffffff) )
# broadcast
if hash['BROADCAST']
self.broadcasta = Rex::Socket.addr_aton(hash['BROADCAST'])
else
self.broadcasta = Rex::Socket.addr_itoa( self.start_ip | (Rex::Socket.addr_ntoi(self.netmaskn) ^ 0xffffffff) )
end
self.served = {}
if (hash['SERVEONCE'])
@ -115,7 +120,9 @@ class Server
if ip
self.sock.sendto( pkt, ip, port )
else
self.sock.sendto( pkt, '255.255.255.255', port )
if not self.sock.sendto( pkt, '255.255.255.255', port )
self.sock.sendto( pkt, self.broadcasta, port )
end
end
end

View File

@ -39,13 +39,14 @@ class Metasploit3 < Msf::Auxiliary
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('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('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('FILENAME', [ false, "The optional filename of a tftp boot server" ])
OptString.new('FILENAME', [ false, "The optional filename of a tftp boot server" ])
], self.class)
end