Skip to content

Instantly share code, notes, and snippets.

@burningTyger
Forked from enginefeeder101/testports.sh
Created March 7, 2016 10:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burningTyger/ce9c13fa464ac3893a28 to your computer and use it in GitHub Desktop.
Save burningTyger/ce9c13fa464ac3893a28 to your computer and use it in GitHub Desktop.
Test outgoing open ports
#!/bin/bash
task(){
LC_ALL=C nc -vzw5 portquiz.net $1 2>&1 | grep -v 'Connection timed out'
}
N=50 # Specify number of ports to check at once
(
for port in {1..65535}; do # Specify port range to check here
((i=i%N)); ((i++==0)) && wait
task "$port" &
done
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment