Nmap Development mailing list archives

[PATCH] Clarify OS fingerprint section of rendered XML results


From: Tom Sellers <nmap () fadedcode net>
Date: Fri, 29 Dec 2006 18:29:31 -0600

This is my first time to submit a patch or use Subversion's
tools, so please let me know if I have made a mistake.

Patch against:  nmap.xsl - the XML transform document

Nmap will include operating system fingerprints in XML output
if fingerprinting is turned on and verbose output is requested.

Problem:  When a nmap scan is performed with OS detection
is turned on, but no match is found, the XML result shows
the ports used in the detection, but no header is printed
and no  other information is provided.

Reason for problem: In the "os" xml:template, a test is performed to determine if there is an non-blank "name" attribute. If one is found, then the header is printed. Regardless of this test, child element templates are processed.

As a result, if no operating system match is found the header
is missing, but the ports used as part of the process are displayed. No further information is provided as to /what/ the information means or /why/ it is displayed.

Code change:
1.  Remove if/then test that displays the header when a match
is found and just print the header. The result is that the header "remote operating system guess" is always displayed when operating system fingerprinting has been performed.

2. Add a xsl:if statement to display text to indicate when nmap was unable to identify the operating system. The information about what ports were used will be displayed after
this text.

I intend to submit a follow up patch that will display the
operating system fingerprint in the rendered output if the operating system is not identified.

Tom Sellers


Index: nmap/docs/nmap.xsl
===================================================================
--- nmap/docs/nmap.xsl  (revision 4301)
+++ nmap/docs/nmap.xsl  (working copy)
@@ -583,10 +583,13 @@
 <!-- os -->
 <!-- ............................................................ -->
 <xsl:template match="os">
-<xsl:if test="osmatch/@name != ''"><h3>remote operating system guess</h3></xsl:if>
-<ul>
-       <xsl:apply-templates/>
-</ul>
+       <h3>remote operating system guess</h3>
+               
+       <xsl:if test="count(osmatch) = 0"><p>Unable to identify operating system.</p></xsl:if>  
+
+       <ul>
+               <xsl:apply-templates/>
+       </ul>
 </xsl:template>
 <!-- ............................................................ -->
 

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

Current thread: