Using Nmap XML and HTML parsers to generate output for easy analysis

When analyzing or sharing Nmap results with your customers, it’s helpful to have the output exported in a human readable way. This tip explains how to use Nmap and the HTML parses to generate a fancy report.

You can have Nmap’s output saved as XML by adding the -oX option to your Nmap command, as in:

sudo nmap -Pn -O -sV -oX network.xml
xsltproc network.xml -o network.html

To organize and make the XML output nicer, you can use the stylesheet option (–stylesheet). The XML file will point to a stylesheet for formatting and transformation using the eXtensible Stylesheet Language (XSL). Nmap includes a default XSL stylesheet called nmap.xsl.

Once you generated the XML file (in this case network.xml) you’ll invoke xsltproc to convert (-o option) from XML to HTML.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Just a sec