How to Programmatically Find All Domains Registered Under a Nameserver Using DNS Enumeration Techniques


27 views

For years, many developers believed it was impossible to comprehensively list all domains registered under a particular nameserver. However, specialized DNS reconnaissance techniques make this achievable through various methods.

Services like GWebTools and Robtex utilize these underlying techniques:

# Basic DNS zone transfer attempt (AXFR)
dig @ns1.example.com example.com AXFR

# DNS reverse lookup brute force example
for i in {1..254}; do dig -x 192.168.1.$i +short; done

# Using DNSDumpster API (Python example)
import requests

def get_domains(nameserver):
    url = "https://api.dnsdumpster.com"
    params = {"target": nameserver}
    response = requests.post(url, data=params)
    return response.json()

Commercial DNS databases and historical records provide additional options:

  • Certificate Transparency logs (crt.sh)
  • Passive DNS replication services
  • Domain registration whois histories

Important constraints to note:

# Rate limiting considerations
# Most services enforce strict query limits
# Always check Terms of Service before scraping

For comprehensive results, combine multiple approaches and respect data usage policies.


For years, many developers assumed comprehensive nameserver domain enumeration was impossible due to DNS protocol limitations. However, specialized tools have emerged that challenge this assumption through creative technical approaches.

The tools you referenced typically combine several technical methods:

1. Historical DNS zone transfers (AXFR requests)
2. DNS reverse lookup brute-forcing
3. Certificate Transparency log analysis
4. Aggregating public DNS datasets
5. Web crawling and search engine indexing

Here's a basic script that demonstrates reverse DNS lookup using Python's dnspython library:

import dns.resolver
import dns.reversename

def reverse_dns_lookup(ip_address):
    try:
        rev_name = dns.reversename.from_address(ip_address)
        return str(dns.resolver.resolve(rev_name, "PTR")[0])
    except Exception as e:
        return f"Error: {str(e)}"

def enumerate_domains(nameserver, limit=100):
    domains = []
    # This is simplified - real implementations would use more advanced techniques
    with open('common_domains.txt') as f:
        for domain in f.readlines()[:limit]:
            try:
                answers = dns.resolver.resolve(domain.strip(), 'A', nameserver=nameserver)
                domains.append(domain.strip())
            except:
                continue
    return domains

For more comprehensive results, consider:

  • Querying Certificate Transparency logs (crt.sh API)
  • Parsing DNS Dumps from projects like Rapid7's Open Data
  • Using SecurityTrails or other DNS history APIs

When implementing these techniques:

- Respect rate limits on DNS servers
- Check the TOS of any API/service you use
- Consider the privacy implications of mass enumeration
- Avoid causing performance impact on infrastructure

For production needs, consider these reputable services:

  • SecurityTrails DNS Explorer
  • Shodan DNS search
  • Censys reverse DNS lookup
  • RiskIQ PassiveTotal