#13284
[Feature] Single-pass tshark pipelines in PCAP, streaming snapshots and pooled workers in SQLite, and single-pass indexing in IL2CPP/WABT
Before submitting
- I searched for existing feature requests.
- I read CONTRIBUTING.md so the request fits REA's local-only scope.
Area
Format Providers: PCAP, SQLite, IL2CPP Binary Registration & WABT (src/pcap/, src/sqlite/, src/il2cpp/, src/wasm/)
Current limitation
Source-derived findings across four binary/format providers:
- Redundant second
tsharkpass & before/after 64 MiB tool executable re-hashing in PCAP (src/pcap/PcapProvider.ts:322-370, 415-432, 1137-1190,src/pcap/PcapSnapshot.ts:171-240):PcapProvider.#runcallsthis.readToolIdentity(line 322), which reads and hashes up to 64 MiB of the Wireshark binary (tshark/capinfos) both before (line 366) and after (line 417) every single command invocation (version,capinfos, primarytshark, and secondarytshark).- On
inspect_pcap_capture, after running the full packettsharkpass, lines1152-1174launch a second fulltshark -r snapshot.path -T json ... -Y "dns || mdns || llmnr" -x -J "frame dns mdns llmnr"pass over the entire capture file instead of extracting required fields in one streaming pass. PcapSnapshot.ts:174-199copies captures in 64 KiB JS chunks rather than using larger buffered transfers or APFS/Linux CoW clones (when digest is already computed or verified in one stream).
- Whole-file buffering + cold worker per SQLite inspection (
src/sqlite/SqliteDatabaseProvider.ts:277-302,src/sqlite/SqliteDatabaseSnapshot.ts:380-413):- Every
inspect_sqlite_databasecall reads the entire SQLite DB (and-walif present) into a JSBufferviareadMember(SqliteDatabaseSnapshot.ts:381), writes it out todatabase.snapshot(line 386), and spawns a cold worker process (SqliteDatabaseProvider.ts:286) even for small read-onlyinventory/ shortrow_limitqueries.
- Every
- Remaining O(N) full-binary pointer-struct scan in IL2CPP (
src/il2cpp/Il2cppBinaryRegistration.ts:217-231, 354-380):- While PR #13272 optimizes
ripRelativeReferencesandarm64PageReferencesexecutable scans,findCodeRegistration(lines 354-380) still walks every 8-byte aligned offset across all container mappings callingreadUInt32andreadSlotper 8-byte slot before checking relocation overlays/mappings.
- While PR #13272 optimizes
- Triple WABT subprocess chain + O(N²) S-expression re-splitting (
src/wasm/WabtArtifactProvider.ts:265-305, 604-608,src/wasm/WabtInterface.ts:81-125, 285-320):WabtArtifactProviderexecutes three separate subprocesses sequentially (wasm-validate,wasm-objdump,wasm2wat;lines 604-608), andWabtInterface.tsparses WAT declarations by repeatedly invokingsplitParts(form)per form, type, parameter, and export (lines 87, 94, 96, 286, 290) while retaining fullwat_formstrings (line 312).
Use cases
- Analyzing multi-hundred-MB
.pcapngcaptures withinspect_pcap_capture. - Interactive multi-page browsing (
row_offset/row_limit) of large SQLite databases withinspect_sqlite_database. - Analyzing 100+ MB
libil2cpp.so/GameAssembly.dllor multi-megabyte.wasmmodules.
Desired outcome and success criteria
Applying DDIA principles (single-pass streaming, OS-level file snapshots / streaming copy, single-pass parsing & indexing):
- PCAP: Combine DNS/mDNS/LLMNR hex/frame extraction with the primary
tsharkstream (or usetshark-T ek/ field projection in a single streaming pass) and rely on verified open-file/executable stat+descriptor identity across commands in the same run rather than hashing the 64 MiBtsharkbinary up to 8 times per capture inspection. - SQLite: Stream database/WAL files directly to
database.snapshotwithout holding the entire multi-hundred-MB DB in Node heapBuffer, and evaluate a reusable isolated read-only worker across read queries. - IL2CPP: Build a fast raw-byte/slot filter on
!loaded && littlemappings infindCodeRegistration's primary struct loop (lines 354-380, matching PR #13272's executable-scan design and checking alignment/expectedmodules.lengthword directly via byte/u32 checks beforeBigIntslot arithmetic). - WABT: Parse core WASM binary sections directly for export/import/type interfaces or tokenize WAT once via a single-pass structural lexer instead of per-node
splitParts()calls.
Expected interaction with targets
- Read existing files or captured data (local
.pcap/.sqlite/ELF/Mach-O/PE/.wasmfiles and private snapshots).
Target and scope details
- Covers
src/pcap/,src/sqlite/,src/il2cpp/, andsrc/wasm/. - Preserves all WABT diagnostic limits, SQLite consistency/WAL admission invariants, PCAP
capinfos/tsharkcount cross-checks, and IL2CPP unknown/unresolved relocation semantics.
Verification available so far
- Source code analysis of REA only.
Verification details
Requires validation with:
npm run verify:pcapnpm run verify:il2cpp:metadatanpm run verify:wasm:artifact,npm run verify:wasm:interface-comparison,npm run verify:wasm:package- SQLite boundary suites (
tests/boundary/sqlite/).
Alternatives considered
- Adding result caches in front of
PcapProviderorWabtArtifactProvider: leaves cold single-file runs paying 2×tsharkpasses and 8× binary hashing; unifying passes and streaming snapshots helps cold calls immediately.
Possible direction
- Stream
SqliteDatabaseSnapshotcopy-and-hash (readArtifactFileChunks->Transformsha256 ->WriteStream) instead of allocatingcaptured.bytesin JS heap. - Extend PR #13272's raw-slice count pre-filter to
findCodeRegistrationlines356-362(with relocation overlay fallback). - Replace repeated
splitParts()calls inWabtInterface.tswith a cursor-based S-expression tokenizer.
References
- Follow-up to PR #13272 (IL2CPP executable scan) and PR #13274 (SQLite decoders & short-page truncation)
src/pcap/PcapProvider.ts:322-432, 1137-1190src/pcap/PcapSnapshot.ts:171-240src/sqlite/SqliteDatabaseProvider.ts:275-305src/sqlite/SqliteDatabaseSnapshot.ts:380-413src/il2cpp/Il2cppBinaryRegistration.ts:217-231, 347-380src/wasm/WabtArtifactProvider.ts:265-305, 604-608src/wasm/WabtInterface.ts:81-125, 285-320
Activity
0No activity yet.