本文介绍了带开放端口nmap的grep IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使此脚本通过nmap的开放端口来grep IP地址,但是我做不到正确的方法.
I'm trying to make this script to grep IP adresses with open port from nmap but I can't do it the right way.
我有这样的东西:
nmap 192.168.0.0/24 -sU -p 44555 | grep -oP "([0-9]{1,3}\.){3}[0-9]{1,3}" >output.txt
但是,这需要所有IP的开放和关闭.
But this is taking all IP's open and closed.
示例输出nmap:
Nmap scan report for 79-119-0-248.rdsnet.ro (79.119.0.248)
Host is up (0.033s latency).
PORT STATE SERVICE
27023/udp open|filtered unknown
Nmap scan report for 79-119-0-249.rdsnet.ro (79.119.0.249)
Host is up (0.032s latency).
PORT STATE SERVICE
27023/udp closed unknown
我想要的只是打开/过滤的谢谢
Only the ones are open/filtered I wantThanks
推荐答案
它与 egrep 一起使用:
nmap 192.168.0.0/24 -sU -p 44555 | grep -B3 open | egrep -o "([0-9]{1,3}\.){3}[0-9]{1,3}" > output.txt
这篇关于带开放端口nmap的grep IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!