brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: tcpdump -r reads a saved capture and filters it like a live one

Security
~/tips/tip-tcpdump-r-read-capture

tcpdump -nn -r capture.pcap port 53

Open a saved packet capture in tcpdump and filter it with the usual expressions

A packet capture is only useful once you can read it, and you don’t always have Wireshark on the machine that holds the file.

tcpdump can replay a capture file:

tcpdump -nn -r capture.pcap port 53

-r reads from the file instead of the network, and -nn keeps addresses and ports as numbers. The filter at the end works as on a live capture, so host 192.0.2.10, tcp and port 443 or icmp all narrow the output. Add -c 20 to stop after 20 packets.

You can also write a smaller file from a big one: tcpdump -r big.pcap -w dns.pcap port 53 saves only the DNS packets for later.

A caveat: a capture can hold passwords and private data, so treat the file like a secret. And reading needs no root, but capturing does, so you can analyse a file on a normal account.

Further reading: tcpdump man page

More Security tips mkcert -install Strict-Transport-Security: max-age=0 Referrer-Policy: strict-origin-when-cross-origin wp super-admin list getent group sudo adm docker lxd All Security tips (79) All topics

Link