Compare with top ports scan in Xfce terminal
In this step, we will perform a scan of the top 1000 most common ports and compare the results with our previous custom port scan. This will help us understand if the services running on the custom ports are also running on commonly used ports.
First, run a scan of the top 1000 ports on the localhost (127.0.0.1) using the following command:
nmap -F 127.0.0.1
The -F
option tells Nmap to scan only the ports listed in the nmap-services
file, which contains a list of the most common ports. This is equivalent to scanning the top 100 ports. To scan the top 1000 ports, you can use the --top-ports 1000
option. However, for this lab, we will stick to the -F
option for a faster scan.
The output will look something like this:
Starting Nmap 7.80 ( https://nmap.org ) at Fri Oct 27 10:20:00 2023
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000079s latency).
Not shown: 97 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
Nmap done: 1 IP address (1 host up) scanned in 0.25 seconds
Now, let's compare these results with the results from our custom port scan in custom_ports.txt
. We know from the previous step that port 1000 was open. Let's check if the top ports scan also found port 1000 to be open.
You can use the grep
command to search for port 1000 in the output of the top ports scan. Since the output is directly printed to the terminal, we can pipe the output to grep
:
nmap -F 127.0.0.1 | grep 1000
If the command returns any output, it means that port 1000 was found in the top ports scan. If it returns no output, it means that port 1000 is not among the top ports.
In this case, you will likely not see any output, because port 1000 is not a common port. This demonstrates the difference between scanning common ports and scanning custom ports. Scanning common ports is useful for quickly identifying well-known services, while scanning custom ports is useful for finding less common or intentionally hidden services.