Created
December 20, 2022 09:15
-
-
Save alexander-potemkin/6205f13c88965f3182d5e09457b5a75c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# call with IP required to be scanned | |
broken=0; | |
function break_script | |
{ | |
broken=1; | |
} | |
trap break_script SIGINT; | |
for (( i = 1; i < 65535; ++i )) | |
do | |
nc -z -w 1 "$1" "$i" < /dev/null; | |
[ $? -eq 0 ] && echo "Open port $i"; | |
[ $broken -eq 1 ] && break; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment