mirror of
https://github.com/nmap/nmap.git
synced 2025-12-29 02:49:01 +00:00
Prevent system from going to sleep during scans. Fixes #1192
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
@@ -1173,6 +1173,10 @@ int FPEngine6::os_scan(std::vector<Target *> &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++) {
|
||||
|
||||
|
||||
@@ -3663,6 +3663,10 @@ int OSScan::os_scan_ipv4(std::vector<Target *> &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)
|
||||
|
||||
@@ -2777,6 +2777,10 @@ void ultra_scan(std::vector<Target *> &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
|
||||
|
||||
Reference in New Issue
Block a user