Saving the Results with Nmap
Saving Nmap Scan Results – Output Formats
When conducting scans, it’s essential to save the results for later analysis and comparison across scan types. Nmap supports three output formats:
| Format | Command Option | File Extension | Description |
|---|---|---|---|
| Normal | -oN |
.nmap |
Human-readable standard output. |
| Grepable | -oG |
.gnmap |
Easily parsed output for scripts (e.g., grep, awk). |
| XML | -oX |
.xml |
Machine-readable output, ideal for tools and reporting. |
| All Formats | -oA |
.nmap, .gnmap, .xml |
Saves all formats using the same filename prefix. |
Example: Save All Formats
sudo nmap <target> -p- -oA results
| Option | Explanation |
|---|---|
10.129.2.28 |
Target IP address to scan. |
-p- |
Scan all 65,535 TCP ports. |
-oA target |
Save results as target.nmap, target.gnmap, and target.xml. |
By default, files are saved in the current working directory unless a path is specified.
Reviewing Output Files
ls
results.gnmap results.xml results.nmap
To inspect the content:
cat results.gnmap
cat results.xml
cat results.nmap
Downloading The xsltproc Tool
You can download the xsltproc tool by following the command below:
sudo apt install xsltproc
Convert XML to HTML Report
You can transform the XML output into a human-friendly HTML report using xsltproc:
xsltproc results.xml -o results.html
Open results.html in your browser for a clear, structured report—ideal for documentation or non-technical stakeholders.