-
-
Save cyberatz/e8aa1a4adc07b451d7b7bbc95c617a3d to your computer and use it in GitHub Desktop.
port-check.sh - small script to check if TCP ports are opened through firewalls etc.
This file contains hidden or 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 | |
function checkport { | |
if nc -zv -w30 $1 $2 <<< '' &> /dev/null | |
then | |
echo "[+] Port $1/$2 is open" | |
else | |
echo "[-] Port $1/$2 is closed" | |
fi | |
} | |
# Example checks | |
checkport 'ad.server.one' 389 | |
checkport 'ad.server.one' 636 | |
checkport 'webserver.server.two' 443 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment