문제

i use below function to scan if in my network port 80 is open or not,

in case if port is closed, it wait for 1sec, how can i seed it up?

so the same function will can run 10 times in the same time or something like?

while read ip
do
    nc -zw1 $ip 80 && echo "$ip" >> opened || echo "$ip" >> closed;
done < list

or maybe an alternative what will do the same more fast,

Thank you.

도움이 되었습니까?

해결책

while read ip
do
    (nc -zw1 $ip 80 && echo "$ip" >> opened || echo "$ip" >> closed) & # The & will run each test in the background, allowing all tests to be done more or less concurrently.
done < list

다른 팁

Use a network scanner like nmap:

sudo nmap -iL list -Pn -p 80

nmap will scan multiple hosts in parallel and can do SYN scans rather than regular connection attempts, making it two orders of magnitude faster.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top