mailing list archives
Re: [NSE] Interface info of raw IPv4 sockets
From: Djalal Harouni <tixxdz () opendz org>
Date: Wed, 22 Jun 2011 17:03:26 +0100
On Wed, Jun 22, 2011 at 04:43:01PM +0200, Gorjan Petrovski wrote:
I suppose a better alternative would be a dnet:get_interface()
function which returns info on the interface of an open IP socket,
since we have no way of specifying which interface the IP socket opens
on. Better yet, an optional argument to the dnet:ip_open(interface),
to let us specify the interface for the IP socket and a fix for the
Normally nmap.get_interface() and nmap.get_interface_info() should cover
all the situations, at least for the broadcast and pcap stuff, but for
dnet I don't know. After a first look it seems that the info
(device, and routes, etc) are built during the dnet:ip_send() call.
Well, the way I understand it, if the interface for the raw IP socket
is the one specified with the -e option then everything's resolved. I
just have to make the -e option mandatory for the broadcast-ping
script I'm working on right now.
This should work: "if the interface for the raw IP socket is the
one specified with the -e option then everything's resolved", but you
must test it.
I think that if you get the interface name with nmap.get_interface(),
then the interface info with nmap.get_interface_info(), and you use the
source IP of that interface in your raw packets, then dnet:ip_send()
should use that interface.
Just to note that the targets-sniffer script uses a special script
argument 'targets-sniffer.iface' to get the choosed interface, if it's not
used then it will fallback to nmap.get_interface(). IIRC this was
suggested by David.
Sent through the nmap-dev mailing list
Archived at http://seclists.org/nmap-dev/
Re: [NSE] Interface info of raw IPv4 sockets David Fifield (Jun 22)