2015-01-20 138 views
-1

我正在做一個nmap bash腳本,我只是想知道是否有任何可能使用我的端口命令數組列表。例如:Nmap端口掃描陣列

 
port=[23,45,75,65] 
for i in 21 do 

nmap -p x,y 192.168.1.$i 

done 

例如,在x,y處我想用

回答

0

我不知道如果這是你想要的,但你可以試試這個:

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" 
+0

在最後的地方,我可以做到這一點? $ i- $ y – rsl 2015-01-21 15:29:59

+0

這非常有用!非常感謝你! – rsl 2015-01-21 20:33:19

0

掃描一個端口數組已經內置到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.