Tables of what you want to do and the exact filter that does it.
Remember the golden rule: capture filters use BPFThe capture filter language used by tcpdump, tshark -f, and Wireshark's capture dialog, for example host 10.77.0.20 and port 21. It decides which packets are recorded at all./tcpdump syntax (applied
before capture), display filters use protocol.field syntax (applied
after). They are not interchangeable.
Capture filterA filter applied while capturing, written in BPF. Anything it excludes is never saved. Compare display filter. (BPF)
Only one host
host 10.77.0.10
Only one subnet
net 10.77.0.0/24
Traffic from a source
src host 10.77.0.10
Traffic to a destination
dst host 10.77.0.20
One TCP port
tcp port 80
Two ports (either)
tcp port 80 or tcp port 21
Everything except SSH (avoid capturing your own admin session)
not port 22
One MAC address
ether host aa:bb:cc:11:22:33
Only broadcast/multicast
broadcast or multicast
HTTP + FTP for the lab web/ftp targets
(host 10.77.0.10 and tcp port 80) or (host 10.77.0.20 and tcp port 21)
VLAN-tagged traffic
vlan
ICMP only (ping troubleshooting)
icmp
CLI usage: tshark -i eth0 -f "tcp port 80 or tcp port 21" -w out.pcapng
(eth0 inside the attacker container; br-pentestlab on a native Linux host.)
Precedence trap. In BPF capture filters, and and or have equal
precedence and associate left to right, so
host A and port 80 or host B and port 21 means
((host A and port 80) or host B) and port 21. Always parenthesize mixed
and/or. Wireshark display filters behave differently: and binds
tighter than or, as in most programming languages.
Display filterA Wireshark or tshark -Y filter applied to packets already captured, for example ftp.request.command == "PASS". It hides packets from view but does not delete them.
FTP password (cleartextData sent without encryption, so anyone who can see the traffic can read it. HTTP, FTP, and Telnet send passwords in cleartext.!)
6. Display filters: TLS / HTTPS (metadata even when encrypted)#
Use case
Display filter
All TLS
tls
Client Hello (reveals SNI hostname)
tls.handshake.type == 1
Server Hello
tls.handshake.type == 2
SNI (which site, even over HTTPS)
tls.handshake.extensions_server_name
Certificate messages
tls.handshake.type == 11
Old/weak protocol versions (TLS 1.0)
tls.handshake.version == 0x0301 in a Server Hello (tls.handshake.type == 2): the version the server picked. Not tls.record.version: TLS 1.2/1.3 clients also put 0x0301 in the record layer for compatibility
TLS 1.3 negotiated
tls.handshake.extensions.supported_version == 0x0304 in a Server Hello
DeauthenticationA Wi-Fi management frame that disconnects a client. Sending forged ones forces a client to reconnect so its handshake can be captured. Protected Management Frames block this. frames (the aireplay attack)
wlan.fc.type_subtype == 0x0c
EAPOL / 4-way handshakeThe four EAPOL messages a WPA2 client and access point exchange to prove they share the Wi-Fi password and derive fresh session keys. Capturing it lets you test password guesses offline.
eapol
Traffic for one AP (BSSIDThe MAC address of a Wi-Fi access point's radio. Tools such as airodump-ng use it to tell networks apart, even when two share a name.)
In the Wireshark GUI, View → Coloring Rules lets you flag anything a filter
can match, e.g. turn every http.request.method == "POST" or
ftp.request.command == "PASS" packet bright red so credentials jump out of a
busy capture without retyping the filter.