Information Gathering
dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and displays the answers that are returned from the name server(s).
sudo apt install dnsutils
dig <domain> [type]
Dig (Domain Information Groper) is the industry-standard DNS lookup tool from ISC. It queries DNS servers for any record type and provides detailed, structured responses that are essential for DNS troubleshooting and security assessment.
Unlike simpler tools like nslookup, dig provides complete DNS response data including headers, question sections, answer sections, and authority sections. This level of detail makes it indispensable for DNS professionals and security researchers.
Dig supports zone transfer testing, reverse DNS lookups, batch queries, and scriptable output formats. It is the tool of choice for DNS security assessments and troubleshooting complex DNS configurations.
dig example.com ANYAll records lookup - Query target servers for all available DNS records simultaneouslydig example.com axfrZone transfer query - Request a complete zone transfer duplicate file from target nameserversdig example.comBasic A record lookupdig example.com MXMail server recordsdig example.com NSName server recordsdig example.com AXFR @ns1.example.comZone transferdig -x 192.168.1.1Reverse DNS lookupdig +short example.comShort outputdig example.com TXTTXT recordsdig example.com AQuery IPv4 address recordsdig example.com AAAAQuery IPv6 address recordsdig example.com MXQuery mail exchange recordsdig example.com NSQuery name server recordsdig example.com TXTQuery text records including SPFdig example.com SOAQuery start of authority recordQuery any DNS record type (A, AAAA, MX, NS, TXT, SOA, SRV).
Test if DNS servers allow unauthorized zone transfers.
Resolve IP addresses to hostnames using PTR records.
Diagnose DNS resolution issues with detailed query output.
Audit DNS configurations for security misconfigurations.
Dig output shows DNS query results organized by record type. The ANSWER SECTION contains resolved records (A, AAAA, MX, NS, TXT, CNAME, SOA). Status code indicates success (NOERROR) or failure (NXDOMAIN). TTL values show caching duration. The AUTHORITY SECTION lists nameservers.
This tool is designed for authorized security testing, educational purposes, and legitimate network administration only. Unauthorized access to computer systems is illegal.