nmap/netcat 区分没有服务监听的开放端口和有服务监听的开放端口

nmap/netcat differentiate between open port with no service listening and open ports with a service listening

我对网络扫描和测试工具(nmap 和 netcat)还很陌生。我想知道如何区分:

nmap and/or nc 命令的结果如何区分这两种情况?

谢谢

如果服务未在侦听,您将收到连接被拒绝的消息。

例子

# no service listening
$ nc -vz 127.0.0.1 22
Ncat: Version 7.80 ( https://nmap.org/ncat )
Ncat: Connection refused.

# service listening
$ nc -vz 127.0.0.53 53
Ncat: Version 7.80 ( https://nmap.org/ncat )
Ncat: Connected to 127.0.0.53:53.
Ncat: 0 bytes sent, 0 bytes received in 0.03 seconds.