Last active
December 12, 2017 14:33
-
-
Save kgaughan/b0ed6852f681be576f61aa0d0bf01314 to your computer and use it in GitHub Desktop.
Get A records for a given domain name
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
get_nss () { | |
dig +aaonly @$(dig +short $(echo $1 | cut -f2- -d.) NS | head -n1) $1 NS | \ | |
grep -v '^;' | \ | |
awk '$4 == "NS" {print substr($5, 1, length($5) - 1)}' | sort -u | |
} | |
fqdn=google.com | |
dig +short @$(get_nss $fqdn | head -n1) $fqdn A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment