netcat
在 Dubian 上,我可以使用(又名nc
, ncat
)执行以下操作:
michael@pi1:~ $ nc -zv 10.120.11.1 20 21 22 23 24
nc: connect to 10.120.11.1 port 20 (tcp) failed: Connection refused
Connection to 10.120.11.1 21 port [tcp/ftp] succeeded!
Connection to 10.120.11.1 22 port [tcp/ssh] succeeded!
Connection to 10.120.11.1 23 port [tcp/telnet] succeeded!
nc: connect to 10.120.11.1 port 24 (tcp) failed: Connection refused
michael@pi1:~ $
Dubian 上的 man nc 显示如下:
-z Specifies that nc should just scan for listening daemons, without sending any data to them. It is an error to use this option in conjunction with the -l option.
在Centos7上,我原来没有nc,所以添加了using sudo yum install nmap-ncat.x86_64
.
但是,-z
不支持该标志。
[michael@box1 ~]$ nc -zv 10.255.255.1 22
nc: invalid option -- 'z'
Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING.
[michael@box1 ~]$
答案1
是的,我也发现 nc 不支持 -z。我想知道他们为什么放弃它。您可以安装旧版本的 ncat,或者仅使用 nmap。
地图
nmap -sT -p <port>