0x02 /hack
Recon: one domain to an attack surface
A repeatable pipeline that turns a single in-scope domain into a short list of hosts worth a human's attention. Each step writes a file the next one reads.
Recon is not running every tool you own at a target. It is answering four questions in order: what names exist, which are alive, what runs on them, and which deserve a person. Each step writes a file, so you can stop, resume, and — the real payoff — diff against last week.
Scope
Run this only against assets you own or are authorised in writing to test. The passive steps query third-party data; from "Resolve" onward you are sending packets to the target, which is active testing and needs permission.
A workspace per target#
$ mkdir -p ~/targets/example.com/$(date +%F) && cd $_One directory per target, one file per step. In a month you will want to know exactly what the surface looked like today.
Collect names#
Passive sources first. Certificate transparency alone surfaces most of what an organisation has ever put behind TLS.
$ subfinder -d example.com -all -silent -o subs.passive.txt
$ curl -s 'https://crt.sh/?q=%25.example.com&output=json' \
| jq -r '.[].name_value' | sort -u > subs.crt.txt
$ sort -u subs.passive.txt subs.crt.txt | grep -v '^\*' > subs.txt && wc -l subs.txtsubfinder improves a lot once you add API keys for its sources; without them it still works
with fewer results.
Resolve#
Most collected names are dead. Keep the ones that answer.
$ dnsx -l subs.txt -silent -o resolved.txtNote what did not resolve, too. A CNAME pointing at a deprovisioned cloud resource is a takeover candidate and deserves its own line in your notes.
Find the open doors#
Scan the resolved hosts, then ask each open port whether it speaks HTTP.
$ naabu -list resolved.txt -top-ports 1000 -silent -o ports.txt
$ httpx -l ports.txt -silent -status-code -title -tech-detect -o live.txtlive.txt is the first file worth reading line by line. A title like "Index of /", "Grafana", or
a login page on an odd port tells you more than any scanner summary.
Crawl what is alive#
$ cut -d' ' -f1 live.txt > urls.txt
$ katana -list urls.txt -d 3 -jc -silent -o crawl.txt
$ grep -Ei '\.(js|json|map)(\?|$)' crawl.txt | sort -u > js.txt
$ grep -E '\?.+=' crawl.txt | sort -u > params.txt-jc parses linked JavaScript for endpoints, which is where modern apps hide most of their
surface.
Check for known issues#
nuclei runs community templates for known CVEs and misconfigurations. Rate-limit it — a flood
gets you blocked and proves nothing — and treat every hit as a lead to reproduce by hand.
$ nuclei -l urls.txt -severity medium,high,critical -rl 50 -o nuclei.txtWhere to spend the time#
Recon ends when you have a handful of these, each with a reason:
| Signal | Why it matters |
|---|---|
| Admin or login panel on an odd host | Often outside the hardened main app |
| Old server or framework version | Known bugs, quick to confirm |
dev, staging, old in the name |
Weaker controls, real data more often than it should |
| Swagger / GraphQL / API docs | The attack surface, written down for you |
| Dangling CNAME | Possible subdomain takeover |
Make it repeatable#
The value is in the diff. Put the chain in a script, run it on a schedule against your own estate, and the most interesting line you read all week is a host that was not there before.
#!/usr/bin/env bash
set -euo pipefail
d="$1"; out=~/targets/"$d"/"$(date +%F)"; mkdir -p "$out"; cd "$out"
subfinder -d "$d" -all -silent | sort -u > subs.txt
dnsx -l subs.txt -silent -o resolved.txt
naabu -list resolved.txt -top-ports 1000 -silent -o ports.txt
httpx -l ports.txt -silent -status-code -title -tech-detect -o live.txt