Nmap Development mailing list archives
Re: [Exp PATCH] Fix a bug in Traceroute XML output (port numbers)
From: "Eddie Bell" <ejlbell () gmail com>
Date: Tue, 20 Mar 2007 21:34:47 +0000
Gave it a test and it works great. thanks - eddie On 20/03/07, Kris Katterjohn <katterjohn () gmail com> wrote:
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
_______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://SecLists.Org
Current thread:
- [Exp PATCH] Fix a bug in Traceroute XML output (port numbers) Kris Katterjohn (Mar 20)
- Re: [Exp PATCH] Fix a bug in Traceroute XML output (port numbers) Fyodor (Mar 20)
- Re: [Exp PATCH] Fix a bug in Traceroute XML output (port numbers) Eddie Bell (Mar 20)