我想以编程方式处理 nmap 输出的结果,但无法弄清楚如何获取输出并仅提取下面两个输出中显示的协议或端口表的详细信息。
我非常有信心我可以使用 awk 来处理表数据 - 但我不能从输出中提取它......可以使用哪些工具组合来做到这一点?
$ sudo nmap --open -sO 10.100.0.14
Starting Nmap 7.70 ( https://nmap.org ) at 2021-12-27 19:15 AEDT
Warning: 10.100.0.14 giving up on port because retransmission cap hit (10).
Nmap scan report for teichos.mydomain.net (10.100.0.14)
Host is up (0.00030s latency).
Not shown: 250 filtered protocols, 1 closed protocol
PROTOCOL STATE SERVICE
1 open icmp
33 open|filtered dccp
80 open|filtered iso-ip
117 open|filtered iatp
136 open|filtered udplite
MAC Address: 6A:3A:ED:33:9E:00 (Unknown)
输出 2:
$ sudo nmap -sS 10.100.0.14 -p-
Starting Nmap 7.70 ( https://nmap.org ) at 2021-12-27 19:30 AEDT
Nmap scan report for teichos.mydomain.net (10.100.0.14)
Host is up (0.00024s latency).
Not shown: 65533 filtered ports
PORT STATE SERVICE
22/tcp open ssh
9090/tcp open zeus-admin
MAC Address: 6A:3A:ED:33:9E:00 (Unknown)
我正在寻找的输出如下(标题不是必需的):
PROTOCOL STATE SERVICE
1 open icmp
33 open|filtered dccp
80 open|filtered iso-ip
117 open|filtered iatp
136 open|filtered udplite
和
PORT STATE SERVICE
22/tcp open ssh
9090/tcp open zeus-admin