Incident response has an awkward habit. Someone needs a quick look at a packet capture, a Windows Security log or a suspicious .msg file, there's no Wireshark on the laptop, and the file ends up in an online "viewer" that keeps a copy on its server.

I built LocalSecTools so those files never leave the browser tab, which meant writing every parser myself in TypeScript. This week I extracted them into an MIT library, browser-forensics-parsers (GitHub · npm). This post covers what it parses, how to use it, and the design choices that made it reusable.

What does browser-forensics-parsers parse?

Six formats that responders and sysadmins handle every week, each behind its own import path. The whole library is plain TypeScript on standard Web APIs (DataView, TextDecoder, DecompressionStream, Web Crypto).

Import Formats
browser-forensics-parsers/pcap libpcap and pcapng: ARP, IPv4/IPv6, TCP/UDP/ICMP, DNS, TLS ClientHello (version + SNI), HTTP/1.x
browser-forensics-parsers/evtx Windows .evtx, plus wevtutil XML and Get-WinEvent JSON exports
browser-forensics-parsers/email Outlook .msg and .eml
browser-forensics-parsers/dmarc DMARC aggregate reports as .xml, .gz or .zip
browser-forensics-parsers/har HAR files, with a secret scanner and a redactor
browser-forensics-parsers/hash SHA family and HMAC (Web Crypto), MD5, MD4, NTLM, CRC32, optional bcrypt

It has no runtime dependencies and makes no network calls, so the same code runs in a browser tab, Node 20+, Deno and Bun.

npm install browser-forensics-parsers 

How do you triage a packet capture in the browser?

Parse the file into raw packets, dissect each one, then run the built-in triage rules. The rules flag SYN scans, cleartext credentials, weak TLS versions and ARP anomalies.

import { parseCapture, dissect, triage } from 'browser-forensics-parsers/pcap'; const cap = parseCapture(await file.arrayBuffer(), 250_000); // optional packet cap const packets = cap.packets.map((p) => dissect(p).info); for (const finding of triage(packets)) { console.log(finding.severity, finding.title); } 

parseCapture detects pcap or pcapng from the magic number, so you don't need to know which one you were given. If you'd rather click than code, the same parser runs the offline PCAP, HAR and EVTX analyzer.

How do you read a Windows .evtx log without Event Viewer?

Pass the file's bytes to parseEvtx, then hand the events to triageEvents. The triage step looks for patterns such as failed logon bursts, new services and cleared logs.

import { parseEvtx, triageEvents } from 'browser-forensics-parsers/evtx'; const log = parseEvtx(await file.arrayBuffer()); console.log(log.events.length, triageEvents(log.events)); 

If someone sends you an export instead of the binary file, parseEventXml reads wevtutil qe Security /f:xml output and parseEventJson reads Get-WinEvent | ConvertTo-Json. All three return the same shape, so the triage code doesn't change.

How do you check who really sent an email?

Parse the .msg or .eml file, then read the authentication results and the Received hops. Both formats come out as the same ParsedEmail object.

import { parseMsg, parseEml, parseAuth, parseHops } from 'browser-forensics-parsers/email'; const bytes = new Uint8Array(await file.arrayBuffer()); const mail = file.name.endsWith('.msg') ? parseMsg(bytes) : parseEml(bytes); console.log(parseAuth(mail)); // SPF, DKIM and DMARC results console.log(parseHops(mail)); // each Received hop, with the delay between them 

A .msg file is an OLE compound file, which is a small FAT file system with its own directory tree, so most email libraries skip it. This one reads it directly. The browser-based EML and MSG viewer is built on the same code.

How do you clean a HAR file before sharing it?

Scan it with findSecrets, then export a copy with redactHar. Cookies, auth headers, tokens in URLs and JWTs are replaced with [REDACTED].

import { parseHar, findSecrets, redactHar } from 'browser-forensics-parsers/har'; const har = parseHar(await file.text()); console.log(findSecrets(har)); // what would leak const { har: clean } = redactHar(har); // safe to attach to a support ticket 

The redactor keeps header and parameter names and replaces only the values. The support engineer can still see that an Authorization header was sent, without seeing the token.

What about DMARC reports and file hashes?

reportText unpacks .xml, .gz or .zip reports, and hashFile hashes files of any size for MD5 and CRC32. Neither needs a compression or crypto library.

import { reportText, parseAggregate, summarize } from 'browser-forensics-parsers/dmarc'; import { hashFile } from 'browser-forensics-parsers/hash'; const xml = await reportText(new Uint8Array(await report.arrayBuffer())); console.log(summarize([parseAggregate(xml)])); // per-source pass rates and alignment findings console.log(await hashFile(file, ['SHA-256', 'MD5', 'CRC32'])); 

For a walkthrough of the report fields themselves, see how to read a DMARC XML aggregate report. The client-side DMARC report analyzer and the local file hash generator wrap these two modules.

What made the parsers easy to extract?

They were pure functions from the start: no DOM, no fetch, no framework imports. That rule existed for testing, but it meant the extraction was mostly copying folders. Only three imports pointed outside them.

A few other choices carried over well:

  • One package, six entry points. Each format has its own subpath export and the package is marked sideEffects: false, so importing /dmarc doesn't pull in the pcap dissector.
  • bcrypt is optional. It's the only algorithm that needs a real implementation, so bcryptjs is an optional peer dependency, loaded with await import() only when you ask for a bcrypt hash.
  • Synthetic samples ship with the code. buildSamplePcap(), buildSampleEventXml(), SAMPLE_DMARC_XML and buildSampleHar() generate realistic evidence using documentation IP ranges and fake keys. They power the site's "Load sample" buttons, the tests, and anyone's demo.
  • Tests against published vectors. The hash tests use the classic "abc" vectors and RFC 4231 for HMAC. CI runs the suite on Node 20, 22 and 24.

What are the limits?

Files are parsed from one in-memory buffer, so the largest file you can open depends on available RAM. Here is what that means in practice:

  1. parseCapture and parseEvtx accept a cap on packets and events, so a huge file can't freeze the tab.
  2. Web Crypto digests need the whole input at once, so hashFile declines SHA digests above 2 GB. MD5 and CRC32 read the file in 8 MB slices and have no such limit.
  3. The packet dissector covers the protocols in the table, not Wireshark's thousands. Other traffic is listed with its link type and length.

Try it and break it

The most useful contribution is a sample file that makes a parser fail. Please make it synthetic, or scrub it first.