Nmap Security Scanner
*Intro
*Ref Guide
*Install Guide
*Download
*Changelog
*Book
*Docs
Security Lists
*Nmap Hackers
*Nmap Dev
*Bugtraq
*Full Disclosure
*Pen Test
*Basics
*More
Security Tools
*Pass crackers
*Sniffers
*Vuln Scanners
*Web scanners
*Wireless
*Exploitation
*Packet crafters
*More
Site News
Site Search:
Exploit World
Advertising
About/Contact
Credits
Sponsors:
edgeos

Nmap Development: [Exp PATCH] Fix a bug in Traceroute XML output (port numbers)

[Exp PATCH] Fix a bug in Traceroute XML output (port numbers)

From: Kris Katterjohn <katterjohn_at_gmail.com>
Date: Tue, 20 Mar 2007 16:18:51 -0500

The attached patch (/nmap-exp/kris SVN r4596) fixes another little bug
in traceroute output. This just changes nmap.xsl and traceroute.cc so
that port numbers aren't outputted when doing the IPProto Scan, or Ping
Scan (using a protocol that's not TCP or UDP)

SVN log:

------------------------------------------------------------------------
r4596 | kris | 2007-03-20 16:13:16 -0500 (Tue, 20 Mar 2007) | 1 line

Fixing another little bug in traceroute output. This time, change
nmap.xsl and traceroute.cc to not output port numbers in XML output when
traceroute'ing, and using IPProto Scan or Ping Scan (with a protocol
other than tcp or udp). Random numbers were usually outputted before.
------------------------------------------------------------------------

It works good for me, but I had to look up some tutorials (and browse
around the XSL) to figure out what exactly to do, so I might've
overlooked something. I think I covered everything in the if() in
traceroute.cc

Lemme know what you think!

Thanks,
Kris Katterjohn

Index: docs/nmap.xsl
===================================================================
--- docs/nmap.xsl (revision 4595)
+++ docs/nmap.xsl (revision 4596)
@@ -696,7 +696,11 @@
 <xsl:template match="trace">
   <h3>traceroute</h3>
   <ul>
- <li>port: <xsl:value-of select="@port" /></li>
+ <xsl:choose>
+ <xsl:when test="@port">
+ <li>port: <xsl:value-of select="@port" /></li>
+ </xsl:when>
+ </xsl:choose>
       <li>proto: <xsl:value-of select="@proto" /></li>
        <xsl:for-each select="error">
         <li>error: <xsl:value-of select="@errorstr"/></li>
Index: traceroute.cc
===================================================================
--- traceroute.cc (revision 4595)
+++ traceroute.cc (revision 4596)
@@ -1061,7 +1061,9 @@
     short ttl_count;
 
     /* XML traceroute header */
- log_write(LOG_XML, "<trace port=\"%d\" ", tg->dport);
+ log_write(LOG_XML, "<trace ");
+ if ((o.pingscan && (o.pingtype & PINGTYPE_TCP || o.pingtype & PINGTYPE_UDP)) || (!o.ipprotscan && !o.pingscan))
+ log_write(LOG_XML, "port=\"%d\" ", tg->dport);
     if((proto = nmap_getprotbynum(htons(tg->proto))))
         log_write(LOG_XML, "proto=\"%s\"", proto->p_name);
     else

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Received on Mar 20 2007
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]