Wireshark Cheatsheet
Following Streams
Use this Wireshark reference while you build software engineering projects, review code, or refresh the syntax you reach for most.
Follow a Conversation
Right-click any packet → Follow → pick a protocol, or use
Analyze → Follow → TCP Stream. Wireshark reassembles the byte stream in both
directions and drops a tcp.stream eq N filter into the bar.
| Follow option | Reassembles | Filter it applies |
|---|---|---|
| TCP Stream | One TCP connection, both directions | tcp.stream eq N |
| UDP Stream | One UDP 5-tuple | udp.stream eq N |
| DCCP Stream | One DCCP connection | dccp.stream eq N |
| TLS Stream | Decrypted TLS application data | tls.stream eq N |
| HTTP Stream | Request and response bodies, dechunked and un-gzipped | tcp.stream eq N |
| HTTP/2 Stream | One HTTP/2 stream inside the connection | tcp.stream eq N and http2.streamid eq M |
| QUIC Stream | One QUIC stream, needs keys | quic.connection.number eq N |
| WebSocket | Message payloads, unmasked | websocket on the stream |
| SIP Call | Signalling for one call | sip.Call-ID based |
Colors in the follow window: red is client to server, blue is server to client. The dropdown at the bottom switches to one direction only, which is what you want when reading a protocol transcript.
Output Modes
| Mode | Shows | Use for |
|---|---|---|
| ASCII | Printable text, dots elsewhere | HTTP, SMTP, FTP, Redis, anything line-based |
| UTF-8 | Same but decodes multibyte text | Non-Latin payloads |
| C Arrays | char peer0_0[] = {…} | Pasting into a test harness |
| EBCDIC | Mainframe encoding | 3270 and IBM traffic |
| Hex Dump | Offsets, hex, ASCII columns | Binary protocols, framing bugs |
| Raw | Hex with no formatting | Copy out and decode elsewhere |
| YAML | Structured per-chunk with peer and timestamps | Scripted parsing |
Save as… writes the current mode to a file. In Raw mode that gives you the
exact bytes back, which is the way to extract a file that Wireshark has no
dissector for.
# Same thing from the command line, no GUI tshark -r cap.pcapng -z follow,tcp,ascii,0 -q tshark -r cap.pcapng -z follow,tcp,hex,1 -q tshark -r cap.pcapng -z follow,http,ascii,3 -q tshark -r cap.pcapng -z "follow,tcp,raw,10.0.0.5:54321,93.184.216.34:80" -q
The stream selector takes three shapes: ip:port,ip:port, a bare stream index,
or stream,substream for multiplexed transports like HTTP/2 and QUIC. Stream
indices are zero-based, so follow,tcp,ascii,1 is the second connection.
Finding the Stream You Want
You rarely know the stream index up front. Work backwards from something you can search for.
# Every stream index with the ports and byte counts tshark -r cap.pcapng -q -z conv,tcp # Streams that carried a given hostname, then follow one tshark -r cap.pcapng -Y 'http.host == "api.example.com"' \ -T fields -e tcp.stream | sort -un # Streams that saw a reset tshark -r cap.pcapng -Y "tcp.flags.reset == 1" \ -T fields -e tcp.stream | sort -un # The stream carrying a string anywhere in the payload tshark -r cap.pcapng -Y 'tcp contains "authorization"' \ -T fields -e tcp.stream | sort -un
In the GUI, Ctrl+F opens Find Packet. Set it to search Packet bytes for a
String and it will land you on the frame, then follow from there. Searching
Packet details for a string matches the dissected field text instead, which is
better for finding a status code or a header name.
Reassembly and Its Limits
Following a stream depends on TCP reassembly, and reassembly depends on having all the segments.
- Missing segments show as [Packet size limited during capture] or a gap in
the follow window. A short snaplen (-s 96) truncates payload, so the follow
window will be mostly empty even though the packet list looks complete.
- Out of order and retransmitted segments are handled, and duplicate bytes
are not shown twice. Run reordercap first if timestamps are shuffled by a
multi-interface merge.
- A capture that starts mid-connection has no SYN, so Wireshark does not know
the initial sequence number and relative sequence numbering is off. Check
tcp.completeness to see whether a stream has SYN, data, and FIN.
- Compression and chunking are undone for HTTP but not for arbitrary
protocols. Follow HTTP Stream, not TCP Stream, when the body is gzipped.
- TLS shows ciphertext unless keys are loaded. Follow TLS Stream after
setting up a key log file, see the TLS decryption topic.
Preferences that change what you see, under Preferences → Protocols:
| Preference | Default | Effect |
|---|---|---|
| TCP → Allow subdissector to reassemble TCP streams | on | Off shows one packet per segment, useful for framing bugs |
| TCP → Relative sequence numbers | on | Off shows raw ISN-based numbers |
| TCP → Calculate conversation timestamps | off | Turn on to get tcp.time_delta |
| TLS → Reassemble TLS records spanning multiple TCP segments | on | Needed for large certificates |
Extract Files and Objects
Reassembled payloads can be carved out whole. File → Export Objects lists every
object the dissector recovered, with its host, content type, size, and filename.
| Protocol | GUI path | CLI |
|---|---|---|
| HTTP | Export Objects → HTTP | --export-objects http,dir |
| SMB / SMB2 | Export Objects → SMB | --export-objects smb,dir |
| TFTP | Export Objects → TFTP | --export-objects tftp,dir |
| FTP data | Export Objects → FTP-DATA | --export-objects ftp-data,dir |
| X.509 certificates | — | --export-objects x509af,dir |
| DICOM | Export Objects → DICOM | --export-objects dicom,dir |
| IMF (email) | Export Objects → IMF | --export-objects imf,dir |
mkdir -p out
tshark -r cap.pcapng --export-objects http,out -q
ls outFor a protocol with no export support, select the reassembled bytes in the packet
detail pane, right-click → Export Packet Bytes and save. Pick the reassembled tab at the bottom of the byte pane, not the
single-frame tab, or you get one segment instead of the whole payload. The full
protocol list is tshark --export-objects help.
Exported objects come from untrusted traffic. Treat anything you carve out of a capture as hostile input and do not open it on the analysis machine.