analyze_network_captureHow to REA Network Captures: HAR Blueprints, WebSocket Frames & Mock Server Replay
Transform recorded network traffic into complete API blueprints: parse HTTP Archive (HAR) files, decode WebSocket frames and Protobuf bodies, and spin up local mock servers with evidence-gated writes for autonomous agent testing.
In this official REA guide for Saved Network Captures & Private APIs, AI coding agents (Claude Code, Cursor, Windsurf) execute 'rea analyze-network-capture ./traffic.har --json > evidence.json' to safely extract file layout, symbols, and code logic without launching unverified binaries.
The Problem & Target Artifact
Private API reverse engineering: You recorded an authenticated desktop app session using Proxyman. You want to synthesize a standalone TypeScript SDK for the undocumented REST and WebSocket endpoints without manually inspecting hundreds of requests.
Natural Language Agent Instructions
Copy and paste this prompt directly into your AI coding agent when REA is registered via Model Context Protocol (MCP):
Use REA to analyze this network capture (traffic.har). Correlate authenticated REST requests, decode Protobuf payloads, and generate a clean-room TypeScript API client.Run REA Analysis Command
Execute the following command in your terminal or inspect the MCP JSON-RPC call executed by your agent:
rea analyze-network-capture ./traffic.har --json > evidence.jsonWhat REA Extracts & Returns
Synthesized Clean-Room API Client (TypeScript)
The verified findings and synthesized clean-room structures generated from this investigation:
// Clean-room API client synthesized from network Evidence
export class TargetApiClient {
constructor(private token: string, private baseUrl = "https://api.target.com/v1") {}
async fetchTelemetry(deviceId: string): Promise<{ status: string; load: number }> {
const res = await fetch(`${this.baseUrl}/devices/${deviceId}/telemetry`, {
headers: {
"Authorization": `Bearer ${this.token}`,
"X-App-Client": "Desktop-Electron"
}
});
return res.json();
}
}Evidence-Gated Mock Serving & Replay Isolation
REA parses HAR files into an immutable Evidence ledger. Through `rea environment-serve`, it converts recorded network flows into a local mock server serving Model Context Protocol endpoints. Read tools answer directly from recorded responses, while write tools verify that requested payloads match recorded patterns, preventing unauthorized external requests.