Convert nmap Scans into Beautiful HTML Pages


(Hardeep Singh) #1

A few weeks ago I discovered this neat little trick that helps you see your saved nmap results in HTML formats, locally. This can be very helpful when you are performing large scans, like on an enterprise or a university for example.

TL;DR:

  1. Use nmap -oX <filename> for XML output file.

  2. Run xsltproc utility in this format: xsltproc <input.xml> -o <outputFile.html>

Example:

nmap -A -oX nmapoutput -T5 192.168.0.1
xsltproc nmapoutput.xml -o scanme.html

Output HTML file: Click here to see the HTML file in action

Keep reading for creating beautiful CSS based HTML pages like this: nmap-bootstrap.xsl based HTML file
 


Explanation, Examples and Details

xsltproc is a command line tool that is found in most of the *nix systems. It is an XSLT processor actually which applies XSLT stylesheets to XML files and saves the output.

The above command uses the default stylesheet for the desired HTML file. If you want to have bootstrap3 based theme for your nmap-HTML results, you’d need to apply a custom xslt stylesheetto your nmap scan.

There are 2 ways of doing it:

  1. Add the nmap-bootstrap.xsl as stylesheet to your Nmap scan. Example command that I ran on my system:
nmap -sS -T4 -A -sC -oA scanme --stylesheet https://raw.githubusercontent.com/honze-net/nmap-bootstrap-xsl/master/nmap-bootstrap.xsl 192.168.0.1

Open the scanme.html with your Web Browser. It should look like the scanme.html report

  1. Download the xsl stylesheet and use xsltproc for post processing
wget https://raw.githubusercontent.com/honze-net/nmap-bootstrap-xsl/master/nmap-bootstrap.xsl

Then you can always simply apply this stylesheet to your nmap scans using the following command:

xsltproc -o scanme.html nmap-bootstrap.xsl scanme.xml


Here’s my output for this command:

and links to both the HTML files:

  1. Default stylesheet based HTML file

  2. nmap-bootstrap.xsl based HTML file

Hope it helps somebody here :slight_smile:

Credits

All the credit goes to a Twitter user named Andreas Hontzia (@honze_net) created this XSL file and used the xsltproc utility with the nmap scans to create those beautiful HTMLs.

Link to his GitHub Repository from where we downloaded the xsl file: nmap-bootstrap.xsl : https://github.com/honze-net/nmap-bootstrap-xsl/