Nmap Development mailing list archives

Re: [NSE] Interface info of raw IPv4 sockets


From: Gorjan Petrovski <mogi57 () gmail com>
Date: Fri, 24 Jun 2011 00:25:15 +0200

Ok, so I have an idea about why David proposed to use both the -e and
script-arg options in targets-sniffer. It's because if the user
selects one interface with the -e option he won't be able to scan IP
addresses on the other interfaces. (I'm only guessing here)

So the idea of broadcast-ping would be transformed from scanning on
one interface to scanning on all interfaces to add the targets which
respond to broadcast. So it should scan on all interfaces. Correct?

On Wed, Jun 22, 2011 at 6:03 PM, Djalal Harouni <tixxdz () opendz org> wrote:
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
nmap.get_interface() function.
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.

--
tixxdz
http://opendz.org




-- 
Gorjan
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: