Last active
May 11, 2017 11:57
-
-
Save esolitos/679295a25d6b21ee262cd7fee20b2ace to your computer and use it in GitHub Desktop.
This will check the A record both for the provided NameServer and for the domain's own NameServer.
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/sh | |
# | |
# This will check the A record both for the provided NameServer | |
# and for the domain's specified NS | |
# | |
if [ "$1" = "--help" -o "$1" = "-h" ]; then | |
echo "\nUsage:" | |
echo "$0 \$NS_IP domain1.tld domain2.tld ..." | |
echo "Example: $0 8.8.8.8 google.com example.com\n" | |
return 0; | |
fi; | |
myNS="$1" | |
domains="${@:2}" | |
echo "Checking domains: $domains" | |
echo "Using as my NS: $myNS" | |
for dom in "$domains"; do | |
domNS="$(dig +short "$dom" NS | head -n1)" | |
if [ ! -z "$domNS" ]; then | |
echo "#\n#\tAsking for $dom\n#" | |
echo "\n NS: $names" | |
dig "@$domNS" +noall +answer "$dom" A | |
else | |
echo "\n#\tERROR: Missing domain name server or domain not existent" | |
fi | |
echo "\n Asking my NameServer" | |
dig +noall +answer "$dom" A | |
dig +noall +answer "www.$dom" A | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment