<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->

# API Reference — DNS Reconnaissance

## dig Commands

### Standard Queries
```bash
dig example.com A +short
dig example.com AAAA +short
dig example.com MX +short
dig example.com NS +short
dig example.com TXT +short
dig example.com SOA +short
dig example.com SRV +short
dig example.com CAA +short
dig example.com ANY +noall +answer
```

### Zone Transfer
```bash
dig @ns1.example.com example.com AXFR
```

### Reverse DNS
```bash
dig -x 1.2.3.4 +short
```

### Cache Snooping
```bash
dig @target-resolver example.com A +norecurse
```

### DNSSEC Validation
```bash
dig example.com DNSKEY +dnssec
dig example.com DS +short
```

## dnspython

### Record Enumeration
```python
import dns.resolver
answers = dns.resolver.resolve("example.com", "A")
for r in answers:
    print(r)
```

### Zone Transfer
```python
import dns.query, dns.zone
zone = dns.zone.from_xfr(dns.query.xfr("ns1.example.com", "example.com"))
for name, node in zone.nodes.items():
    print(dns.name.Name.concatenate(name, zone.origin))
```

### Reverse DNS
```python
import dns.reversename, dns.resolver
rev = dns.reversename.from_address("1.2.3.4")
answers = dns.resolver.resolve(rev, "PTR")
```

## DNSx

### Full Recon
```bash
dnsx -d example.com -recon -resp -o recon.txt
```

### Zone Transfer
```bash
dnsx -d example.com -axfr -resp
```

### Bulk Resolution
```bash
dnsx -l domains.txt -silent -a -resp -o resolved.txt
```

## Dnsrecon

### Standard Enumeration
```bash
dnsrecon -d example.com -t std -j output.json
```

### Brute-Force
```bash
dnsrecon -d example.com -t brt -D wordlist.txt
```

### Reverse Range
```bash
dnsrecon -r 10.0.0.0/24 -t rvl
```

## SecurityTrails API

### DNS History
```bash
curl -s -H "apikey: $ST_KEY" \
  "https://api.securitytrails.com/v1/history/example.com/dns/a"
```

### Associated Domains
```bash
curl -s -H "apikey: $ST_KEY" \
  "https://api.securitytrails.com/v1/domain/example.com/associated"
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `SECURITYTRAILS_KEY` | SecurityTrails API key |
| `PASSIVETOTAL_KEY` | PassiveTotal/RiskIQ API key |
| `PASSIVETOTAL_USER` | PassiveTotal username |
