# Edit & Sanitize a .pcap File Before Sending It to Vendor Support

> **FrameAssembly v3.3.0** · Operational Playbook (Sanitize PCAP & CI/CD) · Canonical URL: https://frameassembly-lang.dev/use-cases/edit-sanitize-pcap

incident.pcap -> reverse -> Ctrl+H edit & redact -> clean.pcap without slicing off the actual Layer 7 bug.

- **Category:** Sanitize PCAP & CI/CD
- **Capture Filename:** `redacted_radius.frasm` (3 Ethernet frames)
- **Protocols Exercised:** `vlan`, `radius`, `syslog`

## Operational Problem

Vendor support says "attach a packet capture of the outage." Security says "if you upload internal 10.x subnets or real employee usernames to a third-party ticket portal, you’re fired." And tcprewrite chokes the moment you try changing variable-length Layer 7 strings.

Real outage captures are full of things you don’t want leaving the building: internal IP schemes, employee RADIUS/LDAP logins, internal Syslog hostnames, and 4,000 unrelated broadcast packets. Chopping frames at byte 64 with editcap -s 64 hides the PII—right along with the exact Layer 7 bug the vendor needs to see.

Meanwhile, tcprewrite only swaps outer L2/L3 headers because changing "jsmith@secretcorp.internal" to "redacted" changes the packet’s byte length, breaking IP Total Length, UDP/TCP checksums, and every TCP sequence number downstream.

## Scenario & Topology: outage.pcap -> reverse -> Redact RADIUS & Syslog -> redacted_auth.pcap

- **Topology:** `Branch Switch (192.0.2.1, VLAN 100) <-> AAA Server (198.51.100.10)`

Drop an outage .pcap onto /playground (0 bytes uploaded) or run frameassembly reverse, swap private IPs for RFC 5737 documentation space (192.0.2.1 and 198.51.100.10), replace the employee username with "redacted_user", delete stray broadcast lines, and compile a clean 3-frame reproducer.

## FrameAssembly Workflow

Reverses .pcap -> .frasm text, lets you redact L2–L7 fields and trim background chatter, and rebuilds valid lengths + checksums.

### Adapt It for Your Network

1. Run frameassembly reverse outage.pcap redacted.frasm (or drag-and-drop into /playground).
2. Replace internal host IPs/MACs with 192.0.2.x / 198.51.100.x and scrub usernames, SNIs, or hostnames.
3. Rebuild with frameassembly redacted.frasm redacted_auth.pcap and inspect in Wireshark before sharing.

## Runnable Capture Specification (`redacted_radius.frasm`)

```frameassembly
host branch_gw { ip 192.0.2.1     mac 0011.22aa.bb01 }
host auth_srv  { ip 198.51.100.10 mac 0011.22cc.dd10 }

flow redacted_radius_repro(gw, srv) {
    gw -> srv vlan 100 radius accessrequest id 10 user "redacted_user" nasip 192.0.2.1 wait 10ms
    gw <- srv vlan 100 radius accessaccept  id 10 wait 5ms
    gw -> srv vlan 100 syslog facility 1 severity 6 hostname "branch-gw" app "tacacs" msg "User authenticated via 802.1X" wait 2ms
}

compile {
    redacted_radius_repro(branch_gw, auth_srv)
}
```

## Equivalent CLI Commands

```bash
# 1. Convert any existing .pcap or .pcapng into editable .frasm text
frameassembly reverse outage.pcap redacted_radius.frasm

# 2. After editing IPs, VLANs, or strings in .frasm, preview and rebuild to .pcap
frameassembly show redacted_radius.frasm
frameassembly redacted_radius.frasm redacted_auth.pcap

# 3. Verify updated IPs, VLAN tags, and valid checksums in tshark
tshark -r redacted_auth.pcap -V
```

## Protocol Reference Links

- [`vlan` — IEEE 802.1Q Virtual LAN Tagging & 802.1p QoS](https://frameassembly-lang.dev/docs/protocols/vlan) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/vlan.md))
- [`radius` — Remote Authentication Dial-In User Service (Auth & Accounting)](https://frameassembly-lang.dev/docs/protocols/radius) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/radius.md))
- [`syslog` — Syslog Event Logging over UDP or TCP](https://frameassembly-lang.dev/docs/protocols/syslog) ([Raw .md](https://frameassembly-lang.dev/docs/protocols/syslog.md))
