Skip to content
Visual explainer 4h to learn 4 steps

Packet analysis with Wireshark

Open a pcap, filter it and reconstruct what a host did on the network.

By Invicly Tech, , in Cyber Security Fundamentals. About 9 minutes to read.

Topic 8 of 49

In short

Wireshark captures and decodes packets so you can see exactly what crossed a network. Defenders use display filters to isolate traffic, follow streams to reconstruct conversations, and recognise patterns like port scans or malware beaconing.

Explained simply

Every action on a network creates packets: small chunks of data with addresses on them. Packet analysis means recording those packets and reading them to see exactly what happened. It is the most detailed evidence a network can give you.

Wireshark is the free, standard tool for this. Think of it as a microscope for network traffic. A capture file, usually ending in .pcap or .pcapng, is like a recording you can replay, pause and search as often as you want.

Real captures are huge, so the skill is narrowing them down. You start broad (which hosts talked the most?), then filter to one conversation, then read the details. Wireshark's Statistics menu answers the broad questions in seconds.

Only capture traffic on networks you own or have written permission to monitor. Captures can contain passwords and private messages, so treat the files as sensitive evidence. For practice, use your own lab or the free sample captures on the Wireshark wiki and malware-traffic-analysis.net.

Press Play on a diagram to walk through it one step at a time.

FlowPacket analysis workflow
  1. Step 1
    Capture

    Record traffic on a lab interface.

  2. Step 2
    Filter

    Narrow with display filters.

  3. Step 3
    Follow stream

    Reassemble a conversation.

  4. Step 4
    Interpret

    Identify normal vs suspicious.

LayersFrom whole capture to one answer
  1. 1
    Whole capture

    Millions of packets, many hosts.

  2. 2
    Statistics views

    Top talkers, protocols, timeline.

  3. 3
    Display filter

    One host, port or protocol.

  4. 4
    Follow stream

    One full conversation.

  5. 5
    Packet details

    Exact fields, headers and bytes.

In depth

Start with the Statistics menu

Before reading single packets, get the big picture. Statistics > Conversations lists every pair of hosts with bytes and duration, sorted however you like. Statistics > Endpoints shows every IP seen. Statistics > Protocol Hierarchy shows what share of traffic is HTTP, DNS, TLS and so on.

These views answer "who talked to whom, how much, and using what?" in under a minute. A workstation that sent 2 GB to an unknown external IP stands out instantly in Conversations, even in a capture with a million packets.

  • Conversations: top talkers and long sessions
  • Endpoints: every IP and its traffic volume
  • Protocol Hierarchy: unexpected protocols
  • I/O Graph: spikes and regular patterns over time

Display filters that do most of the work

Display filters use field names and comparisons. ip.addr == 10.0.0.5 shows traffic to or from one host. tcp.port == 445 shows SMB. dns shows DNS only. http.request shows web requests. tls.handshake.type == 1 shows TLS Client Hello messages, which reveal the server name the client asked for, even though the rest is encrypted.

Combine with and, or and not: ip.src == 10.0.0.5 and not dns. Right-clicking any field and choosing Apply as Filter writes the filter for you, which is the fastest way to learn field names.

MapDisplay filters by question
Display filter
  • One host
    • ip.addr == 10.0.0.5
  • One service
    • tcp.port == 445
  • One protocol
    • dns
    • http.request
  • TLS server names
    • tls.handshake.type == 1
  • Combine
    • and
    • or
    • not

What a scan looks like

In a TCP port scan, one source sends SYN packets to many ports on one or many targets in a short time. Most get RST replies (closed) or no reply (filtered). A few get SYN-ACK (open).

The filter tcp.flags.syn == 1 and tcp.flags.ack == 0 shows only connection attempts. Then Statistics > Conversations, sorted by the source, shows one IP touching hundreds of ports. In a real network this is either an approved vulnerability scanner, or an attacker exploring after getting a foothold. Check the source against your list of scanner IPs.

SequenceThree answers to a SYN scan
Scanner
Target
  1. 1SYN to port 22
    Scanner to Target: SYN to port 22
  2. 2SYN-ACK: open
    Target to Scanner: SYN-ACK: open
  3. 3SYN to port 23
    Scanner to Target: SYN to port 23
  4. 4RST: closed
    Target to Scanner: RST: closed
  5. 5SYN to port 3389: no reply, filtered
    Scanner to Target: SYN to port 3389: no reply, filtered

What beaconing looks like

Malware often checks in with its command and control (C2) server on a schedule, for example every 60 seconds. This is called beaconing. In a capture, you see small connections from one host to the same destination at very regular times, often with similar sizes.

To spot it, filter on one destination and look at the Time column, or use the I/O Graph with a 1-second interval: beacons show as evenly spaced spikes. Attackers add jitter (random delays) to hide this, but even jittered beacons are usually far more regular than a human browsing.

Learn it in 4 short steps

About 1h each. Track them with a timer in your plan.

  1. 1
    Capture traffic on a lab interface~1h
  2. 2
    Use display filters effectively~1h
  3. 3
    Follow TCP and HTTP streams~1h
  4. 4
    Spot scans and beaconing in a pcap~1h

Key points

  • Display filters like ip.addr and http narrow huge captures.
  • Following a TCP stream reconstructs a full conversation.
  • A single host hitting many ports suggests a port scan.
  • Regular small connections to one host can be beaconing.

Key terms

Tap a card to flip it. 0/4 known

Examples

Finding what a host downloaded

Scenario: an alert says host 10.0.0.23 downloaded a suspicious file. Step 1: Filter ip.addr == 10.0.0.23 and http.request. Step 2: A GET for /update.bin from an unfamiliar domain stands out. Step 3: Right-click it and choose Follow > HTTP Stream to see the request and response headers, including Content-Type and size. Step 4: Use File > Export Objects > HTTP to save the file inside your isolated lab, then hash it with sha256sum. Step 5: Look up the hash on a reputation service rather than opening the file.

text
ip.addr == 10.0.0.23 and http.request
http.request.uri contains ".bin"
http.response.code == 200 and ip.dst == 10.0.0.23
# Then: File > Export Objects > HTTP, save in lab, run:
# sha256sum update.bin

Spotting a beacon with tshark

tshark is Wireshark's command-line version. Step 1: List the time and destination of every TLS Client Hello from one host. Step 2: Look at the gaps between times to the same server. Step 3: If the gaps are nearly identical (here about 60 seconds) and the server name is unfamiliar, treat it as possible beaconing. Step 4: Check which process made the connections using EDR or Sysmon network events on that host.

bash
tshark -r lab.pcapng \
  -Y "ip.src==10.0.0.23 && tls.handshake.type==1" \
  -T fields -e frame.time_relative -e ip.dst -e tls.handshake.extensions_server_name
# 12.01   198.51.100.7  cdn-update.example
# 72.03   198.51.100.7  cdn-update.example
# 132.02  198.51.100.7  cdn-update.example   <- every ~60s

Quick reference

  • ip.addr == X | tcp.port == 445 | dns | http.request | tls.handshake.type == 1
  • tcp.flags.syn == 1 and tcp.flags.ack == 0 -> connection attempts only
  • Statistics > Conversations first; packets second
  • Follow > TCP Stream rebuilds a whole conversation
  • TLS Client Hello reveals the server name (SNI) even when content is encrypted
  • File > Export Objects saves transferred files; only open them in an isolated lab
  • Practice captures: Wireshark sample captures, malware-traffic-analysis.net exercises

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1Which Wireshark view quickly shows which pair of hosts exchanged the most data?

Question 2

2In encrypted HTTPS traffic, what can you usually still see?

Question 3

3A host connects to the same external server every 300 seconds with tiny payloads. What is the most likely concern?

Question 4

4What is the safest way to examine a file extracted from a capture?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    Download a sample capture from the Wireshark wiki (for example an HTTP one). Find the top three talkers using Statistics > Conversations.

  2. Exercise 2medium

    In your lab, capture traffic while running a port scan with nmap from one VM against another VM you own. Then write a display filter that shows only the scan's connection attempts and count the ports probed.

  3. Exercise 3hard

    Pick an exercise pcap from malware-traffic-analysis.net (training captures, never live malware). Identify the infected host, the first suspicious domain, and evidence of C2 or beaconing. Write a five-line summary.

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Is using Wireshark legal?
Yes, on networks you own or have explicit permission to monitor. Capturing other people's traffic without permission can break wiretap and privacy laws, so stick to your lab and sample files.
Can Wireshark decrypt HTTPS?
Only if you have the session keys. In your own lab you can set the SSLKEYLOGFILE environment variable in a browser and point Wireshark at that file; otherwise TLS content stays encrypted.
Why do I see so much traffic I did not cause?
Computers constantly do background work: updates, DNS lookups, time sync, device discovery and cloud sync. Learning what normal background noise looks like is part of the skill.

Go deeper

ShareXLinkedInWhatsApp