Created
July 6, 2020 13:32
-
-
Save adammcmaster/2433d581d3cf6b70f45046fbc5be92d4 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 | |
# Based on https://stackoverflow.com/a/29079962/10955319 | |
SOURCE_NS=$1 | |
DEST_NS=$2 | |
ZONE=$3 | |
if [ "$SOURCE_NS" == "" ] || [ "$DEST_NS" == "" ] || [ "$ZONE" == "" ] | |
then | |
echo "USAGE: $0 source_nameserver destination_nameserver zone_name_or_file" | |
exit 1 | |
fi | |
if [ -f $ZONE ] | |
then | |
ZONES=$(cat $ZONE) | |
else | |
ZONES=($ZONE) | |
fi | |
diff <(sort -u <(for host in $ZONES; do dig +nottlid +noall +answer @$SOURCE_NS $host ANY; done) ) \ | |
<(sort -u <(for host in $ZONES; do dig +nottlid +noall +answer @$DEST_NS $host ANY; done) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment