Nmap is a very useful and popular tool used to scan ports. Nmap by default scans the most popular 1000 ports. We may need to change the port range and protocol type to all while scanning with Nmap.
Nmap是用于扫描端口的非常有用且流行的工具。 默认情况下,Nmap扫描最流行的1000个端口。 使用Nmap扫描时,我们可能需要将端口范围和协议类型全部更改。
扫描具有范围的所有TCP端口 (Scan All TCP Ports with Range)
We can specify the port range with the -p
option. As we know TCP port numbers are between and
65535
. We will use -p0-65535
as an option in order to scan all TCP ports. We do not specify the TCP protocol because the default protocol for Nmap port scan is TCP.
我们可以使用-p
选项指定端口范围。 我们知道TCP端口号介于和
65535
。 我们将使用-p0-65535
作为选项,以扫描所有TCP端口。 我们未指定TCP协议,因为Nmap端口扫描的默认协议为TCP。
$ nmap -p0-65535 192.168.122.1
更快扫描所有端口 (Faster Scan For All Ports)
If we are scanning all ports this will take a lot of time. If the situation is not critical we can use a faster scan with -T5
parameter. This is the fastest scan level for Nmap. This option can be used for UDP scans too.
如果我们要扫描所有端口,则将花费大量时间。 如果情况不是很紧急,我们可以使用带有-T5
参数的更快扫描。 这是Nmap最快的扫描级别。 此选项也可用于UDP扫描。
$ nmap -p0-65535 192.168.122.1 -T5