diff --git a/CHANGELOG b/CHANGELOG index 90a2f7d5a..937725c12 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,10 @@ #Nmap Changelog ($Id$); -*-text-*- +o [GH#1192][Windows] Periodically reset the system idle timer to keep the + system from going to sleep while scans are in process. This only affects port + scans and OS detection scans, since NSE and version scan do not rely on + timing data to adjust speed. + o [GH#1023] Handle Internationalized Domain Names (IDN) like Яндекс.рф on platforms where getaddrinfo supports the AI_IDN flag. [Daniel Miller] diff --git a/FPEngine.cc b/FPEngine.cc index ca0622360..9b04984a1 100644 --- a/FPEngine.cc +++ b/FPEngine.cc @@ -1173,6 +1173,10 @@ int FPEngine6::os_scan(std::vector &Targets) { (int) curr_hosts.size(), (int) left_hosts.size(), (int) done_hosts.size()); } +#ifdef WIN32 + // Reset system idle timer to avoid going to sleep + SetThreadExecutionState(ES_SYSTEM_REQUIRED); +#endif /* Go through the list of hosts and ask them to schedule their probes */ for (unsigned int i = 0; i < curr_hosts.size(); i++) { diff --git a/osscan2.cc b/osscan2.cc index 8ff520eea..f9c9f87ac 100644 --- a/osscan2.cc +++ b/osscan2.cc @@ -3663,6 +3663,10 @@ int OSScan::os_scan_ipv4(std::vector &Targets) { /* Initialize the pcap session handler in HOS */ begin_sniffer(&HOS, Targets); while (OSI.numIncompleteHosts() != 0) { +#ifdef WIN32 + // Reset system idle timer to avoid going to sleep + SetThreadExecutionState(ES_SYSTEM_REQUIRED); +#endif if (itry > 0) sleep(1); if (itry == 3) diff --git a/scan_engine.cc b/scan_engine.cc index a15cee0ed..c8b4c516f 100644 --- a/scan_engine.cc +++ b/scan_engine.cc @@ -2777,6 +2777,10 @@ void ultra_scan(std::vector &Targets, const struct scan_lists *ports, /* Otherwise, no sniffer needed! */ while (!USI.incompleteHostsEmpty()) { +#ifdef WIN32 + // Reset system idle timer to avoid going to sleep + SetThreadExecutionState(ES_SYSTEM_REQUIRED); +#endif doAnyPings(&USI); doAnyOutstandingRetransmits(&USI); // Retransmits from probes_outstanding /* Retransmits from retry_stack -- goes after OutstandingRetransmits for