Home page logo
/

nmap-dev logo Nmap Development mailing list archives

[PATCH] pingscan + traceroute and false reporting of numhosts_scanned
From: jah <jah () zadkiel plus com>
Date: Tue, 09 Jun 2009 23:09:41 +0100

Hi Nmappers,

Attached is a short patch which fixes false reporting of the number of
hosts scanned when ping scanning with traceroute.  The false reporting
has arisen because of the improvements to reporting made in r13179, but
the improvements missed this single case (-sP --traceroute).
A couple of examples:

A single responsive target:
nmap -sP -d -PE --traceroute <target>
...
We got a ping packet back from <target> ...
...
Host <target> is up, received echo-reply.
[traceroute table]
WARNING: No targets were specified, so 0 hosts scanned.
Nmap done: 0 IP addresses (1 host up) scanned in 11.41 seconds

There's clearly no need for the warning and "0 IP addresses" just ain't
right.

7 targets, three of which are responsive:
nmap -sP -d -PE --traceroute <7-targets>
...
We got a ping packet back from <target> ...
We got a ping packet back from <target> ...
We got a ping packet back from <target> ...
...
Host <target> is up, received echo-reply.
[traceroute table]
Host <target> is up, received echo-reply.
[traceroute table]
Host <target> is up, received echo-reply.
[traceroute table]
Nmap done: 4 IP addresses (3 hosts up) scanned in 24.22 seconds

Again, "4 IP addresses" should read "7 IP addresses".

After application of the attached patch there is no WARNING for the
single target scan:
Nmap done: 1 IP address (1 host up) scanned in 9.11 seconds

and for the 7 targets:
Nmap done: 7 IP addresses (3 hosts up) scanned in 24.00 seconds

The fix seems to me to be a suitable place to increment
o.numhosts_scanned, but it also seems like a bit of a random place to do
it (in a block where we're printing ping traceroutes).
Anyone got a better idea or should the fix be committed as-is?

Cheers,

jah



--- nmap.cc.orig        2009-06-09 22:37:38.690801300 +0100
+++ nmap.cc     2009-06-09 22:50:20.612676300 +0100
@@ -1817,6 +1817,7 @@
          * trace is first */
         while(!Targets.empty()) {
             currenths = *Targets.begin();
+            o.numhosts_scanned++;
             log_write(LOG_XML, "<host>");
             write_host_status(currenths, o.resolve_all);
             printmacinfo(currenths);

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

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]
AlienVault