<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
# API Reference — OSINT Gathering

## DNS Reconnaissance

### dig Commands
```bash
dig example.com A +short
dig example.com MX +short
dig example.com NS +short
dig example.com TXT +short
dig example.com ANY +noall +answer
```

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

## Subdomain Enumeration

### crt.sh (Certificate Transparency)
```bash
curl "https://crt.sh/?q=%.example.com&output=json" | jq '.[].name_value'
```

### SecurityTrails
```bash
curl -H "apikey: $ST_KEY" \
  "https://api.securitytrails.com/v1/domain/example.com/subdomains"
```

### theHarvester
```bash
theHarvester -d example.com -b all -f output.html
```

## Email Discovery

### Hunter.io
```bash
curl "https://api.hunter.io/v2/domain-search?domain=example.com&api_key=$HUNTER_KEY"
```

### Email Verification
```bash
curl "https://api.hunter.io/v2/email-verifier?email=user@example.com&api_key=$HUNTER_KEY"
```

## Shodan

### Host Lookup
```bash
shodan host 1.2.3.4
# or
curl "https://api.shodan.io/shodan/host/1.2.3.4?key=$SHODAN_KEY"
```

### Search
```bash
shodan search "org:\"Target Corp\" port:443"
```

### Count
```bash
shodan count "org:\"Target Corp\""
```

## Google Dorking Reference

| Operator | Example | Purpose |
|----------|---------|---------|
| `site:` | `site:example.com` | Limit to domain |
| `filetype:` | `filetype:pdf` | Specific file types |
| `inurl:` | `inurl:admin` | URL path matching |
| `intitle:` | `intitle:"index of"` | Page title matching |
| `ext:` | `ext:conf` | File extension |
| `cache:` | `cache:example.com` | Cached version |

## WHOIS

### Command Line
```bash
whois example.com
```

### Python
```python
import whois
w = whois.whois("example.com")
print(w.registrar, w.creation_date, w.name_servers)
```

## Archive.org (Wayback Machine)

### Check URL History
```bash
curl "https://web.archive.org/cdx/search/cdx?url=example.com&output=json&limit=10"
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `HUNTER_API_KEY` | Hunter.io API key |
| `SHODAN_API_KEY` | Shodan API key |
| `SECURITYTRAILS_KEY` | SecurityTrails API key |
| `VT_API_KEY` | VirusTotal API key |
