Print host timing information ("Final times for host" and the times

element in XML) even when doing only a ping scan. Don't print the
information if it was never set; i.e., we never measured an RTT to the
target.
This commit is contained in:
david 2009-11-16 08:36:58 +00:00
parent a2b0f3b0fe
commit 300e038aa6
3 changed files with 17 additions and 5 deletions

View file

@ -1732,6 +1732,7 @@ int nmap_main(int argc, char *argv[]) {
printmacinfo(currenths);
// if (currenths->flags & HOST_UP)
// log_write(LOG_PLAIN,"\n");
printtimes(currenths);
log_write(LOG_XML, "</host>\n");
log_flush_all();
delete currenths;
@ -1915,11 +1916,8 @@ int nmap_main(int argc, char *argv[]) {
if (o.traceroute)
printtraceroute(currenths);
if (o.debugging)
log_write(LOG_STDOUT, "Final times for host: srtt: %d rttvar: %d to: %d\n",
currenths->to.srtt, currenths->to.rttvar, currenths->to.timeout);
log_write(LOG_XML, "<times srtt=\"%d\" rttvar=\"%d\" to=\"%d\" />\n",
currenths->to.srtt, currenths->to.rttvar, currenths->to.timeout);
printtimes(currenths);
log_write(LOG_PLAIN|LOG_MACHINE,"\n");
log_write(LOG_XML, "</host>\n");
}

View file

@ -2201,6 +2201,17 @@ void printtraceroute(Target * currenths) {
printtraceroute_xml(currenths);
}
void printtimes(Target *currenths) {
if (currenths->to.srtt != -1 || currenths->to.rttvar != -1) {
if (o.debugging) {
log_write(LOG_STDOUT, "Final times for host: srtt: %d rttvar: %d to: %d\n",
currenths->to.srtt, currenths->to.rttvar, currenths->to.timeout);
}
log_write(LOG_XML, "<times srtt=\"%d\" rttvar=\"%d\" to=\"%d\" />\n",
currenths->to.srtt, currenths->to.rttvar, currenths->to.timeout);
}
}
/* Prints a status message while the program is running */
void printStatusMessage() {
// Pre-computations

View file

@ -201,6 +201,9 @@ void printhostscriptresults(Target *currenths);
/* Print a table with traceroute hops. */
void printtraceroute(Target *currenths);
/* Print "times for host" output with latency. */
void printtimes(Target *currenths);
/* Print a detailed list of Nmap interfaces and routes to
normal/skiddy/stdout output */
int print_iflist(void);