๐ Wireshark for Beginners: Capture, Filter, and Analyze Network Traffic
๐ What is Wireshark?
Wireshark is the industry-standard network protocol analyzer for capturing and analyzing packet-level network traffic. Ethical hackers, incident responders, and network engineers use it to visualize traffic flows, troubleshoot protocols, and perform packet-level forensics.
Analogy: Wireshark is like an x-ray machine for networks โ it reveals exactly whatโs traveling inside packets so you can diagnose problems and detect malicious behavior.
๐ก๏ธ Why Learn Wireshark First?
- โ Deep packet visibility โ see headers, payloads, and protocol flows.
- โ Essential for incident response & forensics.
- โ Used in CEH labs and real-world investigations.
- โ Free, cross-platform, and scriptable (tshark).
๐ง Capture vs Display Filters โ The Single Most Important Distinction
- Capture filters (BPF syntax) limit which packets are written to disk. Apply before you start capturing. Use capture filters to reduce capture size and avoid capturing irrelevant traffic.
- Example (capture only HTTP):
tcp port 80
- Example (capture only HTTP):
- Display filters (Wireshark syntax) are applied after capture to narrow what you see. They let you analyze specific conversations without re-capturing.
- Example (show only HTTP requests):
http.request
- Example (show only HTTP requests):
โก Essential Capture Filters (BPF) โ Set these before capturing
| ๐ด Capture filter | ๐งญ Purpose |
|---|---|
host 10.0.0.5 | Capture traffic to/from single IP |
net 192.168.1.0/24 | Capture entire subnet |
tcp port 443 | Capture HTTPS only |
udp port 53 | Capture DNS queries/responses |
ether proto 0x0806 | Capture ARP only |
Tip: BPF uses different syntax (libpcap); itโs used in tcpdump/tshark too.
๐ Essential Display Filters (Wireshark syntax) โ apply after capture
| ๐ต Display filter | ๐งญ Purpose |
|---|---|
ip.addr == 10.0.0.5 | Packets to or from IP |
tcp.port == 22 | SSH traffic (port 22) |
http.request.method == "POST" | Show only HTTP POST requests |
dns.qry.name == "example.com" | DNS queries for domain |
tls.handshake.type == 1 | TLS Client Hello packets |
tcp.analysis.retransmission | TCP retransmissions (problems) |
Infographic tip: show side-by-side examples so beginners immediately see the difference.
๐งญ Quick GUI Workflow (Beginner step-by-step)
- Open Wireshark โ Select interface (Ethernet/Wi-Fi). ๐ง
- (Optional) Enter a capture filter to limit packets. ๐ด
- Click Start and reproduce the issue or traffic you need. โถ๏ธ
- Click Stop when done. โน๏ธ
- Apply display filters to focus on relevant packets. ๐
- Right-click a packet โ Follow โ TCP Stream to reassemble conversations. ๐
- Export objects (File โ Export Objects โ HTTP/SMB) to extract files. ๐พ
๐ tshark (CLI) โ capture & automate
tshark is Wiresharkโs CLI โ perfect for automation, servers, and limited GUIs.
Common tshark examples
# Capture 1000 packets on eth0 to file
sudo tshark -i eth0 -c 1000 -w capture.pcapng
# Capture only HTTP packets (BPF capture filter)
sudo tshark -i eth0 -f "tcp port 80" -w http_capture.pcapng
# Read a pcap and show top protocols
tshark -r capture.pcapng -q -z io,phs
# Print only DNS queries from a pcap
tshark -r capture.pcapng -Y "dns.qry.name" -T fields -e dns.qry.name๐ Practical Example โ Find a Failed Login (step-by-step)
- Capture traffic while an authentication attempt runs (or open existing pcap).
- Use display filter for relevant service (e.g., SSH):
tcp.port == 22 && ip.addr == 10.0.0.5. - Look for suspicious patterns: repeated connections,
tcp.analysis.retransmission, ortcp.flags.reset==1. - Follow the TCP stream for payload clues.
- Correlate with server logs (
/var/log/auth.log) โ always combine packet data with system logs.
CEH tip: packet captures often contain credentials or tokens in plaintext โ treat captures as sensitive evidence.
๐งพ Common Forensic Checks
tcp.analysis.retransmissionโ packet loss / unstable linktcp.analysis.duplicate_ackโ retrans issueshttp.authbasicโ HTTP Basic Auth headers (credentials)frame contains "password"โ rudimentary search for plaintext credentialstls.handshake.ciphersuiteโ check negotiated cipher suitesdns.count.queries > Xโ DNS amplification or exfil patterns
โ๏ธ Legal & Privacy Best Practices
- Only capture traffic on networks you own or have written permission to test.
- Packet captures may contain PII and credentials โ encrypt and store securely.
- Use mirrored (SPAN) ports or lab VLANs for non-intrusive capture.
- Redact or restrict access to sensitive fields when sharing captures.
๐ฏ CEH v13 Strategy Checklist
Knowledge (MCQ)
- Capture filter (BPF) vs display filter (Wireshark) distinction.
- Recognize common display filters and what they show (
tcp.analysis.*,http.request,dns.qry.name). - Understand when to use
tsharkvs GUI.
Practical (Hands-on)
- Capture with
tshark -i eth0 -c 500 -w /tmp/cap.pcapng. - Use display filter
http.request.method == "POST" && ip.src == 10.0.0.5. - Reassemble sessions: Follow โ TCP Stream.
- Export objects (HTTP/SMB) for file recovery.
- Hunt anomalies: retransmissions, TLS alerts, oversized frames.
โ Key Takeaways
- ๐ Wireshark shows packet-level truth โ invaluable for forensics and troubleshooting.
- ๐ด Capture filters reduce noise at capture time.
- ๐ต Display filters let you slice and dice captures post-facto.
- ๐งฐ tshark automates captures on servers and scripts.
- ๐ Treat captures as sensitive โ they often contain secrets.
๐ Ready to Go Further in Cybersecurity?
If you enjoyed this guide, youโll love the Back2Skills learning platform, built specifically for beginners who want to understand cybersecurity step by step.
โ Beginner-friendly lessons
โ Real ethical hacking concepts explained simply
โ CEH-aligned cybersecurity training
โ Clear roadmap from basics โ ethical hacker

