Nmap provides several options to save your scan results in different formats. This is useful for documentation, reporting, or further analysis with other tools. You can save output in plain text, XML, or even formats suitable for use in third-party applications.
-oN
(Normal Output)
The -oN
option saves the output in a human-readable plain text format. This is the default output for most Nmap scans.
nmap -oN scan_results.txt 192.168.1.10
-oX
(XML Output)
The -oX
option saves the output in XML format, which is useful for automated processing, integration with other tools, or generating reports.
nmap -oX scan_results.xml 192.168.1.10
-oG
(Grepable Output)
The -oG
option saves the output in a format that is easily parseable with tools like grep
. This format is helpful when you want to extract specific information from the scan results programmatically.
nmap -oG scan_results.gnmap 192.168.1.10
-oA
(All Output Formats)
The -oA
option saves the scan results in all three formats: normal, XML, and grepable. This is useful when you need all formats for different types of analysis or reporting.
nmap -oA scan_results 192.168.1.10
--append-output
By default, Nmap will overwrite the output files if they already exist. The --append-output
option allows you to append results to an existing output file instead of overwriting it.
nmap -oN scan_results.txt --append-output 192.168.1.20
-oH
(HTML Output)
The -oH
option generates output in HTML format, which is useful for generating reports that are easy to share or present.
nmap -oH scan_results.html 192.168.1.10
Output Format Comparison
Option | Format | Use Case |
---|---|---|
-oN | Plain Text | Human-readable, easy to review and analyze manually |
-oX | XML | For integration with other tools or automated processing |
-oG | Grepable | For extracting specific data using command-line tools like grep |
-oA | All Formats | Saves results in normal, XML, and grepable formats simultaneously |
--append-output | Append Results | Appends results to existing output files without overwriting |
-oH | HTML | For creating visually presentable reports |
Example: Saving Results in Multiple Formats
nmap -oA scan_results 192.168.1.10
This command saves the scan results in three formats:
- Normal text:
scan_results.nmap
- XML:
scan_results.xml
- Grepable:
scan_results.gnmap
Example: Appending Results to an Existing File
nmap -oN scan_results.txt --append-output 192.168.1.20
This command appends the results from scanning 192.168.1.20 to the existing scan_results.txt
file.