Nmap Development mailing list archives

-iR N for N < 16


From: jah <jah () zadkiel plus com>
Date: Sun, 24 Nov 2013 21:18:20 +0000

Hi List,

nmap -n -sL -iR 1
Starting Nmap 6.41SVN ( http://nmap.org ) at 2013-11-24 20:54 GMT Standard Time
...
Nmap done: 16 IP addresses (0 hosts up) scanned in 0.05 seconds

That's 16 randomly generated hosts when the command specified just one.

In nmap_main there's this:

  do {
    ideal_scan_group_sz = determineScanGroupSize(o.numhosts_scanned, &ports);
    while (Targets.size() < ideal_scan_group_sz) {

That ideal_scan_group_sz doesn't take into account o.max_ips_to_scan when using -iR.  The following produces the 
correct behaviour:

@@ -1848,4 +1848,6 @@
 
   do {
     ideal_scan_group_sz = determineScanGroupSize(o.numhosts_scanned, &ports);
+    if (o.max_ips_to_scan && o.max_ips_to_scan < ideal_scan_group_sz)
+      ideal_scan_group_sz = o.max_ips_to_scan;
     while (Targets.size() < ideal_scan_group_sz) {

I'll commit this change unless anybody thinks it should be corrected differently (e.g. parse_options could call 
o.setMaxHostGroupSz() as well as setting o.max_ips_to_scan when -iR is used so that determineScanGroupSize would never 
return anything larger than o.max_ips_to_scan).

jah

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


Current thread: