【ブログ】
◆Bashでポートスキャン (Qiita, 2020/04/12)
https://qiita.com/stcmjp/items/171c12c318bd4d6a236a
#!/bin/bash host=$1 for port in {1..65535}; do (bash -c "echo > /dev/tcp/$host/$port") && echo "$port port is open" & sleep 0.1 ; kill -9 $! > /dev/null 2>&1 done echo "Done"