Nmap端口扫描阵列

Nmap port scanning array

我正在做一个 nmap bash 脚本,我只是想知道是否有可能为我的端口命令使用数组列表。例如:

端口=[23,45,75,65]
因为我在 21 岁

nmap -p x,y 192.168.1.$i

完毕

例如在 x,y 的地方我想使用数字 23,45

nmap 已经内置了扫描端口数组的功能。有关语法的更多详细信息,请参阅 http://nmap.org/book/man-port-specification.html,但这里的摘录可能会为您提供所需的内容:

For example, the argument -p U:53,111,137,T:21-25,80,139,8080 would scan UDP ports 53, 111,and 137, as well as the listed TCP ports.

我不确定这是否是你想要的,但你可以试试这个:

ports="23,45,75,65"

for i in 21 do
    nmap -p "$ports" 192.168.1.$i
done

您还可以这样做:

ports="23,45,75,65"
targets="1-25"
nmap -p "$ports" "192.168.1.$targets"