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 192.168.0.0/24
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. Required fields are marked *