liveBook · Manning

Chapter 4: Passive reconnaissance agents

What you will learn in chapter 4 of AI Agents for Offensive Security

This chapter introduction frames passive reconnaissance as an auditable, human-supervised pipeline that records safe evidence and prepares the reader for later enumeration and scoring work.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This chapter introduction frames passive reconnaissance as an auditable, human-supervised pipeline that records safe evidence and prepares the reader for later enumeration and scoring work.

Key terms: reconnaissance pipeline, explicit stages, structured outputs, audit trail, artifacts, BlackHat AI philosophy, human-in-the-loop, safety gates, defined boundaries, supervisors and escalators

4.1 Why an AI reconnaissance agent?

This section motivates a passive AI reconnaissance agent by contrasting passive and active recon and showing how staged, artifact-driven pipelines make recon repeatable, auditable, and bounded by human-controlled safety gates.

Key terms: reconnaissance, passive reconnaissance, active reconnaissance, target system, scope, lineage tracking, repeatable, CI/CD pipeline, reconnaissance session, AI recon agent

4.2 The minimal agent architecture

Defines the minimal AI reconnaissance agent as a deliberately small, bounded intelligent workflow before implementation.

Key terms: minimal AI recon agent, minimum viable pipeline, intelligent workflow

4.2.1 Pipelines vs. scripts

This section distinguishes standalone scripts, staged pipelines, and AI agents in passive reconnaissance workflows.

Key terms: script, pipeline, stages, orchestrate, stage interface, structured artifact, JSON, context, timestamps, gates

4.2.2 The four building blocks to building ReAct agents

This section maps the four reusable ReAct-agent components to reconnaissance work and clarifies the boundary between passive, non-intrusive active, and intrusive active recon.

Key terms: ReAct agents, planning phase, acting phase, analyzes, context, reconnaissance strategy, ephemeral, artifact, JSON file, vector database

4.2.3 Artifacts provide persistent memory to an agent

This section explains how reconnaissance agents use persistent JSONL artifacts to retain findings and support later analysis, debugging, and reporting.

Key terms: artifacts, persistent, reconnaissance findings, host, target address, detected headers, JSONL, machine-readable, LLMs, recon.jsonl

4.2.4 Safety gates

This section explains why passive-reconnaissance agents need safety gates and introduces time-window and approval-or-automation checkpoints before any network call.

Key terms: safety gates, decision checkpoints, control mechanisms, network call, active reconnaissance, security alerts, privacy laws, production, ethical territory, time-window gate

4.2.5 Two scripts, one story

This subsection explains the deliberately simple two-script layout used to teach the minimal passive-reconnaissance agent and its artifact flow.

Key terms: recon_pipeline.py, artifacts.py, JSONL, passive recon logic, single file, logic flow, modular, file management system, agentic stage, artifacts

4.3 Building the minimal AI recon pipeline

Introduces a self-contained minimal reconnaissance pipeline that runs agent stages sequentially and saves structured artifacts, while warning that it is only a sandbox foundation rather than a production-ready recon agent.

Key terms: recon agent, agent stage, structured artifacts, pipeline, production-ready agent, sandbox environment, safe and auditable agentic system

4.3.1 Getting started

This subsection explains why to activate a project-specific Python virtual environment before building the reconnaissance pipeline.

Key terms: Python virtual environment, system-level Python library, packages, dependencies

4.3.2 Starting the artifact helper

This section defines the Artifact record and JSONL-writing helper that persist passive reconnaissance observations for later agent reasoning and reporting.

Key terms: Artifact, dataclass, DNS, HTTP metadata, TLS details, general notes, schema, UTC timestamp, _now_iso(), write_jsonl

4.3.3 Creating the passive reconnaissance pipeline

This section assembles a command-line reconnaissance pipeline from small, low-impact discovery and inspection functions that write one structured artifact per host.

Key terms: candidates(), resolve(), https_head(), inter_waf(), tls_peek(), robots_and_sitemap(), SEEDS, apex domain, getaddrinfo(), gethostbyname_ex()

4.3.4 Diving into the passive reconnaissance results

This subsection runs the passive reconnaissance pipeline, explains why passive and controlled automation comes first, and introduces recon.jsonl as the persistent record whose depth changes with optional flags.

Key terms: passive reconnaissance, deep enumeration, scanning, one request per host, timeouts, scope, recon.jsonl, artifact, project root, pipeline

4.4 Inspecting your reconnaissance results

This section introduces executing the recon pipeline and inspecting its append-only JSON-line artifacts as a chronological record of each run.

Key terms: append-only, artifact lines, chronological record, pipeline logging, recon pipeline, artifacts, JSON lines

4.4.1 Viewing results

This section shows how to view the pipeline’s recent JSON artifacts and interpret the fields that preserve passive reconnaissance context for later AI reasoning.

Key terms: JSON, artifact, recon-v1, schema, host, fully qualified hostname, a, cname, artifacts, logs

4.4.2 Checking for patterns

This subsection shows how to use quick grep and jq queries on passive reconnaissance results to identify responsive hosts, WAF/CDN-protected hosts, and technology fingerprints, then use the output to guide further investigation.

Key terms: grep, jq, 200 status code, waf_hint, header keys, seed list, candidate, attack surface, WAF, CDN

4.4.3 Clean up and prepare for next steps

This subsection advises archiving old runs while preserving the durable findings artifact for later interpretation and expansion.

Key terms: archive old runs, durable artifact file, pipeline findings, evidence

4.5 Reading the pipeline like a story

This section frames the recon.jsonl artifact log as a narrative record of a reconnaissance operation rather than raw output.

Key terms: recon.jsonl, artifact, pipeline, intent, context, outcome

4.5.1 Artifacts as episodes of reasoning

This subsection explains that chronologically ordered artifacts preserve the traces of each reasoning stage, letting readers reconstruct the reconnaissance pipeline's discovery process.

Key terms: artifact, pipeline, reasoning process, discovery, traces

4.5.2 Example: following the trail

This section shows how clearly structured reconnaissance artifacts let analysts and AI agents connect observations into meaningful findings and host clusters.

Key terms: JSONL format, structured artifacts, downstream reasoning, observations, development server, CDN host, Cloudflare, production front, staging environment, sitemap

4.6 Safety, scope, and ethics

This section introduces responsible AI reconnaissance as a practice bounded by consent, ethics, and rules rather than technical capability alone.

Key terms: clear boundary of consent, authorized reconnaissance, illegal scanning, AI reconnaissance systems, responsibly, rules, code, attack surface

4.6.1 Scope defines the battlefield

This subsection makes explicit scope configuration and enforcement a built-in design control for passive reconnaissance pipelines.

Key terms: scope.json, environment variable, allowed domains, IP ranges, network zones, scope enforcement, proposed target, artifact line, pipeline denies, scope

4.6.2 Gates keep humans in the loop

This section explains how permission gates keep early reconnaissance agents under human control and turn ethical intent into enforced code.

Key terms: gates.py, gate, human in the loop, ethics check, ethics as code, MITRE Engenuity’s ATT&CK Evaluations, OSCP exam environments

4.6.3 Handling and storing data safely

This section explains how to protect sensitive reconnaissance artifacts through local storage, pre-write sanitization, retention limits, and evidence-grade handling.

Key terms: recon artifacts, recon.jsonl, confidential intelligence, archive, delete artifacts, set-cookie, sanitize_headers(), redaction, write_jsonl(), JSONL

4.6.4 AI models and responsibility

This section establishes that human operators remain accountable for AI-assisted reconnaissance and defines the controls that make a recon pipeline responsible and auditable.

Key terms: human operator, accountable, advisory, autonomous, Explainability first, least privilege, Audit everything, artifacts, documented scope, out-of-scope request

4.7 Summary

This summary consolidates how a safe ReAct-based passive reconnaissance pipeline gathers, records, interprets, and governs low-impact target intelligence.

Concepts explained in this chapter

← Chapter 3: Multi-agent pipelines and orchestration

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.