Prerequisites
- Target system, dependencies and environment configured.
Usage
Purpose
When you need ground truth about network activity — is this connection encrypted, what is this host really talking to, is data leaving — you read the packets. Packet capture analysis is the skill of grabbing traffic and making sense of it: confirming a suspected C2 channel, spotting cleartext credentials, or debugging why a connection fails. This skill covers capturing efficiently and analysing without drowning in packets.
When to use it
Incident investigation (what did this host do on the network), confirming a security finding (is this traffic really unencrypted), threat hunting (beaconing patterns), or debugging. It complements the higher-level logs — packets are the most granular, most truthful source, and the hardest to fake.
Procedure
- Capture with a filter, not everything. Unfiltered capture on a busy link produces gigabytes fast. Use a capture (BPF) filter to grab only relevant traffic — a host, a port, a protocol:
tcpdump -i eth0 host 10.0.0.5 -w capture.pcap # one host
tcpdump -i eth0 'port 53 or port 80' -w web-dns.pcap # specific services
- Capture to a file, analyse offline. Write to
.pcap and open in Wireshark for the analysis — live analysis on the wire is error-prone and you can't go back over it.
- Get the shape first. In Wireshark, use Statistics → Conversations and Protocol Hierarchy to see who's talking to whom and what protocols dominate, before diving into individual packets. This orients you fast.
- Apply display filters to narrow to what matters — display filters (Wireshark syntax) are different from capture filters and let you slice the saved capture:
ip.addr == 10.0.0.5 && tcp.port == 443
http.request # just HTTP requests
dns.qry.name contains "suspicious"
- Follow the stream to reconstruct a conversation — "Follow TCP/HTTP Stream" reassembles a session so you read it as the application saw it (a full HTTP request/response, a cleartext login).
- Look for the security-relevant signals — cleartext credentials, unexpected destinations, beaconing (regular-interval connections to one host), large outbound transfers (exfiltration), and protocol anomalies.
- Handle it as evidence if it's for an incident — capture integrity and chain of custody matter (see the forensics domain).
Cheatsheet
tcpdump -i eth0 host 10.0.0.5 -w cap.pcap
tcpdump -i eth0 'tcp port 443' -w tls.pcap
tcpdump -i eth0 -n 'port 53' -w dns.pcap # -n = no name resolution (faster)
host 10.0.0.5 | net 10.0.0.0/24 | port 80 | tcp | udp | 'tcp port 443 and host x'
ip.addr == 10.0.0.5
tcp.port == 443
http.request | dns | tls.handshake
tcp.flags.syn == 1 && tcp.flags.ack == 0 # SYNs (scans/connections)
ip.len > 1400 # large packets (transfers)
Statistics -> Conversations | Protocol Hierarchy
right-click -> Follow -> TCP/HTTP Stream # reconstruct a session
tshark -r cap.pcap -Y "http.request" -T fields -e ip.dst -e http.host
Reading the capture
- Cleartext credentials (HTTP Basic auth, FTP, telnet, an unencrypted login in a followed stream) = a real finding — sensitive data on the wire in the clear.
- Beaconing (regular-interval connections from a host to one external destination) = a strong C2 signal; the regularity is the tell (ties into the threat-hunting beaconing skill).
- Unexpected destinations = a host talking to something it shouldn't — an unknown external IP, an internal system it has no business reaching (lateral movement).
- Large or sustained outbound transfers = potential data exfiltration; check the destination and volume.
- Protocol on a wrong port (SSH on 443, DNS carrying oddly-large payloads) = tunnelling/evasion; worth investigating.
- Encrypted traffic you can't read = expected for TLS — you see metadata (who, when, how much) but not content, which is often enough for the investigation.
Pitfalls
- Capturing everything. Unfiltered capture on a busy link fills the disk and buries the signal. Filter at capture time.
- Confusing capture and display filters. BPF (capture) and Wireshark display-filter syntax are different;
port 80 captures, tcp.port == 80 displays. Using the wrong one in the wrong place returns nothing or everything.
- Diving into packets before getting the shape. Start with Conversations/Protocol Hierarchy; individual packets make sense only once you know the overall picture.
- Expecting to read encrypted content. TLS traffic shows metadata, not plaintext, without the keys — don't mistake "can't read it" for "nothing there".
- Ignoring evidence handling. For incidents, an unmanaged capture may not hold up; preserve integrity (see forensics).
References
- Wireshark documentation and display-filter reference
- tcpdump / BPF filter documentation
- SANS packet analysis resources
- The threat-hunting (beaconing) and forensics domains
Inputs
- Relevant source code, logs, network traces, or system specifications.
Outputs
- Analysis findings, security audit report, or generated code artifacts.
1---2name: packet-capture-analysis3description: Use when you need to read what's actually on the wire — capturing and analysing traffic with tcpdump and Wireshark to investigate an incident, confirm a finding, or debug.4---5678## Prerequisites9- Target system, dependencies and environment configured.1011## Usage12### Purpose1314When you need ground truth about network activity — is this connection encrypted, what is this host really talking to, is data leaving — you read the packets. Packet capture analysis is the skill of grabbing traffic and making sense of it: confirming a suspected C2 channel, spotting cleartext credentials, or debugging why a connection fails. This skill covers capturing efficiently and analysing without drowning in packets.1516### When to use it1718Incident investigation (what did this host do on the network), confirming a security finding (is this traffic really unencrypted), threat hunting (beaconing patterns), or debugging. It complements the higher-level logs — packets are the most granular, most truthful source, and the hardest to fake.1920### Procedure21221. **Capture with a filter, not everything.** Unfiltered capture on a busy link produces gigabytes fast. Use a capture (BPF) filter to grab only relevant traffic — a host, a port, a protocol:23 ```24 tcpdump -i eth0 host 10.0.0.5 -w capture.pcap # one host25 tcpdump -i eth0 'port 53 or port 80' -w web-dns.pcap # specific services26 ```272. **Capture to a file, analyse offline.** Write to `.pcap` and open in Wireshark for the analysis — live analysis on the wire is error-prone and you can't go back over it.283. **Get the shape first.** In Wireshark, use Statistics → Conversations and Protocol Hierarchy to see who's talking to whom and what protocols dominate, before diving into individual packets. This orients you fast.294. **Apply display filters** to narrow to what matters — display filters (Wireshark syntax) are different from capture filters and let you slice the saved capture:30 ```31 ip.addr == 10.0.0.5 && tcp.port == 44332 http.request # just HTTP requests33 dns.qry.name contains "suspicious"34 ```355. **Follow the stream** to reconstruct a conversation — "Follow TCP/HTTP Stream" reassembles a session so you read it as the application saw it (a full HTTP request/response, a cleartext login).366. **Look for the security-relevant signals** — cleartext credentials, unexpected destinations, beaconing (regular-interval connections to one host), large outbound transfers (exfiltration), and protocol anomalies.377. **Handle it as evidence** if it's for an incident — capture integrity and chain of custody matter (see the forensics domain).3839### Cheatsheet4041```bash42tcpdump -i eth0 host 10.0.0.5 -w cap.pcap43tcpdump -i eth0 'tcp port 443' -w tls.pcap44tcpdump -i eth0 -n 'port 53' -w dns.pcap # -n = no name resolution (faster)4546host 10.0.0.5 | net 10.0.0.0/24 | port 80 | tcp | udp | 'tcp port 443 and host x'4748ip.addr == 10.0.0.549tcp.port == 44350http.request | dns | tls.handshake51tcp.flags.syn == 1 && tcp.flags.ack == 0 # SYNs (scans/connections)52ip.len > 1400 # large packets (transfers)5354Statistics -> Conversations | Protocol Hierarchy55right-click -> Follow -> TCP/HTTP Stream # reconstruct a session5657tshark -r cap.pcap -Y "http.request" -T fields -e ip.dst -e http.host58```5960### Reading the capture6162- **Cleartext credentials** (HTTP Basic auth, FTP, telnet, an unencrypted login in a followed stream) = a real finding — sensitive data on the wire in the clear.63- **Beaconing** (regular-interval connections from a host to one external destination) = a strong C2 signal; the regularity is the tell (ties into the threat-hunting beaconing skill).64- **Unexpected destinations** = a host talking to something it shouldn't — an unknown external IP, an internal system it has no business reaching (lateral movement).65- **Large or sustained outbound transfers** = potential data exfiltration; check the destination and volume.66- **Protocol on a wrong port** (SSH on 443, DNS carrying oddly-large payloads) = tunnelling/evasion; worth investigating.67- **Encrypted traffic you can't read** = expected for TLS — you see metadata (who, when, how much) but not content, which is often enough for the investigation.6869### Pitfalls7071- **Capturing everything.** Unfiltered capture on a busy link fills the disk and buries the signal. Filter at capture time.72- **Confusing capture and display filters.** BPF (capture) and Wireshark display-filter syntax are different; `port 80` captures, `tcp.port == 80` displays. Using the wrong one in the wrong place returns nothing or everything.73- **Diving into packets before getting the shape.** Start with Conversations/Protocol Hierarchy; individual packets make sense only once you know the overall picture.74- **Expecting to read encrypted content.** TLS traffic shows metadata, not plaintext, without the keys — don't mistake "can't read it" for "nothing there".75- **Ignoring evidence handling.** For incidents, an unmanaged capture may not hold up; preserve integrity (see forensics).7677### References7879- Wireshark documentation and display-filter reference80- tcpdump / BPF filter documentation81- SANS packet analysis resources82- The threat-hunting (beaconing) and forensics domains8384## Inputs85- Relevant source code, logs, network traces, or system specifications.8687## Outputs88- Analysis findings, security audit report, or generated code artifacts.