1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-22 07:29:01 +00:00

Fixed -iR scanning too many targets

Fixed a discrepancy between the number of targets selected with -iR and
the number of hosts scanned. Because "up" hosts did not count towards
the number of hosts in a hostgroup, Nmap would run an extra Ping scan
phase on that number of new targets before scanning. Those extra targets
in the last hostgroup would result in output like "Nmap done: 1056 IP
addresses" when the user specified -iR 1000.

https://security.stackexchange.com/questions/138150/scans-more-ips-than-asked
This commit is contained in:
dmiller
2016-09-29 14:56:47 +00:00
parent 4a8df9a9d7
commit 82ea8a80d3
2 changed files with 12 additions and 2 deletions

10
nmap.cc
View File

@@ -2031,7 +2031,10 @@ int nmap_main(int argc, char *argv[]) {
}
delete currenths;
o.numhosts_scanned++;
continue;
if (!o.max_ips_to_scan || o.max_ips_to_scan > o.numhosts_scanned + Targets.size())
continue;
else
break;
}
if (o.spoofsource) {
@@ -2051,7 +2054,10 @@ int nmap_main(int argc, char *argv[]) {
}
delete currenths;
o.numhosts_scanned++;
continue;
if (!o.max_ips_to_scan || o.max_ips_to_scan > o.numhosts_scanned + Targets.size())
continue;
else
break;
}
if (o.RawScan()) {