Convert your Nmap HTML reports to PDF files.
There’s a time when we are going to present our scanning reports in a proper way, whether we are going to show them to the upper managements or non-technical people. Nmap provides an option for generating our reports into XML files, but it is not enough considering the XML files somehow broken if opened from a browser.
Fortunately, there is a way. We will use a converter that would generate our reports into viewable files, with only using CLI.
Step #1: Generate our XML report
The usual first step is by generating our scan results into an XML file
nmap [OPTIONS] -oX file_name.xml [TARGET]
Step #2: Render our XML file into an HTML file
The second step is to use xsltproc . It’s a tool for rendering XML files into HTML files. We have to install them first if it isn’t yet installed. Since I use Debian package manager, I’m going to install the tool through it. You may want to do the same using your favorite package manager.
sudo apt install xsltproc
Next, if the tool is already installed, we will convert the XML file.
xsltproc file_name.xml -o html_file_name.html
Step #3: Convert our HTML file into a PDF file
The last step is also pretty simple, but we need another tool. I recommend wkhtmltopdf  for its simplicity. We are going to convert our rendered HTML file into a PDF file. As usual, we have to install the tool first. Again, you may want to do the same using your favorite package manager.
sudo apt install wkhtmltopdf
wkhtmltopdf -n html_file_name.html pdf_file_name.pdf
There you have it. We have a generated report in a PDF format ready to be presented for our managers and non-technical people.