fixed a completion time estimate bug

This commit is contained in:
fyodor 2006-07-04 07:36:29 +00:00
parent bba26da49f
commit 30190d664a
3 changed files with 29 additions and 4 deletions

View file

@ -1,4 +1,20 @@
# Nmap Changelog ($Id$); -*-text-*-
o Added IP options support. This allows you to specify loose/strict
source routing, route/timestamp recording, or any other IP option.
Keep in mind that these options are so rarely used that many routers
fail to support them or even (especially with source routing) drop the
packets. The related --ip-fake-dst option is needed when using source
routed packets (you set it to the first hop). See the man page for
further details on using these advanced options. Thanks to Marek Majkowski
(majek(a)forest.one.pl) for this patch.
o Fixed a bug related to bogus completion time estimates when you
request an estimate (through runtime interaction) right when Nmap is
starting.a subsystem (such as a port scan or version detection).
Thanks to Diman Todorov for reporting the problem and Doug Hoyte for
writing a fix.
Nmap 4.20ALPHA4
o Updated the Windows binary distributions (self-installer and .zip)

View file

@ -1118,7 +1118,7 @@ static void nmap_mass_rdns_core(Target **targets, int num_targets) {
read_timeout_index = MIN(sizeof(read_timeouts)/sizeof(read_timeouts[0]), servs.size()) - 1;
SPM = new ScanProgressMeter("System DNS resolution");
SPM = new ScanProgressMeter("Parallel DNS resolution");
while (total_reqs > 0) {
timeout = deal_with_timedout_reads();

View file

@ -378,9 +378,18 @@ bool ScanProgressMeter::printStats(double perc_done,
assert(ltime);
sec_left = time_left_ms / 1000;
log_write(LOG_STDOUT, "%s Timing: About %.2f%% done; ETC: %02d:%02d (%li:%02li:%02li remaining)\n",
scantypestr, perc_done * 100, ltime->tm_hour, ltime->tm_min, sec_left / 3600,
(sec_left % 3600) / 60, sec_left % 60);
// If we're less than 1% done we probably don't have enough
// data for decent timing estimates. Also with perc_done == 0
// these elements will be nonsensical.
if (perc_done < 0.01)
log_write(LOG_STDOUT, "%s Timing: About %.2f%% done\n",
scantypestr, perc_done * 100);
else
log_write(LOG_STDOUT, "%s Timing: About %.2f%% done; ETC: %02d:%02d (%li:%02li:%02li remaining)\n",
scantypestr, perc_done * 100, ltime->tm_hour, ltime->tm_min, sec_left / 3600,
(sec_left % 3600) / 60, sec_left % 60);
log_flush(LOG_STDOUT);
return true;
}