Files
Peter Pötzi a2f5814f1f Initial commit
2026-04-10 21:34:16 +02:00

35 lines
1.2 KiB
Markdown

# cits-wireshark-bridge
Node.js script that bridges raw 802.11 packets on NATS into `tshark`, and publishes the decoded JSON back to NATS.
We use it for our opentrafficmap.org project.
## Requirements
- Node.js 18 or newer
- `nats` for Node.js (`npm install`)
- `tshark` installed and available in `PATH`
- A reachable NATS server
## Environment
- `NATS_URL`: NATS server URL, for example `nats://127.0.0.1:4222`
- `NATS_USERNAME`, `NATS_PASSWORD`: optional credentials
- `INPUT_SUBJECT`: subscription subject, default `its.*.packet`
- `OUTPUT_SUBJECT`: fixed publish subject; if unset, the bridge publishes to `<source-subject>.json`
- `OUTPUT_SUFFIX`: suffix used when `OUTPUT_SUBJECT` is unset, default `.json`
- `PCAP_SNAPLEN`: PCAP snapshot length, default `65535`
- `PCAP_LINKTYPE`: PCAP link type, default `105`
- `TSHARK_BIN`: path to `tshark`, default `tshark`
- `TSHARK_PROTOCOL_FILTER`: optional `-J` protocol filter for `tshark`
- `TSHARK_INCLUDE_HEX`: set to `1`, `true`, or `yes` to include hex output
- `VERBOSE`: set to `1`, `true`, or `yes` for extra logging
## Run
```bash
NATS_URL=nats://127.0.0.1:4222 \
INPUT_SUBJECT='its.*.packet' \
node its-bridge.js
```