CTF Arsenal
DFIR/Network Forensics

PCAP Triage with Wireshark & Tshark

Concept

A packet capture (pcap/pcapng) records every frame seen on a wire or interface. Triage means identifying protocols present, conversations of interest, and reconstructing application-layer content (files, credentials, commands) from raw traffic — read-only against the original file at all times.

When to Use

  • Challenge provides a .pcap/.pcapng file.
  • Investigating suspected data exfiltration, C2 traffic, or credential capture.

Workflow

  1. 1
    Get protocol/conversation overview

    Statistics menu / tshark summary, never edit the original file.

  2. 2
    Filter to the protocol of interest

    http, ftp, dns, smtp display filters.

  3. 3
    Follow the relevant stream

    Reconstruct the full conversation.

  4. 4
    Extract transferred files/credentials

    File > Export Objects, or manual stream save.

  5. 5
    Build a timeline of suspicious activity

    Correlate timestamps across streams.

Commands

tshark -r FILE_PATH -q -z io,phs
tshark -r capture.pcapng -q -z io,phs

Prints a protocol hierarchy summary of the whole capture — a fast overview of what's inside before opening the GUI.

  • -r — Read from a capture file (never use -i on evidence — that would capture live, altering scope).
  • -z io,phs — Protocol hierarchy statistics.

When to use: First command on any new pcap, to orient before deep-diving in Wireshark.

Expected output:

Frame
  Ethernet
    IP
      TCP
        HTTP
      UDP
        DNS

Look for: Unexpected protocols (e.g. FTP, Telnet — plaintext credential risk) or heavy traffic on an unusual port.

Next step: Open in Wireshark and filter to the most interesting protocol first.

wireshark FILE_PATH (then filter bar: http.request)
Filter bar: http.request or ftp or dns

GUI display filters narrow the packet list to a specific protocol or condition without modifying the capture.

When to use: Interactive investigation once tshark gives you a direction.

Expected output:

Filtered packet list showing only matching frames.

Look for: GET/POST requests with sensitive parameters, cleartext auth (ftp.request.command == "USER"/"PASS").

Next step: Right-click a packet > Follow > TCP Stream to see the full conversation.

tshark -r FILE_PATH -Y 'DISPLAY_FILTER' -T fields -e FIELD_NAME
tshark -r capture.pcapng -Y 'ftp.request.command=="PASS"' -T fields -e ftp.request.arg

Extracts specific field values matching a filter, scriptable for bulk extraction (e.g. every FTP password attempted).

  • -Y — Display filter (same syntax as the Wireshark GUI filter bar).
  • -T fields -e — Output only the named field(s), one per line — good for piping into grep/sort.

When to use: When you need to pull many instances of a value (all passwords, all DNS queries) rather than reading packet-by-packet.

Expected output:

letmein123

Look for: Credential values, exfiltrated data chunks, suspicious domain names.

Next step: Correlate extracted values against other evidence (hostnames, usernames).

tshark -r FILE_PATH --export-objects http,OUTPUT_DIR
tshark -r capture.pcapng --export-objects http,extracted/

Extracts every file transferred over HTTP in the capture into a directory.

  • --export-objects http,DIR — Reassemble and save HTTP objects (images, documents, executables) to DIR.

When to use: When the capture includes file downloads/uploads over HTTP you need as standalone artifacts.

Expected output:

Files written into extracted/.

Look for: Any executable, archive, or document — treat as new evidence for file/malware forensics.

Next step: Run 'file' and the file-forensics workflow on each exported object.

Tools

Wireshark

GUI packet analyzer: filtering, stream reconstruction, protocol dissection, object export.

When to use: Primary tool for interactive pcap analysis.

sudo apt install wireshark
wireshark FILE_PATH

Example workflow: Statistics > Protocol Hierarchy -> filter -> Follow Stream -> File > Export Objects.

Tshark

Command-line Wireshark — scriptable, good for bulk/automated extraction and headless environments.

When to use: Scripting, large captures, or quick field extraction without the GUI.

sudo apt install tshark
tshark -r FILE_PATH -Y 'filter'

Example workflow: Use the same display-filter syntax as Wireshark; pipe field output into other CLI tools.

NetworkMiner

Automatically extracts files, credentials, and host/session details from a pcap with minimal manual filtering.

When to use: Fast first pass to see 'what's extractable' before manual Wireshark filtering.

Open the pcap in NetworkMiner's GUI; browse the Files/Credentials/Hosts tabs.

Example workflow: Load pcap -> Credentials tab for cleartext auth -> Files tab for transferred objects.

Findings & Interpretation

Interesting

  • Cleartext credentials in FTP/HTTP Basic Auth/Telnet
  • A file transfer matching known malware hashes
  • DNS queries to a suspicious/newly-registered-looking domain (possible C2)

Suspicious

  • Regular, small, periodic connections to one external IP (beaconing pattern)
  • Large outbound transfer shortly after an inbound exploit-looking request (possible exfiltration)

False Positives

  • Normal background broadcast/multicast traffic (ARP, mDNS, SSDP) is rarely relevant — filter it out early

How to Validate

  • Follow the full stream, not just one packet, before concluding what happened — a single packet out of context misleads

Next Step

  • Extracted files feed into Malware Forensics; extracted credentials feed into Password & Credential Attacks concepts for validation.

Troubleshooting

Follow TCP Stream shows garbled/binary data instead of readable text.

Likely cause: Traffic is encrypted (TLS) or compressed, not plaintext.

Verify: Check the protocol column — https/tls traffic will show 'Application Data', not an app-layer protocol.

Fix: Without the TLS session keys, content can't be decrypted — focus on metadata (SNI, IPs, timing, DNS) instead.

Recovery: If a key log file (SSLKEYLOGFILE) was provided with the challenge, load it in Wireshark under TLS preferences to decrypt.

Avoid repeating: Don't assume every pcap is fully readable — identify encrypted protocols early and adjust expectations.