Skip to content

Instantly share code, notes, and snippets.

@asergeyev
asergeyev / digfuncs.sh
Created February 15, 2016 17:35
Bunch of dig command line examples
# All authority gluerecs by name:
dig +noall +authority $NAME @b.gtld-servers.net | sed -e 's/.*\s//' | xargs -n1 -I % bash -c 'dig +short $NAME @% | sed -e s/^/%\\t/'
# All authority gluerecs with glue IPs:
dig +noall +additional $NAME @b.gtld-servers.net | sed -e 's/.*\s//' | xargs -n1 -I % bash -c 'dig +short $NAME @% | sed -e s/^/%\\t/'
# All recs found with resolving every name to all known IPs
dig +noall +authority $NAME @b.gtld-servers.net | sed -e 's/.*\s//' | xargs -n1 -I % dig +short NS $ZONE @% | sort -u | xargs -n1 -I % bash -c 'dig +short A %; dig +short AAAA %' | sort -u | grep -v : |xargs -n1 -I % bash -c 'dig +short $NAME @% | sed -e s/^/%\\t/'
# For one above, find zone by name (not 100% good but works ok for basic things):