mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 22:21:29 +00:00
Use only the number of completed ports when computing completion time
estimates, and don't consider the number of outstanding probes or number of retries. The old code would overestimate completion, causing a period of 99.99% completion at the end of a scan (which caused earlier estimates to be too soon). For a long UDP scan this puts the completion estimate right on after a little time to allow for convergence. See http://www.bamsoftware.com/wiki/Nmap/CompletionTimeEstimates.
This commit is contained in:
@@ -3271,10 +3271,7 @@ static void printAnyStats(UltraScanInfo *USI) {
|
||||
hostI != USI->incompleteHosts.end(); hostI++) {
|
||||
host = *hostI;
|
||||
maxtries = host->allowedTryno(NULL, NULL) + 1;
|
||||
// This is inexact (maxtries - 1) because of numprobes_sent includes
|
||||
// at least one try of ports_finished.
|
||||
thishostpercdone = host->ports_finished * (maxtries -1) + host->numprobes_sent;
|
||||
thishostpercdone /= maxtries * USI->gstats->numprobes;
|
||||
thishostpercdone = (double) host->ports_finished / USI->gstats->numprobes;
|
||||
if (thishostpercdone >= .9999) thishostpercdone = .9999;
|
||||
avgdone += thishostpercdone;
|
||||
}
|
||||
@@ -4827,10 +4824,7 @@ void ultra_scan(vector<Target *> &Targets, struct scan_lists *ports,
|
||||
hostI != USI->incompleteHosts.end(); hostI++) {
|
||||
host = *hostI;
|
||||
maxtries = host->allowedTryno(NULL, NULL) + 1;
|
||||
// This is inexact (maxtries - 1) because of numprobes_sent includes
|
||||
// at least one try of ports_finished.
|
||||
thishostpercdone = host->ports_finished * (maxtries -1) + host->numprobes_sent;
|
||||
thishostpercdone /= maxtries * USI->gstats->numprobes;
|
||||
thishostpercdone = (double) host->ports_finished / USI->gstats->numprobes;
|
||||
if (thishostpercdone >= .9999) thishostpercdone = .9999;
|
||||
avgdone += thishostpercdone;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user