Pipeline thinking
A pipeline you cannot safely rerun is a script you dread. A pipeline is a chain of small stages, each reading one text file and writing another. It is safe to rerun, it does nothing when its inputs are missing, and it stops at a human before anything is reported. Get those three properties right and a rerun costs you minutes instead of an evening.
What a pipeline is
Section titled “What a pipeline is”The workflow script is already a pipeline in shape: subfinder writes a list, dnsx reads it and writes another, httpx reads that. What it lacks is memory and judgment. It does not know what it found yesterday, it does not rank what it found today, and it hands you everything at once.
A pipeline in this guide means staged transformations of text files. Each stage:
- reads one or more files with a known format,
- does one job,
- writes one file with a known format,
- and can be run on its own, by hand, with the same result.
# The shape of every stageinput file -> [ one job ] -> output file (+ a line in the run log)When files beat a monolithic tool
Section titled “When files beat a monolithic tool”Frameworks such as reconFTW or BBOT run everything in one command. They are covered on the automation page. They are good at breadth. A home-made pipeline of files wins when you need these:
| Need | Monolithic framework | Staged files |
|---|---|---|
| See exactly why a host was flagged | Hard. Logic is inside the tool | Open the file the stage wrote |
| Rerun one step after a fix | Usually reruns everything | Rerun that stage on its input file |
| Change one decision, such as a score weight | Fork or patch the tool | Edit a config line |
| Add your own check | Learn the plugin system | Add a stage that reads a file |
| Run the same thing as everyone else | Yes, by default | Only if you copy someone |
| Low setup effort | Yes | No. You build and test it |
The last two rows are the trade-off. A framework is faster to start. A pipeline you wrote is slower to build, but you understand every line, and its output is not identical to every other hunter on the program. Many hunters use both: a framework for broad collection, their own stages for dedup, scoring and delivery.
The three laws
Section titled “The three laws”1. Idempotency
Section titled “1. Idempotency”Same input, same output, safe to rerun. Idempotent is an engineering word for “doing it twice has the same effect as doing it once”. For a pipeline, that means:
- Rerunning a stage on the same input produces the same output file, not a doubled one.
- Rerunning the whole pipeline does not alert you again about findings you already saw.
- A crash halfway through can be fixed by running again, without cleanup by hand.
The usual ways to break it are appending to a file instead of rewriting it, writing into a folder an earlier run already used, and recording “already seen” before the alert was sent. The worked pipeline shows a real bug of this kind that its own test caught.
# Not idempotent: every rerun appends the same hosts againcat subs/passive.txt >> subs/all.txt# Idempotent: anew appends only lines it has not seen, so a rerun adds nothinganew subs/all.txt < subs/passive.txt > subs/new.txt2. Fail closed
Section titled “2. Fail closed”A missing config or scope file makes a stage do nothing, never everything. This is a hard design rule here, not a preference.
The danger is concrete. A script that builds its target list with grep -vFf scope/out-of-scope.txt can fail badly if that file is missing. Depending on how it is written, it either crashes or skips the filter and scans everything subfinder returned, vendor hosts included. A script that defaults to a high rate when policy.env is missing will hammer the target at 3 AM. In both cases the safe outcome is the same: stop, log why, exit non-zero.
| Missing input | Fail-open behaviour (wrong) | Fail-closed behaviour (right) |
|---|---|---|
scope/in-scope.txt |
Scan whatever enumeration returned | Exit with code 3, send nothing |
scope/out-of-scope.txt |
Skip the exclusion filter | Exit with code 3. An empty file is a decision; a missing one is not |
scope/policy.env |
Use the tool’s default rate, often 150 requests per second | Exit with code 3 |
| An empty list after filtering | Run the next tool with no input, which some tools treat as “read stdin” or “use defaults” | Skip the stage and log it |
Part 4 turns this into code, and Part 11 proves it with a test.
3. Human in the loop
Section titled “3. Human in the loop”The pipeline never reports. It finds, ranks, re-checks and packs evidence. A person confirms every finding by hand and writes every report. Scanners produce false positives, templates match error pages, and a model can describe a bug that does not exist. A report that turns out to be your tool’s mistake costs reputation that takes months to rebuild. Part 6 sets the minimum manual step for each severity.
Anti-patterns
Section titled “Anti-patterns”| Anti-pattern | What it looks like | Why it fails | Fix |
|---|---|---|---|
| Everything to Nuclei | nuclei -l all-hosts.txt with every template, every night |
Hundreds of thousands of Heavy active requests, a pile of info results, and the real hits were reported on launch day by the crowd |
Score first, scan the top of the queue with chosen tags (Part 5) |
| Output no one reads | Twelve folders of results, a cron job, no summary | Nothing changes your behaviour, so the pipeline is pure cost | Every run ends in one short ranked file and one message (Part 7) |
| Alert fatigue | Every new subdomain and every info hit pings your phone |
You mute the channel in a week, then miss the one critical | Severity routing and a notification budget (Part 7) |
| No memory | Each run reports everything it sees | The same twenty findings every morning | A ledger and fingerprints (Part 2) |
| Silent death | A stage fails at 2 AM, nobody notices for a week | You think the target is quiet; it is your pipeline that is quiet | Heartbeats and health checks (Part 9) |
| Trusting the scanner | A Nuclei hit becomes a report | Duplicate or false positive, reputation damage | Validation layer and a manual confirm (Part 6) |
Convincing duds
Section titled “Convincing duds”Minute stamp, shared folder
Section titled “Minute stamp, shared folder”An early draft stamped run folders to the minute. The end-to-end test ran twice in one minute, reused the folder, and re-sent the first run’s alerts.
Stamps now include seconds, from date -u +%Y-%m-%dT%H%M%SZ. An existing folder is refused:
mkdir "$RUN" 2>/dev/null || die 6 "run folder $RUN already exists"Exit 6 asserts the directory was already there. It does not assert the first run has finished. Two starts in the same second, or a clock step backward, hit the same refusal.
The data flow
Section titled “The data flow”The whole pipeline architecture on one diagram. Every arrow is a file.
# Data flow of the worked pipeline, scope file to notification
scope/in-scope.txt ─┐ scope/out-of-scope ─┼─> [inscope filter] used by every stage that sends traffic scope/policy.env ───┘ │ v [1 enum: subfinder] Passive -> hosts.txt, new-hosts.txt (state/hosts.txt via anew) v [2 resolve: dnsx] Light active -> resolved.txt v [3 probe: httpx] Light active -> httpx.json, live.txt v [4 score: jq + awk] Passive -> queue.tsv <- etc/score.conf, state/cve-tech.txt v [5 scan: nuclei, top N] Heavy active -> nuclei.jsonl v [6 dedup: fingerprints] Passive -> new-findings.jsonl <- state/ledger.txt, state/suppress.txt v [7 verify + evidence] Light active -> evidence/<fp>/, triage.tsv v [8 deliver] Passive -> notify now (critical, high) | digest/queue.tsv (rest) v YOU -> manual confirm -> report (report writing)Why pipelines change the economics
Section titled “Why pipelines change the economics”A manual rerun of recon and triage on one program is an evening: start the tools, wait, diff by eye, re-check last week’s leads, decide what is new. So you do it once a week, if that, and the new staging host that appeared on Tuesday is found by someone else on Wednesday.
An automated rerun costs a few minutes of your attention: read a digest, open the one finding that matters. That changes three things.
| Manual rerun | Automated rerun | |
|---|---|---|
| Cost to you per rerun | An evening, roughly 2 to 4 hours (approximate) | 5 to 15 minutes of reading (approximate) |
| How often you can afford it | Weekly at best | Daily or hourly per stage |
| Time from a new asset to your eyes | Days | Hours |
| What your hours go to | Re-collecting | Testing the top of the queue |
The numbers are approximate. They depend on scope size, how many stages you automate, and how well tuned your scoring is. The direction is not in doubt: automation moves your hours from collection to testing, which is the only part that gets paid. It does not find bugs for you. It buys you time to find them, and gets you to new assets first, which is where the reconnaissance mindset guide says the bugs are.
Next, decide where the pipeline keeps its memory between runs in State, storage and deduplication.
Open local graph around this page
Linked from here
Links out to
- End-to-end workflowRecon Atlas
- Automation and frameworksRecon Atlas
- The worked pipelineRecon Atlas
- Scope enforcement as codeRecon Atlas
- Validation layerRecon Atlas
- Scoring and triage enginesRecon Atlas
- Notification and deliveryRecon Atlas
- State, storage and deduplicationRecon Atlas
- The unattended nightRecon Atlas
- Recon mindsetRecon Atlas
Recon AtlasFor authorized testing only. Your scope is the map edge.