Skip to content

Instantly share code, notes, and snippets.

@adammcmaster
Created July 6, 2020 13:32
Show Gist options
  • Save adammcmaster/2433d581d3cf6b70f45046fbc5be92d4 to your computer and use it in GitHub Desktop.
Save adammcmaster/2433d581d3cf6b70f45046fbc5be92d4 to your computer and use it in GitHub Desktop.
#!/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