Output is important part of a scan because all gathered information will be shown. According to output next steps will be decided. In this chapter we will look nmap output features.
Normal Output To A File
Normal output is the default output which is normally written to the console. This output can be saved into file with -oN option.
$ nmap -oN myscan localhost
XML Output To A File
XML output is an other option for output. XML is very useful while using Zenmap. Zenmap is tool for nmap that provides GUI.
$ nmap -oX myscan localhost
Grep-able Output To A File
Grep is a tool used to filter text file with normal or regular expressions. Grep-able output will produce output which is very easy to use with Grep tool.
$ nmap -oG myscan localhost
Output To A File In All Formats
up to now we have used 3 output format one by one . In some situations we may need to get all of them for single scan. Nmap provides -oA to output in all 3 format just adding some extension to the end of files.
$ nmap -oA myscan localhost
As we see after scan 3 files are created to save output.
- gnmap is grepable output file
- nmap is normal output file
- xml is xml output file
Show Only Open Ports
While port scan there is different type of port status. Open, Closed, Filtered etc. . Nmap will provides all of this status information with port results. We can omit other than Open port status to make things clear.
$ nmap --open localhost
There will be no result with filtered or closed.
Print Scan Status Periodically
While scanning especially big networks scanning time will be very long. We may want to get information about scan status. Here how we can do
$ nmap --open --stats-every 1 192.168.122.0/24