Nmap Development mailing list archives

Re: [NSE] Draft - targets-sniffer.nse


From: Nick Nikolaou <nikolasnikolaou1 () gmail com>
Date: Sun, 3 Apr 2011 13:32:21 +0100

Hello everyone,

Apologies for the late reply.

Hello Nick. The script is looking pretty good! I need you to make some
more changes before it is ready to add.


Thanks David, glad to see this is turning out to be something useful.
I made the changes to the script.

Don't use nmap.is_privileged; instead try to open the interface and show
an error if it fails.


I assumed you meant the error NSE prints when it can't open an interface so
I didn't add anything, I simply removed the is_privileged check.

You need to fix the indentation! It's too hard to read and review right
now. The indentation is a mix of spaces and tabs. It looks better if I
turn on two-space tab stops, but it's still not quite right. Please
change it to use spaces throughout using whatever indentation level you
prefer. This is important because if you don't do this, someone else
will have to before the script can be added.


I recently started using vim and thought that two space tab was taking care
of indentation but turns out it looks a mess in other text editors. I
removed the tabs and used two spaces instead. I hope the code is easier to
read now.

I also noticed that when the script captures a large number of IPs
(thousands - I tested this while on a Skype video call) it  won't add the
targets with target.add(unpack(sniffed_targets)) :

NSE: targets-sniffer threw an error!
./targets-sniffer.nse:109: too many results to unpack
stack traceback:
[C]: in function 'unpack'
 ./targets-sniffer.nse:109: in function <./targets-sniffer.nse:51>
(tail call): ?


We may have to change this back to the old method of adding one address at a
time. That would also make output of IP address easier since we could check
for duplicates before printing the addresses.

The script doesn't output the IP address for now (except with -d) but I'll
add that functionality once we decide how I should go about adding addresses
to newtargets.

Cheers,
Nick

Attachment: targets-sniffer.nse
Description:

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

Current thread: