home / blog

Simple port scanner in BASH using netcat

for port in {1..65535}; do
  nc -w 1 localhost $port > /dev/null && echo "Port $port open" || echo "Port $port closed";
done;
This entry was posted in geek and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published.