Index: Target.h =================================================================== --- Target.h (revision 6630) +++ Target.h (working copy) @@ -126,6 +126,7 @@ unsigned long msecs_used; /* How many msecs has this Target used? */ bool toclock_running; /* Is the clock running right now? */ struct timeval toclock_start; /* When did the clock start? */ + time_t host_start, host_end; /* The absolute start and end for this host */ }; class Target { @@ -212,6 +213,9 @@ current time handy. You might as well also pass NULL if the clock is not running, as the func won't need the time. */ bool timedOut(const struct timeval *now); + /* Return time_t for the start and end time of this host */ + time_t StartTime() { return htn.host_start; } + time_t EndTime() { return htn.host_end; } /* Takes a 6-byte MAC address */ int setMACAddress(const u8 *addy); Index: nmap.cc =================================================================== --- nmap.cc (revision 6630) +++ nmap.cc (working copy) @@ -1757,7 +1757,9 @@ for(targetno = 0; targetno < Targets.size(); targetno++) { currenths = Targets[targetno]; /* Now I can do the output and such for each host */ - log_write(LOG_XML, ""); + log_write(LOG_XML, "", + (unsigned long) currenths->StartTime(), + (unsigned long) currenths->EndTime()); write_host_status(currenths, o.resolve_all); if (currenths->timedOut(NULL)) { log_write(LOG_PLAIN,"Skipping host %s due to host timeout\n", Index: docs/nmap.dtd =================================================================== --- docs/nmap.dtd (revision 6630) +++ docs/nmap.dtd (working copy) @@ -135,6 +135,10 @@ smurf | ports | os | distance | uptime | tcpsequence | ipidsequence | tcptssequence | hostscript | trace)*, times ) > + Index: output.cc =================================================================== --- output.cc (revision 6630) +++ output.cc (working copy) @@ -496,6 +496,22 @@ return; } + if (o.verbose) { + time_t tm_sec; + struct tm *tm; + char tbufs[128], tbufe[128]; + tm_sec = currenths->StartTime(); + tm = localtime(&tm_sec); + if (strftime(tbufs, sizeof(tbufs), "%Y-%m-%d %T %Z", tm) <= 0) + fatal("Unable to properly format host start time"); + tm_sec = currenths->EndTime(); + tm = localtime(&tm_sec); + if (strftime(tbufe, sizeof(tbufe), "%Y-%m-%d %T %Z", tm) <= 0) + fatal("Unable to properly format host end time"); + log_write(LOG_PLAIN,"Scan of %s started at %s and ended at %s\n", + currenths->targetipstr(), + tbufs, tbufe); + } log_write(LOG_PLAIN,"Interesting %s on %s:\n", (o.ipprotscan)? "protocols" : "ports", currenths->NameIP(hostname, sizeof(hostname))); Index: Target.cc =================================================================== --- Target.cc (revision 6630) +++ Target.cc (working copy) @@ -139,6 +139,7 @@ MACaddress_set = SrcMACaddress_set = NextHopMACaddress_set = false; htn.msecs_used = 0; htn.toclock_running = false; + htn.host_start = htn.host_end = 0; interface_type = devt_other; devname[0] = '\0'; devfullname[0] = '\0'; @@ -376,6 +377,7 @@ htn.toclock_running = true; if (now) htn.toclock_start = *now; else gettimeofday(&htn.toclock_start, NULL); + if (!htn.host_start) htn.host_start = htn.toclock_start.tv_sec; } /* The complement to startTimeOutClock. */ void Target::stopTimeOutClock(const struct timeval *now) { @@ -385,6 +387,7 @@ if (now) tv = *now; else gettimeofday(&tv, NULL); htn.msecs_used += TIMEVAL_MSEC_SUBTRACT(tv, htn.toclock_start); + htn.host_end = tv.tv_sec; } /* Returns whether the host is timedout. If the timeoutclock is running, counts elapsed time for that. Pass NULL if you don't have the