Nmap Development mailing list archives

Patch for <uptime> element


From: William McVey <wam () cisco com>
Date: Thu, 11 Oct 2001 18:48:11 -0400

I noticed that a host's uptime wasn't being put into nmap's xml output
so I've attached is a patch to add an <uptime> element into the <host>
element, when this information is available.  The attached is a patch
against nmap-2.54BETA29 and can be applied from within the nmap-2.54BETA29
build directory via: patch -p1 < patchfile

This patch is also archived at: http://www.networkexploits.com/projects/nmap/

  -- William

diff -Naur nmap-2.54BETA29-orig/output.c nmap-2.54BETA29-uptimexml/output.c
--- nmap-2.54BETA29-orig/output.c       Thu Oct 11 22:25:28 2001
+++ nmap-2.54BETA29-uptimexml/output.c  Thu Oct 11 22:43:10 2001
@@ -605,7 +605,7 @@
          log_write(LOG_NORMAL|LOG_SKID|LOG_STDOUT,"TCP/IP fingerprint:\n%s\n\n",  mergeFPs(currenths->FPs, 
currenths->numFPs, currenths->osscan_openport, currenths->osscan_closedport));
        }
       } else { assert(0); }
-     log_write(LOG_XML, "</os>");
+     log_write(LOG_XML, "</os>\n");
 
      if (currenths->seq.lastboot) {
        char tmbuf[128];
@@ -614,6 +614,7 @@
        strncpy(tmbuf, ctime(&(currenths->seq.lastboot)), sizeof(tmbuf));
        chomp(tmbuf);
        log_write(LOG_NORMAL|LOG_SKID|LOG_STDOUT,"Uptime %.3f days (since %s)\n", (double) (tv.tv_sec - 
currenths->seq.lastboot) / 86400, tmbuf);
+       log_write(LOG_XML, "<uptime seconds=\"%li\" lastboot=\"%s\" />\n", tv.tv_sec - currenths->seq.lastboot, tmbuf);
      }
 
      if (currenths->seq.responses > 3) {

---------------------------------------------------------------------
For help using this (nmap-dev) mailing list, send a blank email to 
nmap-dev-help () insecure org . List run by ezmlm-idx (www.ezmlm.org).

Current thread: