test with nmap
检测主机
nmap www.baidu.com
Nmap scan report for www.baidu.com (61.135.169.121)
Host is up (0.0069s latency).
Other addresses for www.baidu.com (not scanned): 61.135.169.125 2408:80f0:410c:1d:0:ff:b07a:39af 2408:80f0:410c:1c:0:ff:b00e:347f
Not shown: 998 filtered ports
PORT STATE SERVICE
80/tcp open http
443/tcp open https
Nmap done: 1 IP address (1 host up) scanned in 4.11 seconds
扫描全部端口检测本机哪些端口开放,外部机器亦可
nmap -p 1-65535 127.0.0.1
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000047s latency).
Not shown: 65533 closed ports
PORT STATE SERVICE
631/tcp open ipp
1001/tcp open webpush
Nmap done: 1 IP address (1 host up) scanned in 1.69 seconds
检测指定端口
nmap -p 8080,1001 127.0.0.1
Starting Nmap 7.60 ( https://nmap.org ) at 2020-08-07 17:51 CST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000057s latency).
PORT STATE SERVICE
1001/tcp open webpush
8080/tcp closed http-proxy
Nmap done: 1 IP address (1 host up) scanned in 0.02 seconds
检测多个ip
nmap 1.1.1.1 8.8.8.8
nmap -p 1.1.1.1,2,3,4
检测指定网段
nmap -p 8.8.8.0/28
8.8.8.1 到 8.8.8.14
nmap 8.8.8.*
8.8.8.1 到 8.8.8.256
nmap -p 8.8.8.* --exclude 8.8.8.1
检测常用端口
nmap --top-ports 20 192.168.1.106
检测文件中每行的ip
nmap -iL list.txt
list.txt
192.168.1.106
cloudflare.com
microsoft.com
securitytrails.com
nmap -A -T4 www.baidu.com
nmap -sV www.baidu.com
tcp扫描
nmap -sT www.baidu.com
udp扫描
sudo nmap -sU www.baidu.com