How to read a PCAP file, step by step
A PCAP file is a recording of network traffic. Learn what is inside it, what to look at first, and how to get a plain-English answer from it.
Someone sends you a file ending in .pcap and says, “Can you look at this?” You open it and see thousands of lines of numbers and short words. Where do you even start?
This guide shows you how to read a PCAP file without getting lost. You do not need to know every protocol. You need a question and a method.
What a PCAP file is
A PCAP file is a recording of network traffic. A capture tool sits at one point on a network, copies every packet that passes by, and saves the copies with the time each one was seen. A packet is one small piece of a conversation between two devices.
You will meet a few file types:
.pcapis the classic format..pcapngis the newer format. It can hold more than one network card and notes added by the person who captured..capis another name for the same kind of file..pcap.gzis a PCAP file that has been compressed.
Each packet holds its time, then layers of information, like envelopes inside envelopes:
- Ethernet holds the hardware (MAC) addresses of the two devices on the same link.
- IP holds the addresses of the two devices that are talking, which can be far apart.
- TCP or UDP holds the port numbers. A port says which program or service the packet is for, for example 443 for secure web pages.
- The data is what the program sent. Often this part is encrypted.
Before you open it
Two checks save a lot of confusion.
Where was the capture taken? A capture only shows what passed that point. A capture on your laptop shows your laptop’s traffic. It does not show what two servers said to each other somewhere else.
Is it safe to open? A capture can hold passwords, names and private messages. Only open captures you are allowed to see, and keep them somewhere private.
Step 1: Ask one question
“What is in here?” is too big. Pick something small:
- Which devices were talking?
- Why was one device so busy?
- Did anything leave the network that should not have?
- What happened at 14:32?
Write the question down. Every step below helps you answer it.
Step 2: Get the big picture
Look at the whole capture before any single packet. You want to know how long it covers, how many packets and bytes it holds, and which devices sent the most. A device that sends far more than the others is a good place to look first.
Step 3: Follow the conversations
A conversation is all the packets between the same two devices on the same two ports. Reading conversations is much easier than reading packets one by one.
For web traffic over TCP, a conversation starts with three small packets, called the handshake:
- The client sends a SYN (“can we talk?”).
- The server answers with a SYN-ACK (“yes”).
- The client answers with an ACK (“good”).
Then the data flows. At the end, the two sides close politely with FIN, or one side cuts it off with a RST (reset). Many resets, or many SYNs with no answer, are worth a closer look.
Step 4: Read the name lookups
Before a device talks to a website, it asks DNS for the address that belongs to the name. DNS packets show you which names a device looked up, and when. A device that asks for strange names again and again is worth a note.
Step 5: Deal with encrypted traffic
Most traffic today is encrypted with TLS, the lock you see on secure websites. In an encrypted conversation you can still see who talked to whom, when, and how much. Often you can also see the name of the server. You cannot see the content.
To read the content you need the keys. The usual way is a key-log file. You set the SSLKEYLOGFILE environment variable before you start the browser or app, then you capture while you reproduce the problem. A key-log file comes from the program that made the connection, so it only helps when you can run that program with the variable set. Without the keys, you work with what is visible.
Step 6: Look for things that should not be there
Some things are worth stopping for:
- Passwords sent in clear text, for example over old FTP or plain HTTP.
- One device trying many different ports on another device, which looks like a port scan.
- A device calling the same outside address every few seconds, like a clock.
- A flood of lookups for names that do not exist.
None of these proves a problem by itself. They tell you where to look next.
How pCapitan makes this easier
pCapitan is built for exactly this job. It reads the capture and tells you the story in plain words, with the evidence one click away. It runs on your own computer, and your captures are never uploaded.
- Start pCapitan. It opens in your web browser, served by the engine on your own computer.
- On the home screen, click Choose capture file and pick your
.pcap,.pcapng,.capor.pcap.gzfile. It reads big files where they are, without making a copy. - When the analysis ends, the Overview opens. It shows the risk level, the story of the capture in plain words and the most important findings.
- Open What happened? to read the incident in plain English: which attacks worked, which device was hit first and whether it was still going on.
- Use Ask pCapitan to type a question in your own words, such as “What did 192.168.1.66 do?” or “Were any passwords sent in clear text?”. It answers from the capture, with the evidence.
- Open Devices to see every device with its type, maker and verdict. Click one for its profile.
- For encrypted traffic, add your keys in the Decryption Vault. pCapitan can decrypt TLS 1.2 and 1.3 from a key-log file.
If you want to go step by step, the pCapitan first capture guide walks through every screen. You can try pCapitan free on its page with every feature on.
Mistakes to avoid
- Judging by the first alarm. A summary is a starting point. Read the conversation behind it.
- Forgetting the clock. Check the time zone of the capture before you match it to a log.
- Trusting a capture from the wrong place. If the problem is on the server side, a capture on the client may not show it.
- Sharing the file carelessly. It may hold secrets.
Once you can read a capture, the next question is usually “why is it slow?”. Find what is slowing your network shows how.