Skip to content
Pwnversity
TOOL-WIRESHARKintermediate · 4 min · upd. 2026-10

Wireshark

Wireshark is the reference network protocol analyzer: it captures and dissects traffic packet by packet. It’s essential for network forensics, malware/C2 analysis, protocol debugging, and forensics CTF challenges (see Network forensics, Command & Control, Sniffing).

Wireshark captures the traffic of an interface (or opens an existing .pcap/.pcapng) and breaks it down by layers (Ethernet, IP, TCP/UDP, HTTP, TLS…), showing every field of every packet. tshark is its command-line version, ideal for automating and filtering at scale.

  • Analyze network captures in forensics and incident response.
  • Detect and understand malware traffic and C2 channels.
  • Debug protocols and network problems.
  • Solve forensics CTF challenges (extract files, credentials, flags).
Ventana de terminal
sudo apt install wireshark tshark # Kali/Parrot/Debian
# allow capture without root (add your user to the group)
sudo usermod -aG wireshark $USER
# macOS
brew install --cask wireshark

Two kinds of filter, don’t confuse them:

  • Capture filters (BPF): decide what gets recorded (applied while capturing).
  • Display filters: filter what’s already captured (Wireshark’s own syntax).

Most-used display filters:

  • ip.addr == 10.10.10.5 — traffic to/from an IP.
  • tcp.port == 443 — by port.
  • http.request.method == "POST" — POST requests.
  • dns — DNS only.
  • tcp.flags.syn == 1 && tcp.flags.ack == 0 — connection starts (SYN).
  • frame contains "password" — search a string in any packet.

Key action: right-click a packet > Follow > TCP Stream reconstructs the whole conversation (very useful for cleartext HTTP/FTP).

Statistics (Statistics menu):

  • Protocol Hierarchy: traffic breakdown by protocol.
  • Conversations: who talks to whom and how much.
  • Export Objects > HTTP: extract files transferred over HTTP.

tshark (CLI) for automation:

Ventana de terminal
# capture on an interface with a capture filter (BPF) and save
tshark -i eth0 -f "tcp port 80" -w capture.pcapng
# read a pcap applying a display filter (-Y)
tshark -r capture.pcapng -Y 'http.request' -T fields -e ip.src -e http.host -e http.request.uri
# statistics of a pcap
tshark -r capture.pcapng -q -z io,phs # protocol hierarchy
tshark -r capture.pcapng -q -z conv,tcp # TCP conversations

TLS decryption: if you have the session keys (the browser’s SSLKEYLOGFILE variable), load them in Preferences > Protocols > TLS > (Pre)-Master-Secret log filename to see the HTTP inside HTTPS in your own environment.

flowchart TD
  A[Open .pcap] --> B[Statistics: Protocol Hierarchy]
  B --> C{Protocol of interest}
  C -->|HTTP| D[Export Objects > HTTP]
  C -->|Cleartext TCP| E[Follow TCP Stream]
  C -->|DNS| F[dns filter: C2 domains]
  E --> G[Credentials / files / flag]
  D --> G
  • Always start with Protocol Hierarchy and Conversations to get oriented in large captures.
  • Use frame contains or tcp.stream eq N to isolate a specific conversation.
  • For forensics CTF: Export Objects and Follow Stream often give the flag directly.
  • tshark -T fields produces tabulated output that’s easy to process with grep/awk.
  • Wireshark in listening mode is passive: it generates no traffic of its own and isn’t detectable over the network (unless it enables promiscuous mode on a port monitored by the switch).
  • From the defensive angle, Wireshark/tshark are Blue Team tools: analyze PCAPs to identify C2, exfiltration (DNS tunneling, periodic beaconing), and insecure protocols.
  • Signals to look for: connections at regular intervals (beacon), DNS spikes to odd domains, and credentials in cleartext protocols (FTP, HTTP, Telnet).
  • Capture obtained on an authorized network/environment.
  • Initial review with Protocol Hierarchy and Conversations.
  • Display filters applied to isolate what’s relevant.
  • Follow Stream / Export Objects used to extract data.
  • Findings (credentials/files) treated as sensitive data.