pqsniff
A tiny Rust binary for Linux and OpenWrt routers that shows which TLS and QUIC connections on your network actually use post-quantum key exchange, device by device.
License: MIT
A small static binary that sits on your router, reads the parts of every TLS and QUIC handshake that are still sent in the clear, and writes one JSON line per connection: which key-exchange groups the device offered, which one the server picked, and whether that connection is protected by a post-quantum hybrid like X25519MLKEM768.
Why
When I put a DPI agent on my home router to see what TLS my house speaks, the one question the post couldn’t answer was the one the news was about: how many of these connections are already post-quantum? The agent saw the handshakes but never reported the negotiated group, and half the traffic was QUIC, which it couldn’t read at all.
Server scanners tell you what a site supports. I wanted what my devices actually negotiated, connection by connection. Commercial network monitors sell that as an enterprise feature, but it only needs two messages that are sent in plain text, so I wrote it from the RFCs.
How it works
- Capture: a Linux packet socket with a kernel BPF filter that only lets handshake packets through. Video streams and other bulk traffic never reach userspace.
- TCP: reassembles each handshake (a post-quantum ClientHello is about 1.8 KB, so it spans two packets) and reads the ClientHello and ServerHello.
- QUIC / HTTP/3: Initial packets are encrypted, but with keys anyone can derive from public values (RFC 9001). pqsniff decrypts them and reassembles the CRYPTO frames, which browsers deliberately send out of order.
- Extras: JA4 client fingerprints, and on TLS 1.2 the server certificate with expiry, hostname and self-signed checks.
- Then it forgets: once the hellos are read, the connection’s buffers are dropped. Nothing past the handshake is kept.
Notable pieces
One line per connection:
{
"proto": "quic",
"client": "192.0.2.10",
"sni": "www.example.com",
"offered": ["X25519MLKEM768", "x25519", "secp256r1"],
"key_share": ["X25519MLKEM768", "x25519"],
"tls": "1.3",
"chosen": "X25519MLKEM768",
"pq": true,
"ja4": "q13d0311h3_55b375c5d22e_f2a83c8e78ae"
}
Install and run it:
cargo install pqsniff # or a static binary from the GitHub releases
sudo ./pqsniff -i eth0 -s 30 # OpenWrt: -i br-lan
sudo ./pqsniff -i eth0 -d /var/log/pqsniff # hourly files, as a service
pqsniff -r capture.pcap # offline, any OS
Ask it questions with jq:
# how much of my traffic is post-quantum?
jq -s 'map(select(.tls)) | {connections: length, pq: (map(select(.pq)) | length)}' /tmp/pqsniff/*.jsonl
# which servers turn down a post-quantum offer?
jq -r 'select(.client_pq and .tls == "1.3" and (.pq | not)) | .sni' /tmp/pqsniff/*.jsonl | sort | uniq -c | sort -rn
What it found at home
On my network, about 78% of connections were already post-quantum: 95% over HTTP/3, 65% over plain TCP. Phones and browsers offer it everywhere; the holdouts are servers that turn the offer down, a few work tools that never offer it, and the usual IoT gadgets. It also caught a security camera calling its vendor’s cloud by bare IP with a certificate that doesn’t match and is about to expire.
Small by design
- One static binary, about 470 KB, no libpcap, no tcpdump. Builds for 64- and 32-bit ARM (every Raspberry Pi included) and x86_64 with no cross toolchain.
- Cheap to leave on: on my router it used about 0.15% of one CPU core and half a megabyte of memory.
- Checked against things it didn’t write: the QUIC key vectors from RFC 9001, a JA4 known answer, OpenSSL’s own reports for post-quantum, classic and retry handshakes, and badssl.com’s broken certificates.
What’s next
A view mode that renders the stream as a live terminal dashboard, and ready-made lnav and DuckDB recipes for summaries.