Is there a method for batch inspection? Some. We use NC to quickly detect the openness of the port.
The use of the NC detection port
Nc-z-W 10-u%ip%%PORT%
-Z indicates detection or scanning of ports
-W indicates time-out
-U means that the UDP protocol is used, and this parameter is NULL for the TCP protocol
For example:
[@s136. ipcpu.com ~]# nc-z-W 10-u 8.8.8.8 53Connection to 8.8.8.8, Port [Udp/domain] succeeded! [@s136. ipcpu.com ~]# nc-z-W 8.8.8.8 53Connection to 8.8.8.8, Port [Tcp/domain] succeeded! [@s136. ipcpu.com ~]# Echo $?0[@s136. ipcpu.com ~]# nc-z-w 8.8.8.7 53[@s136. ipcpu.com ~]# Echo $?1
Port successfully unicom return value is 0, prompt succeeded; otherwise return 1 without prompting any data
Suppose we had such a heap of IPs and ports.
#cat ports119.181.69.96 8080119.181.118.38 8000119.181.20.18 8080119.181.69.37 8080
We can write such a script to detect whether the port is open in bulk:
Cat Tetsport | While read Linedo #nc-Z- w $linenc-Z-w $line >/dev/null 2>&1if [$?-eq 0]thenecho $line: Okel Seecho $line: Failfi Done
Well, here's how we run the results:
119.181.69.96 8080:ok119.181.118.38 8000:ok119.181.20.18 8080:fail119.181.69.37 8080:ok