Network Traffic Analysis: Deep Packet Inspection with Wireshark

Where Nmap tells you what doors and services are open on a network, Wireshark allows you to see every single byte moving across the wire in real time. As the world's foremost open-source packet analyzer, Wireshark captures raw frames from network interface controllers (NICs) and decodes hundreds of protocols down to individual header bits, making it indispensable for network troubleshooting, malware traffic analysis, and digital forensics.

How Packet Sniffing Works: Promiscuous Mode

Under normal operating conditions, a computer's network interface card operates in Non-Promiscuous Mode: it inspects the destination MAC address of incoming frames and immediately discards any frame not addressed specifically to its own hardware MAC or broadcast address. When Wireshark begins capturing, it switches the NIC into Promiscuous Mode, instructing the hardware to capture all network frames traversing the local physical link regardless of destination.

Top Wireshark Display Filters for Security Analysts

Raw packet captures often contain hundreds of thousands of frames. Display filters allow analysts to slice through noise and pinpoint suspicious activity instantly:

Filter Expression Defensive / Forensic Purpose
http.request.method == "POST" Isolates all outgoing HTTP form submissions, login attempts, and file uploads.
tcp.flags.syn == 1 && tcp.flags.ack == 0 Shows all initial connection requests; rapid bursts from a single IP indicate port scanning or SYN flooding.
dns.flags.response == 0 Filters all outbound DNS queries; detects anomalous DGA (Domain Generation Algorithm) malware domains.
ip.addr == 192.168.1.50 Displays all traffic where the specified host is either the sender or receiver.
tcp.port == 21 || tcp.port == 23 Audits insecure, cleartext legacy protocols (FTP and Telnet) where passwords travel in plain text.
frame contains "password" Conducts full-packet payload string search for cleartext credentials and secrets.

The Power of "Follow TCP Stream"

Raw packet logs can be disorienting because individual packets appear interleaved out of order. Wireshark's Follow TCP Stream feature reassembles TCP sequence numbers and displays the entire human-readable bidirectional conversation in a single clean window:

Exposing Cleartext HTTP Credentials in Wireshark

POST /login.php HTTP/1.1
Host: testphp.vulnweb.com
User-Agent: Mozilla/5.0
Content-Type: application/x-www-form-urlencoded

uname=admin&pass=SuperSecretPassword2026

HTTP/1.1 200 OK
Set-Cookie: session_id=98a7bc34ef12; Path=/

Notice how cleartext HTTP exposes both the user's password and sensitive session cookies to anyone sniffing on the same Wi-Fi network. This demonstrates why HTTPS (TLS 1.3) is mandatory everywhere!

Command-Line Sniffing: tshark and tcpdump

On headless production Linux servers without a graphical interface, administrators capture packets using tcpdump or Wireshark's CLI tool tshark:

# Capture 100 packets on eth0 and save to pcap file
sudo tcpdump -i eth0 -c 100 -w capture.pcap

# Inspect live HTTP POST requests using tshark
sudo tshark -i eth0 -Y 'http.request.method == "POST"' -T fields -e ip.src -e http.request.uri

Frequently Asked Questions (FAQ) - Student & Interview Review

Q1. Can Wireshark decrypt encrypted HTTPS (TLS) traffic?

Wireshark cannot decrypt TLS traffic by default. However, if you are conducting authorized debugging and configure your browser with the SSLKEYLOGFILE environment variable, Wireshark can read the ephemeral pre-master secret keys and decrypt the application payload.

Q2. What is the difference between a Capture Filter and a Display Filter?

A Capture Filter (written in Berkeley Packet Filter / BPF syntax, e.g. 'port 80') limits what packets are saved to disk during recording. A Display Filter is applied after capture to search and filter through already recorded packets.

Explore Related Cybersecurity Tutorials & Next Steps

Broaden your defensive and offensive security knowledge across our curriculum:

Port Scanning & Nmap Mastery

Verify stealth scanning packets and service detection probes in Wireshark.

TLS 1.3 Handshake Protocol

Analyze the TLS ClientHello, ServerHello, and certificate exchanges in pcap.

OSI & TCP/IP Layer Weaknesses

Diagnose ARP spoofing and unencrypted protocol traffic (HTTP/FTP).

40+ Hands-on Cybersecurity Labs

Wireshark lab challenges capturing credentials and isolating suspicious beacons.

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Reddit

You may also like this!