mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49:29 +00:00
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:
parent
a2b0f3b0fe
commit
300e038aa6
3 changed files with 17 additions and 5 deletions
8
nmap.cc
8
nmap.cc
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
11
output.cc
11
output.cc
|
|
@ -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
|
||||
|
|
|
|||
3
output.h
3
output.h
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue