I have a URL and I need to extract all of its DNS records such as TXT, NS, MX, AAA etc.
I use bash on Ubuntu. How can I achieve that?
You can use dig
or nslookup
commands.
I have created a script to make your job very easy:
if [ -z "$1" ]; then echo "Usage: $0 <domain>" exit 1 fi domain="$1" record_types=("A" "AAAA" "MX" "TXT" "CNAME" "NS" "SOA" "PTR" "SRV") for record in "${record_types[@]}"; do echo "Querying $record record for $domain:" dig $record "$domain" | grep -v '^;' | grep -v '^$' echo "" done