Last active
June 21, 2021 21:33
-
-
Save mttjohnson/313f06a8ac8d295ac6b5e1457dc8456a to your computer and use it in GitHub Desktop.
dns name sever query comparison
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
nameserver_source="a.iana-servers.net" | |
nameserver_comparison="b.iana-servers.net" | |
dns_records=" | |
example.com a | |
ftp.example.com a | |
mail.example.com a | |
ns1.example.com a | |
www.example.com cname | |
example.com mx | |
example.com txt | |
example.com ns | |
example.com soa | |
" | |
source_output="" | |
comparison_output="" | |
NEWLINE=$'\n' | |
while read domain | |
do | |
source_output+="$(dig +nocmd +noall +answer @${nameserver_source} ${domain} | grep -v "^;")${NEWLINE}" | |
comparison_output+="$(dig +nocmd +noall +answer @${nameserver_comparison} ${domain} | grep -v "^;")${NEWLINE}" | |
done < <(echo "${dns_records}") | |
echo "${source_output}" | |
echo "${comparison_output}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ran into this not outputting anything for NS records on sub-domains, adding
+authority
to the query when an NS record is being looked up solves the issue. The use case being Dotmailer NS records on something likeevents.example.com
. Added these lines in my forked copy of the script: https://gist.github.com/davidalger/a33891d3a2e6858f3a8987bb7f1ab062#file-nsq_compare-sh-L33-L35