Nmap is popular network scanner for scanning of ports and vulnerabilities and supports various
output formats like XML. As a result, scan data can be parsed by other tools such as Metasploit
or ZenMap GUI.
For human readability, nmap scan output can be formatted to a nice HTML report using tool like
xsltproc
.
Typical Nmap scan command looks like
# nmap -sTV -p- -A -T4 -vvvv -oA <nmap-scan-xml-report-file> <machine-ip-to-scan>
- -sTV TCP connect scan with version detection
- -p- Port selection: All ports from 1-65535
- -A Enables several modes. This enables version & OS detection
Once the scan is over, it will create scan report in various formats.
xsltproc
tool can be used to convert nmap XML report file into a nicely formatted HTML file. To perform this conversion, run the following command:
# xsltproc <nmap-scan-xml-report-file> -o <nmap-scan-html-report-file>
Once html conversion is done, you can use any browser to view the report.
You can generate ip specific nmap report with date using the script below:
#!/bin/bash
# script: host-date.sh
cur_date=$(date +%F)
host_name=$(hostname -I|xargs)
echo $host_name-$cur_date
Use the name generated in the last line of bash script for html report.
#!/bin/bash
# nmap -sV -A -oX <nmap-scan-xml-report-file> --script=vulscan/vulscan.nse <machine-ip-to-scan>
# OR
# nmap -sV -A -oX <nmap-scan-xml-report-file> --script=vulners.nse <machine-ip-to-scan>
# xsltproc <nmap-scan-xml-report-file> -o <nmap-scan-html-report-file>
-SV: Probe open ports to determine service/version info A: Enable OS detection, version detection, script scanning, and traceroute
More details:
# nmap -iL <site-list.txt> -sV -p 443 -oX <nmap-xml-report-file> --script=ssl-cert
# OR
# nmap -sV -p 443 -oX <nmap-xml-report-file> --script=ssl-cert <machine-ip-to-scan>