Export results with nmap -O -oN os.txt 127.0.0.1
In this step, we will learn how to export the results of an Nmap OS detection scan to a file. This is useful for later analysis, reporting, or integration with other tools. We will use the -oN
option, which specifies that the output should be in "normal" format.
The os.txt
filename is arbitrary; you can choose any name you like, but it's good practice to use a descriptive name. The output file will be created in your current working directory, which is ~/project
.
To export the results of the OS detection scan to a file, open your Xfce terminal and type the following command:
nmap -O -oN os.txt 127.0.0.1
This command will perform an OS detection scan on the target machine with IP address 127.0.0.1
(localhost) and save the results in normal format to the file os.txt
in your ~/project
directory.
After the scan is complete, you can view the contents of the os.txt
file using the cat
command:
cat os.txt
The output will display the Nmap scan results, including the OS details, in a human-readable format. The output might look something like this (the exact output will vary depending on the target OS):
## Nmap 7.80 scan initiated Tue Oct 27 10:20:00 2023 as: nmap -O -oN os.txt 127.0.0.1
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000043s latency).
Not shown: 999 closed ports
PORT STATE SERVICE
22/tcp open ssh
OS details: Linux 3.2 - 4.9
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS detection performed. Please report any incorrect results at https://nmap.org/submit/ .
## Nmap done at Tue Oct 27 10:20:05 2023 -- 1 IP address (1 host up) scanned in 5.23 seconds
You can also use a text editor like nano
to view or modify the os.txt
file:
nano os.txt
This will open the os.txt
file in the nano
text editor, allowing you to examine the results in more detail.
Exporting Nmap results to a file is a valuable skill for documenting your findings and sharing them with others.