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.
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.
- Step 1Capture
Record traffic on a lab interface.
- Step 2Filter
Narrow with display filters.
- Step 3Follow stream
Reassemble a conversation.
- Step 4Interpret
Identify normal vs suspicious.
- 1Whole capture
Millions of packets, many hosts.
- 2Statistics views
Top talkers, protocols, timeline.
- 3Display filter
One host, port or protocol.
- 4Follow stream
One full conversation.
- 5Packet 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.
- 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.
- Scanner to Target: SYN to port 221SYN to port 22
- Target to Scanner: SYN-ACK: open2SYN-ACK: open
- Scanner to Target: SYN to port 233SYN to port 23
- Target to Scanner: RST: closed4RST: closed
- Scanner to Target: SYN to port 3389: no reply, filtered5SYN 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.
- 1Capture traffic on a lab interface~1h
- 2Use display filters effectively~1h
- 3Follow TCP and HTTP streams~1h
- 4Spot 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.
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.binSpotting 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.
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 ~60sQuick 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.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Download a sample capture from the Wireshark wiki (for example an HTTP one). Find the top three talkers using Statistics > Conversations.
- 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.
- 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.