feat(captures): inspect recorded packets with bounded TShark delivery (#2318)

Inspect selected fields in existing captures through shared CLI/MCP Evidence.
Page matching frames without changing dissection or two-pass read coverage;
retain failed descriptor/process cleanup ownership and reject excess admission.

Verified with real TShark 4.0.17 and 4.2.2, public Wireshark recordings,
owned HTTP application traffic, real CLI/MCP workflows and schema checks.

Co-authored-by: Olorinm <59321404+Olorinm@users.noreply.github.com>
Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
This commit is contained in:
Ysopwnable
2026-10-12 19:35:35 +00:00
committed by GitHub
co-authored by Olorinm
parent 570c40cde5
commit f611d8ce72
50 changed files with 2850 additions and 0 deletions
+17
View File
@@ -1,3 +1,6 @@
import type { PacketCaptureService } from "../application/captures/PacketCaptureService.js";
import { createPacketCaptureService } from "../composition/captures.js";
import { registerCaptureTools } from "./registerCaptureTools.js";
import type { WasmArtifactService } from "../application/wasm/WasmArtifactService.js";
import { wasmArtifactModule } from "../composition/wasm.js";
import { registerWasmTools } from "./registerWasmTools.js";
@@ -119,6 +122,7 @@ const ACTIVE_TARGET_INSTRUCTIONS =
export interface CreateServerOptions {
readonly environment?: Readonly<NodeJS.ProcessEnv>;
readonly delivery?: ToolResultDelivery;
readonly packetCapture?: PacketCaptureService;
readonly wasmArtifact?: WasmArtifactService;
readonly evmInterface?: EvmInterfaceService;
readonly sqliteDatabase?: SqliteDatabaseService;
@@ -161,6 +165,9 @@ const installSessionToolAvailability = (
const basePolicy = sessionAvailabilityPolicy(options.availabilityPolicy, {
optionalProviderLoadFailures: options.optionalProviderLoadFailures,
optionalFeatures: {
packetCaptureEnabled:
options.packetCapture !== undefined ||
(linux && isAbsolute(environment.REA_TSHARK_COMMAND ?? "")),
wasmArtifactEnabled:
options.wasmArtifact !== undefined ||
isAbsolute(environment.REA_WABT_BIN_DIRECTORY ?? ""),
@@ -292,6 +299,8 @@ export const createServer = (
environment,
options.wasmArtifact,
);
const packetCapture =
options.packetCapture ?? createPacketCaptureService(environment);
const apktool =
options.apktoolAnalysis ??
createApktoolResourceAnalysisProvider(environment);
@@ -304,6 +313,7 @@ export const createServer = (
android.close(),
fridaInstrumentation.closeAll(),
wasmArtifact.close(),
packetCapture.close(),
apktool.close(),
jeb.close(),
adbDevice.close(),
@@ -384,6 +394,13 @@ export const createServer = (
for (const result of results)
if (result.status === "rejected") throw result.reason;
};
registerCaptureTools(
server,
packetCapture,
toolLogger,
recordEvidence,
analysisAdmission,
);
registerConfiguredAnalysisTools(
toolContext,
android,