check port on some random server


printf "%d.%d.%d.%d\n" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))"
for i in {1..3}; do !!; done > sm_rnd_ip

while read HOST ; do nc -zvw3 $HOST 80 &> /dev/null; [[ $? -eq 0 ]] &&
printf "Port 80 is UP on %s\n" $HOST || printf 'Port 80 is DOWN on %s\n' $HOST ; done < sm_rnd_ip

Port 80 is DOWN on 118.49.236.50
Port 80 is DOWN on 57.101.35.142
Port 80 is DOWN on 8.144.249.142

Views All Time
Views All Time
34
Views Today
Views Today
3

Leave a Reply

Your email address will not be published. Required fields are marked *