Skip to content

Instantly share code, notes, and snippets.

@alexander-potemkin
Created December 20, 2022 09:15
Show Gist options
  • Save alexander-potemkin/6205f13c88965f3182d5e09457b5a75c to your computer and use it in GitHub Desktop.
Save alexander-potemkin/6205f13c88965f3182d5e09457b5a75c to your computer and use it in GitHub Desktop.
#!/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