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

# API Reference — Passive Infrastructure Mapping

## Shodan API

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

### Search
```bash
curl -s "https://api.shodan.io/shodan/host/search?key=$SHODAN_KEY&query=org:\"Target\""
```

### Count
```bash
curl -s "https://api.shodan.io/shodan/host/count?key=$SHODAN_KEY&query=hostname:example.com"
```

### DNS Resolve
```bash
curl -s "https://api.shodan.io/dns/resolve?hostnames=example.com&key=$SHODAN_KEY"
```

## Shodan CLI

```bash
shodan host 1.2.3.4
shodan search "org:\"Target Corp\"" --fields ip_str,port,product
shodan count "hostname:example.com"
shodan domain example.com
shodan stats "org:\"Target Corp\"" --facets port,product
```

## Censys API

### Hosts Search
```bash
curl -s -u "$CENSYS_API_ID:$CENSYS_API_SECRET" \
  "https://search.censys.io/api/v2/hosts/search" \
  -d '{"q": "services.tls.certificates.leaf.names: example.com"}'
```

### Host View
```bash
curl -s -u "$CENSYS_API_ID:$CENSYS_API_SECRET" \
  "https://search.censys.io/api/v2/hosts/1.2.3.4"
```

## BGPView API

### ASN Info
```bash
curl -s "https://api.bgpview.io/asn/15169"
```

### ASN Prefixes
```bash
curl -s "https://api.bgpview.io/asn/15169/prefixes"
```

### IP Info
```bash
curl -s "https://api.bgpview.io/ip/1.2.3.4"
```

### Search
```bash
curl -s "https://api.bgpview.io/search?query_term=example"
```

## ipinfo.io

### IP Lookup
```bash
curl -s "https://ipinfo.io/1.2.3.4?token=$IPINFO_TOKEN"
```

### ASN Lookup
```bash
curl -s "https://ipinfo.io/AS15169?token=$IPINFO_TOKEN"
```

## VirusTotal API

### IP Report
```bash
curl -s -H "x-apikey: $VT_API_KEY" \
  "https://www.virustotal.com/api/v3/ip_addresses/1.2.3.4"
```

### Domain Report
```bash
curl -s -H "x-apikey: $VT_API_KEY" \
  "https://www.virustotal.com/api/v3/domains/example.com"
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `SHODAN_API_KEY` | Shodan API key |
| `CENSYS_API_ID` | Censys API ID |
| `CENSYS_API_SECRET` | Censys API secret |
| `IPINFO_TOKEN` | ipinfo.io API token |
| `VT_API_KEY` | VirusTotal API key |
