Nmap Development mailing list archives
nping command line parsing: set source IP address
From: Perry Hooker <phooker () terraechos com>
Date: Wed, 15 May 2013 23:11:38 +0000
I've run in to some problems using nping 0.6.25 with the command-line option to set the source IP address (-S, --source-ip) on CentOS 6.2. Specifically, when I specify a numeric source IP address, e.g. $ nping -c 1 -S 192.168.1.1 127.0.0.1 I get the error message WARNING: No targets specified, so 0 hosts pinged. However, the command $ nping -c 1 -S random 127.0.0.1 functions as expected. An examination of the case 'S': clause in ArgParser.cc reveals that the value of argc is reset to 0 by the call to atoIP. This causes the grab_next_host_spec method in netutil.cc to return NULL before parsing the target argument. Changing the line in grab_next_host_spec function from return( (optind < argc) ? fakeargv[optind++] : NULL); to return fakeargv[optind++]; seems to work around the problem, but I'm unclear as to why this does NOT result in an infinite loop during parsing of target host specifications (at the end of the parseArguments method in ArgParser.cc). Removing the line fakeargv[argc] = NULL; in nmap.cc doesn't seem to change this behavior. I'm also not sure why the value of argc is modified in the first place. I suspect it's related to the getopt family of functions, but I'm not sure. Guidance / corrections to my reasoning much appreciated. rphv _______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- nping command line parsing: set source IP address Perry Hooker (May 15)
- RE: nping command line parsing: set source IP address Perry Hooker (May 16)
- Re: nping command line parsing: set source IP address David Fifield (May 17)
- RE: nping command line parsing: set source IP address Perry Hooker (May 17)
- Re: nping command line parsing: set source IP address David Fifield (May 17)
- RE: nping command line parsing: set source IP address Perry Hooker (May 17)
- Re: nping command line parsing: set source IP address Luis MartinGarcia. (May 18)
- RE: nping command line parsing: set source IP address Perry Hooker (May 17)