Created
January 31, 2018 15:09
-
-
Save jljouannic/39fec5fb9f328bd10740e8b06fbd215d to your computer and use it in GitHub Desktop.
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 | |
#### dns_verify.sh | |
# | |
NETS="192.168.1" | |
IPS=$(seq 1 254) ## for Linux | |
# | |
# IPS=$(jot 254 1) ## for OpenBSD or FreeBSD | |
# IPS=$(seq 1 254) ## for Linux | |
# | |
echo | |
echo -e "\tip -> hostname -> ip" | |
echo '--------------------------------------------------------' | |
for NET in $NETS; do | |
for n in $IPS; do | |
A=${NET}.${n} | |
HOST=$(dig -x $A +short) | |
if test -n "$HOST"; then | |
ADDR=$(dig $HOST +short) | |
if test "$A" = "$ADDR"; then | |
echo -e "ok\t$A -> $HOST -> $ADDR" | |
elif test -n "$ADDR"; then | |
echo -e "fail\t$A -> $HOST -> $ADDR" | |
else | |
echo -e "fail\t$A -> $HOST -> [unassigned]" | |
fi | |
fi | |
done | |
done | |
echo "" | |
echo "DONE." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment