From 8605cc368226ac1ec8e2475140fe8603d87e67fb Mon Sep 17 00:00:00 2001 From: fyodor Date: Fri, 11 Jul 2008 07:28:36 +0000 Subject: [PATCH] Merge r863 of nmap-exp/fyodor-perf: o Added the undocumented (except here) --nogcc option which disables global/group congestion control algorithms and so each member of a scan group of machines is treated separately. This is just an experimental option for now. [Fyodor] --- CHANGELOG | 5 +++++ NmapOps.cc | 1 + NmapOps.h | 1 + nmap.cc | 3 +++ scan_engine.cc | 7 +++++++ 5 files changed, 17 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index dbcbcf73b..a8e8c2b73 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,10 @@ # Nmap Changelog ($Id$); -*-text-*- +o Added the undocumented (except here) --nogcc option which disables + global/group congestion control algorithms and so each member of a + scan group of machines is treated separately. This is just an + experimental option for now. [Fyodor] + o Added a new NSE Unpwdb (username/password database) library for easily obtaining usernames or passwords from a list. The functions usernames() and passwords() return a closure which returns a new list entry with diff --git a/NmapOps.cc b/NmapOps.cc index fc4cb1bdd..2aed985dc 100644 --- a/NmapOps.cc +++ b/NmapOps.cc @@ -199,6 +199,7 @@ void NmapOps::Initialize() { device[0] = '\0'; interactivemode = 0; ping_group_sz = PING_GROUP_SZ; + nogcc = 0; generate_random_ips = 0; reference_FPs = NULL; magic_port = 33000 + (get_random_uint() % 31000); diff --git a/NmapOps.h b/NmapOps.h index 9f44aa8b8..ecdb12b05 100644 --- a/NmapOps.h +++ b/NmapOps.h @@ -186,6 +186,7 @@ class NmapOps { char device[64]; int interactivemode; int ping_group_sz; + int nogcc; /* Turn off group congestion control with --nogcc */ int generate_random_ips; /* -iR option */ FingerPrintDB *reference_FPs; /* Used in the new OS scan system. */ u16 magic_port; diff --git a/nmap.cc b/nmap.cc index 45bed960f..0b2d7fe04 100644 --- a/nmap.cc +++ b/nmap.cc @@ -565,6 +565,7 @@ int nmap_main(int argc, char *argv[]) { {"iflist", no_argument, 0, 0}, {"release_memory", no_argument, 0, 0}, {"release-memory", no_argument, 0, 0}, + {"nogcc", no_argument, 0, 0}, {"max_os_tries", required_argument, 0, 0}, {"max-os-tries", required_argument, 0, 0}, {"max_parallelism", required_argument, 0, 'M'}, @@ -763,6 +764,8 @@ int nmap_main(int argc, char *argv[]) { } } else if (strcmp(long_options[option_index].name, "iflist") == 0 ) { iflist = true; + } else if (strcmp(long_options[option_index].name, "nogcc") == 0 ) { + o.nogcc = 1; } else if (optcmp(long_options[option_index].name, "release-memory") == 0 ) { o.release_memory = true; } else if (optcmp(long_options[option_index].name, "min-parallelism") == 0 ) { diff --git a/scan_engine.cc b/scan_engine.cc index 9dfbf2b57..2048c8b8e 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -906,6 +906,13 @@ bool GroupScanStats::sendOK(struct timeval *when) { if (recentsends >= 50) return false; + /* In case the user specifically asked for no group congestion control */ + if (o.nogcc) { + if (when) + *when = USI->now; + return true; + } + /* Enforce a minimum scanning rate, if necessary. If we're ahead of schedule, record the time of the next scheduled send. If we're behind schedule, return true to indicate that we need to send now, regardless of any