Skip to content

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

Merged
N0zoM1z0 merged 3 commits into
mainfrom
feat/tshark-analysis-2130-20261012
Oct 12, 2026
Merged

N0zoM1z0 merged 3 commits into
mainfrom
feat/tshark-analysis-2130-20261012

Conversation

@N0zoM1z0

@N0zoM1z0 N0zoM1z0 commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Inspect caller-selected fields in an existing packet capture through shared CLI/MCP workflows. This replaces #2130, credited to Olorinm, with current-main integration, bounded delivery and cleanup regressions. There is no linked issue.

Problem and expected behavior

Analysts need offline network/USB/Bluetooth field inspection without opening an active binary or acquiring traffic. Selecting two fields from a real 12,023-frame capture previously returned about 1.10 MB of text. The default now returns 50 matching frames with original frame numbers and explicit coverage; callers can page or request all remaining matches.

Change and scope

Linux-only TShark 4.x provider; caller supplies absolute REA_TSHARK_COMMAND and trusted util-linux prlimit. Fields, display filter, decode-as, input-packet limit and pass mode remain caller-selected. Paging happens after dissection and filtering, preserving two-pass/reassembly semantics. MCP match_limit: null and CLI --all_matches explicitly request full output; conflicting CLI options are rejected before effects.

Use existing process supervision, artifact descriptor ownership, session admission and Evidence delivery. Admit one inspection at a time and return retryable capacity errors instead of accumulating work. Failed descriptor/process/private-file cleanup remains owned for retry, including shutdown. Source bytes are copied privately and never passed directly to TShark.

Contract and boundary impact

  • Semantic owner: shared domain schemas and PacketCaptureService; TShark owns producer parsing, resource supervision and artifact identity.
  • Contribution scope: offline inspection of caller-selected existing data. Maintainer explicitly requested this recorded-only feature; target execution/injection/mutation/protection recovery decision is not applicable.
  • CLI/MCP: inspect-packet-capture / inspect_packet_capture, selected fields required. Default match_limit: 50, match_offset: 0; output_window reports matching/returned counts and has_more within the input read scope.
  • Compatibility: Linux with TShark 4.x and util-linux; other hosts fail before analysis. Missing provider configuration has actionable discovery diagnostics.
  • Evidence: source/tool/limiter paths and digests, source size, exact selections/argv, version banner, warnings, typed repeated fields, coverage, limits and explicit hardware-acquisition status. Completed observations survive late cancellation/cleanup errors in the session.
  • Authority/cleanup: read existing captures; launch an owned local analyzer; write private temporary copies/configuration. No live capture or device communication.
  • Generated/install impact: authored guides, skill and contract catalog sources updated. Ignored catalogs/build outputs are regenerated, not committed. No new npm dependency or installer behavior.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process (launch owned analyzer).
  • Change files or configuration (private temporary workspace only).

Evidence and regression coverage

  • Reproduced admission-after-close, excess admission and retained descriptor-close failures against the imported implementation before fixing them. Descriptor tests cover capture, executable, limiter and kernel report; successful retry returns descriptor counts to baseline.

  • Real compiled CLI/MCP verifier: 15 cases on Debian 12 / TShark 4.0.17, including generated Ethernet/DNS/Bluetooth HCI recordings, field repetition/omission, filters, decode-as, both pass modes, input prefix before filter, output paging/full selection, schemas, errors, persistence, identity and cleanup.

  • Additional real data: pinned Wireshark 4.0.17 HTTP PCAP and DNS/ICMP PCAPNG; owned HTTP server/curl recording; a real recording of 1,000 owned HTTP requests (1,526,684 bytes / 12,023 frames). Known request URIs and source SHA-256 checked independently. Full packet arrays exactly match the imported implementation; bounded results exactly match their prefixes.

  • Representative result: output_window: { matching_packets: 12023, returned_packets: 50, has_more: true }, with original frame.number values and selected fields.

  • Proof gaps: TShark versions beyond verified 4.0.17/4.2.2, other platforms, USB, BLE ATT and physical hardware are not established by these tests. Fixture Bluetooth HCI is not a hardware claim. Installed global plugins/libraries/configuration are trusted and not fully fingerprinted.

  • Observed, derived and inferred claims remain distinguishable.

  • Artifact identity, provenance and failed attempts remain preserved.

  • Unsupported/incomplete outcomes remain visible.

Validation performed

  • npm run test:focused -- ten capture/CLI/MCP/kernel/capability/effect/schema files — 79 passed on synchronized main.
  • REA_TSHARK_COMMAND=/usr/bin/tshark node scripts/verify-packet-capture.mjs — 15 real CLI/MCP cases passed locally after synchronization; Ubuntu 24.04 CI / TShark 4.2.2 also passed all 15 cases and all 47 provider-boundary tests.
  • npm run check, npm run docs:check, npm run verify:test-discovery — all passed again on synchronized main.
  • SDK-converted advertised schemas validated by the final integrated tool-schema suite.

Performance: three repetitions per case, warm MCP process, new TShark process each call, two CPU cores, 8 GiB family RSS guard. No filesystem-cache flushing. On the 12,023-frame recording, selected two-field response text went from 1,099,961 to 9,541 bytes; latency from 1.66–2.00 s to 1.22–1.41 s. Explicit full output remains available (1,100,118 bytes; 1.63–1.99 s). Filtered 1,000 HTTP requests return 50 by default (144,124 to 12,137 text bytes; 1.05–1.21 s). The nine-call optimized run peaked at 868.68 MiB family RSS; all guarded work stayed below 8 GiB.

For the task of inspecting the first 50 frames, o200k_base estimates including one common current capture-tool definition, one request and measured response text are 449,644 before paging versus 7,633 after. The common definition contributes 4,266 tokens to both comparisons. These are tokenizer estimates, not billed usage; other tool catalogs, prompt conversion, agent reasoning and subsequent calls are unmeasured. No cache claim is made; later pages repeat dissection and remain subject to producer limits.

Compatibility, safety, and release

New feature; no previously released capture-tool call changes. Input <=32 MiB, combined producer stdout/stderr <=4 MiB, 30-second deadlines, enforced 1 GiB address space / 64 MiB file / 30 CPU-second ceilings per producer; stricter inherited limits are preserved. Paging bounds delivery but does not bypass producer-output limits. This is not an OS sandbox or an aggregate filesystem/memory quota. Unsupported authority remains refused.

Before merge

  • Concrete agreed enhancement and resolved material scope.
  • Focused outcome and Conventional Commit title.
  • Original PR linked; no linked issue exists.
  • Observable behavior and meaningful failure paths covered.
  • Owning docs/contracts/generated sources updated.
  • Representative CLI/MCP output included.
  • Final diff checked for secrets, unrelated changes and unsupported claims.
  • Final synchronized validation and applicable CI/review findings checked.

Final CI: all 38 checks passed for 8a049dfc82171c798601eb9b88606eed003a380c, including required CI, real TShark, six full test shards, coverage, static/docs/workflow checks and all native package lanes. Automatic Codex review did not execute because repository review credits were exhausted; it supplied no code findings. Own source inspection, regression reproduction and real-provider verification were completed.

Merged as f611d8ce722cd36345e9ff83b9669ef2e7fe57a9.

N0zoM1z0 and others added 3 commits October 12, 2026 19:20
Integrate the recorded-only Linux provider from #2130 on current REA
contracts, preserving selected fields, two-pass analysis and Evidence.

Co-authored-by: Olorinm <[email protected]>
Exercise real descriptor ownership for capture, executable, limiter and
kernel-report close failures. Refuse new work until cleanup can succeed
and prove that repeated shutdown releases every retained handle.

Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
@N0zoM1z0 N0zoM1z0 self-assigned this Oct 12, 2026
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@N0zoM1z0
N0zoM1z0 merged commit f611d8c into main Oct 12, 2026
38 checks passed
@N0zoM1z0
N0zoM1z0 deleted the feat/tshark-analysis-2130-20261012 branch October 12, 2026 19:35
@github-actions github-actions Bot mentioned this pull request Oct 12, 2026
3 tasks done
@morluto morluto added enhancement New feature or request area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added area: runtime Process capture and runtime observation provider: tshark Analysis provider / engine: tshark labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: runtime Process capture and runtime observation enhancement New feature or request provider: tshark Analysis provider / engine: tshark

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants