wireshark

๐Ÿ”Ž 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
  • 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

โšก Essential Capture Filters (BPF) โ€” Set these before capturing

๐Ÿ”ด Capture filter๐Ÿงญ Purpose
host 10.0.0.5Capture traffic to/from single IP
net 192.168.1.0/24Capture entire subnet
tcp port 443Capture HTTPS only
udp port 53Capture DNS queries/responses
ether proto 0x0806Capture 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.5Packets to or from IP
tcp.port == 22SSH traffic (port 22)
http.request.method == "POST"Show only HTTP POST requests
dns.qry.name == "example.com"DNS queries for domain
tls.handshake.type == 1TLS Client Hello packets
tcp.analysis.retransmissionTCP retransmissions (problems)

Infographic tip: show side-by-side examples so beginners immediately see the difference.


๐Ÿงญ Quick GUI Workflow (Beginner step-by-step)

  1. Open Wireshark โ†’ Select interface (Ethernet/Wi-Fi). ๐Ÿ–ง
  2. (Optional) Enter a capture filter to limit packets. ๐Ÿ”ด
  3. Click Start and reproduce the issue or traffic you need. โ–ถ๏ธ
  4. Click Stop when done. โน๏ธ
  5. Apply display filters to focus on relevant packets. ๐Ÿ”
  6. Right-click a packet โ†’ Follow โ†’ TCP Stream to reassemble conversations. ๐Ÿ”
  7. 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)

  1. Capture traffic while an authentication attempt runs (or open existing pcap).
  2. Use display filter for relevant service (e.g., SSH): tcp.port == 22 && ip.addr == 10.0.0.5.
  3. Look for suspicious patterns: repeated connections, tcp.analysis.retransmission, or tcp.flags.reset==1.
  4. Follow the TCP stream for payload clues.
  5. 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 link
  • tcp.analysis.duplicate_ack โ†’ retrans issues
  • http.authbasic โ†’ HTTP Basic Auth headers (credentials)
  • frame contains "password" โ†’ rudimentary search for plaintext credentials
  • tls.handshake.ciphersuite โ†’ check negotiated cipher suites
  • dns.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

  • Capture filter (BPF) vs display filter (Wireshark) distinction.
  • Recognize common display filters and what they show (tcp.analysis.*http.requestdns.qry.name).
  • Understand when to use tshark vs GUI.
  • 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.

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


Scroll to Top