Nmap Development mailing list archives
Re: nmap.bind to set NSE socket source address
From: Patrick Donnelly <batrick () batbytes com>
Date: Thu, 15 Oct 2009 18:59:02 -0400
On Thu, Oct 15, 2009 at 6:45 PM, David Fifield <david () bamsoftware com> wrote:
The DHCP server in my router sends back a unicast DHCP offer in response to DHCPDISCOVER, so it must not be every server that does that. I think what you would normally do is make a socket bound to 255.255.255.255:67 and try to receive on it. In Python this works: import socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) s.bind("255.255.255.255", 67) print s.recv() But that currently won't work in NSE, because the socket descriptor isn't created until a connection is attempted. There's no way to create a socket without also connecting it. Something about the connection keeps the receive from working. This is what I tried: s = nmap.new_socket() assert(s:bind("255.255.255.255", 67)) assert(s:connect(host.ip, 68, "udp")) status, data = s:receive() So we would have to rearchitect part of Nsock to allocate a socket on nsi_new, which I think is pretty reasonable.
Funnily enough, if we do actually assign a socket using nsi_new when nmap.new_socket is called, we no longer need to have the reconnect_ssl method. We could simply add the extra case to the connect method. Perhaps this is worth doing just so we can get rid of that extra method now, and so bind works before the call to connect? -- -Patrick Donnelly "Let all men know thee, but no man know thee thoroughly: Men freely ford that see the shallows." - Benjamin Franklin _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- nmap.bind to set NSE socket source address David Fifield (Oct 11)
- Re: nmap.bind to set NSE socket source address Ron (Oct 11)
- Re: nmap.bind to set NSE socket source address Ron (Oct 11)
- Re: nmap.bind to set NSE socket source address David Fifield (Oct 15)
- Re: nmap.bind to set NSE socket source address Patrick Donnelly (Oct 15)
- Re: nmap.bind to set NSE socket source address Tom Sellers (Oct 15)
- Re: nmap.bind to set NSE socket source address Ron (Oct 15)
- Re: nmap.bind to set NSE socket source address David Fifield (Oct 15)