Nmap Development mailing list archives
Re: [NSE] Draft - targets-sniffer.nse
From: David Fifield <david () bamsoftware com>
Date: Fri, 1 Apr 2011 01:20:05 -0700
On Mon, Mar 28, 2011 at 06:41:43PM +0100, Nick Nikolaou wrote:
Not exactly, at least not if timeout stands for "total execution time". In case the timeout is set to 4sec for instance, and if the script receives a packet after 3.90 sec, it will start a loop for another 4 seconds. Maybe it is an intended behavior but I think that most users will expect the script to sniff for the exact duration they supplied. You could update the timeout at each iteration to have a finer control of the execution time.You are right, I meant to set the socket timeout as a constant (example 1-2 seconds) and that way depending on the frequency of packets it would always timeout within 1 or 2 seconds. Your way makes more sense since it would allow the script to sniff for the exact time specified and there's no reason for all the extra receive calls. Cool! Unless I am missing a reason not to do so, you could even movethe last call into the prerule functionDone.Finally, I would also suggest to use stdnse.get_script_args() instead of reading arguments from the registry. This could be combined with the addition of a default value for the timeout.Good idea, thanks. I made all the changes. Thanks again for your help.
Hello Nick. The script is looking pretty good! I need you to make some more changes before it is ready to add. 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. The script needs to print out its IP addresses, whether newtargets is set or not. I think that running without newtargets is a more important use case. If I run the script now, I get this after 10 seconds: NSE: ERROR: to add targets run with --script-args 'newtargets' NSE: Finished 'targets-sniffer' (thread: 0x91ca2f0). Instead, it should print a list of targets it should add. See the use of target.ALLOW_NEW_TARGETS in other scripts for how to check if you're allowed to call target.add. Don't use nmap.is_privileged; instead try to open the interface and show an error if it fails. Add a targets-sniffer.iface script argument to allow controlling the interface independently from -e. It should default to -e if the script argument is not given. For example, "targets-sniffer.iface=eth0". David Fifield _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Re: [NSE] Draft - targets-sniffer.nse David Fifield (Apr 01)
- Re: [NSE] Draft - targets-sniffer.nse Djalal Harouni (Apr 02)
- Re: [NSE] Draft - targets-sniffer.nse Nick Nikolaou (Apr 03)
- Re: [NSE] Draft - targets-sniffer.nse Djalal Harouni (Apr 03)
- Re: [NSE] Draft - targets-sniffer.nse Nick Nikolaou (Apr 04)
- Re: [NSE] Draft - targets-sniffer.nse David Fifield (Apr 04)
- Re: [NSE] Draft - targets-sniffer.nse Nick Nikolaou (Apr 04)
- Re: [NSE] Draft - targets-sniffer.nse David Fifield (Apr 04)
- Re: [NSE] Draft - targets-sniffer.nse Djalal Harouni (Apr 23)
- Re: [NSE] Draft - targets-sniffer.nse Nick Nikolaou (Apr 03)
- Re: [NSE] Draft - targets-sniffer.nse Djalal Harouni (Apr 02)
- Re: [NSE] Draft - targets-sniffer.nse David Fifield (Apr 04)