How to get all DNS records from a website?

dns
website
domain-web
Category Software and digital electronics / IT
2024-11-08 02:18

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?

Answered by robin
2024-11-20 08:01

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
×

Login

No account?
Terms of use
Forgot password?