Skip to content

Packet Capture Tools and Methods

Packet capture is the collection of raw network traffic for forensic analysis, law enforcement investigation, or incident response. This topic covers the principal tools, capture placement strategies, span ports, inline taps, and the procedures that ensure captured data is complete and admissible.

Last updated:

Share

Packet capture is the process of intercepting and recording raw network packets as they travel across a wire or wireless medium. In network forensics, a packet capture file (typically in PCAP or PCAPng format) is the primary evidence record: it contains the exact bytes transmitted between devices, with timestamps, and can be replayed, filtered, and decoded to reconstruct application-layer sessions, identify command-and-control traffic, or establish timelines for a security incident. The three principal open-source tools are Wireshark, a graphical protocol analyser; tcpdump, a command-line capture utility; and tshark, the terminal-mode version of Wireshark's engine. Commercial alternatives include tools such as Savvius Omnipeek and SolarWinds Network Performance Monitor, which add centralised management and long-term storage. Hardware network taps and switch SPAN (Switched Port Analyzer) ports are the standard methods for positioning a capture device to see traffic it would not otherwise receive.

Capture placement is a strategic decision. A sensor positioned at the perimeter firewall sees all traffic entering or leaving the network but misses lateral movement between internal hosts. A sensor on a core switch SPAN port sees internal traffic but may drop packets if the switch is under load. An inline hardware tap sees every bit without software-imposed limits but requires a physical break in the cable and introduces a single point of failure. Choosing where to capture, and how many capture points to deploy, depends on the investigation objective: perimeter breach, insider threat, data exfiltration path, or malware command-and-control.

Forensic packet capture must satisfy two requirements beyond technical completeness: legal authority and evidentiary integrity. Legal authority means that the capturing party has consent, statutory power, or a court order covering that traffic under the applicable jurisdiction. Evidentiary integrity means the capture file can be shown to be unmodified since collection, typically through cryptographic hashing and chain-of-custody documentation. A technically perfect capture that lacks legal authority or whose hash cannot be verified is not usable in court in most jurisdictions. Both requirements must be addressed before capture begins, not after.

By the end of this topic you will be able to:

  • Describe the capabilities and appropriate use cases for Wireshark, tcpdump, tshark, and commercial packet capture platforms.
  • Explain how SPAN ports and network taps work, and identify the scenarios where each is preferable.
  • Plan a capture placement strategy for a given investigation objective, selecting sensor positions that maximise evidence coverage.
  • Apply the procedures that make a packet capture forensically sound, including hashing, timestamping, and chain-of-custody documentation.
  • Identify the legal frameworks governing packet capture across major jurisdictions, and explain the distinction between content interception and metadata collection.
Key terms
PCAP / PCAPng
The standard file formats for storing captured packets. PCAP (libpcap format) is the legacy standard supported by virtually all tools. PCAPng (Next Generation) extends it with per-interface metadata, nanosecond timestamps, and the ability to store captures from multiple interfaces in a single file. Wireshark and tshark write PCAPng by default; tcpdump writes legacy PCAP.
SPAN port (port mirroring)
A switch feature that copies frames from one or more source ports or VLANs to a designated destination port, where a capture device is connected. Implemented in software on the switch processor, so it can drop frames under high load and may not capture certain error frames that are filtered before the mirroring engine.
Network tap
A hardware device inserted inline in a network cable path that passively copies the electrical or optical signal to one or more monitoring ports. Because it operates at the physical layer, it captures all traffic including error frames and does not drop packets under load. Requires a physical break in the cable to install.
Promiscuous mode
A network interface operating mode in which the card passes all received frames to the capture software, not just frames addressed to its own MAC address. Required for packet capture on shared or mirrored segments. On switched networks, must be combined with a SPAN port or tap to receive non-local traffic.
BPF (Berkeley Packet Filter)
A kernel-level packet filtering mechanism used by tcpdump, Wireshark, and most capture tools to select which packets are written to disk. BPF expressions such as 'port 443' or 'host 10.0.0.1' reduce capture file size and focus collection on relevant traffic. The filter runs in the kernel before packets reach user space, minimising CPU load.
Ring buffer capture
A capture mode in which the tool writes successive PCAP files of a fixed size or duration, overwriting the oldest when the buffer is full. Used for continuous monitoring where indefinite storage is not available. In forensic deployments, the ring buffer is typically frozen (stopped) the moment an incident is declared, to preserve the files covering the relevant window.

Wireshark: the graphical protocol analyser

Wireshark is the most widely deployed open-source network protocol analyser. It captures live traffic through the libpcap library (WinPcap or Npcap on Windows) and dissects packets from more than 3,000 protocols, displaying fields in a three-pane GUI: the packet list, the decoded field tree, and the raw hex view. Wireshark can also read pre-captured files from tcpdump, tshark, and commercial tools. Its display filter language (dfl) allows precise selection of packets by protocol, address, field value, or content match. Filters such as 'http.request.method == "POST"' or 'tcp.flags.syn == 1 and tcp.flags.ack == 0' isolate specific traffic patterns without modifying the underlying capture file.

For forensic work, Wireshark's Follow Stream function reconstructs the full byte sequence of a TCP or UDP session, allowing the analyst to read transferred files, commands, or messages as they appeared to the application. Export Objects extracts files transferred over HTTP, SMB, or FTP directly from the capture. The Statistics menu provides conversation summaries, endpoint lists, and protocol hierarchy breakdowns that orient the analyst quickly in a large capture. Wireshark does not modify the source PCAP file; all analysis operations read from the file without altering it, which satisfies the non-modification requirement for forensic evidence.

Wireshark requires root or administrator privileges to open a live capture interface. On Linux, the setcap utility can grant capture capability to the Wireshark binary without running the entire application as root, which is preferable on investigator workstations. On Windows, Npcap must be installed and its driver service running. In both cases, the capture interface should be placed in promiscuous mode and, where applicable, in monitor mode for wireless capture.

tcpdump and tshark: command-line capture

tcpdump is a command-line packet capture utility available on virtually every Unix-like operating system, including Linux, macOS, FreeBSD, and the embedded Linux found in many network devices. It uses the same libpcap library as Wireshark and writes PCAP-format files. Because it has no GUI, tcpdump is the standard choice for capturing on headless servers, virtual machines, and network appliances. A typical forensic capture command is: 'tcpdump -i eth0 -w /evidence/capture-2024-01-15.pcap -s 0' which captures all traffic on eth0, writes full-size packets (snaplen 0), and saves to a named file. Adding a BPF expression restricts capture to specific hosts or ports.

tshark is the terminal-mode equivalent of Wireshark's dissection engine. It can both capture and analyse, outputting decoded fields as plain text or JSON, which makes it suitable for scripting and pipeline integration. The command 'tshark -r capture.pcap -T fields -e ip.src -e ip.dst -e http.request.uri' extracts source IP, destination IP, and HTTP URI from every HTTP request in a capture file. This output can be piped to grep, awk, or Python for rapid triage without loading the full file into a GUI.

FeaturetcpdumptsharkWireshark
GUINoNoYes
Protocol dissectorsLimitedFull (3000+)Full (3000+)
Scripting / pipelineYesYesLimited
Live captureYesYesYes
Read existing PCAPYes (basic)Yes (full)Yes (full)
PlatformUnix/Linux/macOSCross-platformCross-platform
Typical useHeadless server captureScripted analysisInteractive analysis

For very high-speed links (10 Gbps and above), both tcpdump and Wireshark may drop packets because the kernel cannot buffer frames fast enough for user-space processing. Purpose-built high-performance capture solutions use kernel bypass techniques such as AF_PACKET TPACKET_V3 on Linux, PF_RING, or DPDK. These frameworks allow packet data to be written directly to ring buffers mapped into user space, bypassing the normal network stack. Investigators encountering high-speed capture requirements should evaluate tools such as ntopng, Zeek (formerly Bro), or commercial appliances from vendors such as Netscout or Corelight.

SPAN ports: software-based traffic mirroring

A SPAN port (also called a mirror port) is configured on a managed switch to copy frames from one or more source ports, or from a VLAN, to a designated monitoring port. The analyst connects a laptop or dedicated capture appliance to the monitoring port and runs a capture tool in promiscuous mode. SPAN configuration is done through the switch's management interface and requires no physical cable changes after initial setup, making it the fastest way to begin capturing in an enterprise environment where physical access to cable paths is difficult.

SPAN has four documented limitations that investigators must understand. First, the switch processor implements mirroring in software; under heavy load the processor prioritises forwarding over mirroring, and the monitoring port may receive fewer packets than actually traversed the source ports. Second, some switches do not mirror error frames (frames with CRC errors or undersized frames), which may be forensically relevant in certain attack scenarios. Third, bidirectional SPAN (copying both ingress and egress on a port) can exceed the monitoring port's bandwidth if the source port is near line rate, causing additional drops. Fourth, a SPAN configuration that was not present before the investigation leaves a change record on the switch, which the opposing party may scrutinise in litigation.

Network taps: hardware passive capture

A network tap is a hardware device that sits physically inline in the cable path between two network devices. It passes the signal between its two inline ports (maintaining the original connection) and simultaneously copies the signal to one or more monitoring ports. Passive optical taps split the light signal with no active components and consume no power from the network path; they are completely transparent and invisible to the devices on either side. Active regenerating taps are used on copper links where passive splitting is not practical and introduce minimal latency, typically under 5 microseconds.

The principal forensic advantage of a tap over a SPAN port is completeness. Because the tap operates at the physical layer, it copies every bit on the wire, including error frames, malformed packets, and traffic during link negotiation. It does not drop packets under load because the monitoring port output is independent of the switch processor. For investigations where completeness of capture is critical, such as reconstructing a data exfiltration or proving the exact sequence of an intrusion, a hardware tap is the preferred collection point. Common vendors include Garland Technology, Ixia (now Keysight), and Gigamon.

The operational disadvantage is installation. Inserting a tap requires breaking the cable connection, which causes a brief link interruption. In a production network this must be coordinated with the network team and, in some organisations, approved through change management. Inline taps also introduce a physical single point of failure on the monitored link: if the tap hardware fails, the link fails. Bypass taps with fail-safe relays mitigate this by restoring the direct cable connection if the tap loses power, but they add cost and complexity.

CriterionSPAN portNetwork tap
Packet completeness under loadMay drop packetsComplete: physical copy
Error frame captureOften missedCaptured
Installation disruptionNone (config change only)Brief link interruption
CostFree (switch feature)Hardware purchase required
Single point of failureNoYes (mitigated by bypass relay)
Visibility to network devicesNot visibleNot visible (passive)
Maximum link speed supportedSwitch-dependentUp to 400 Gbps (high-end models)

Capture placement strategy

Where a capture device is placed determines what evidence it can collect. No single placement captures all forensically relevant traffic in a modern enterprise network, so investigators must match placement to the specific investigation question. A perimeter capture point (at the firewall or internet gateway) captures all traffic entering or leaving the network and is the correct placement for investigating external attacks, command-and-control communications, or data exfiltration to an external destination. It misses all traffic that stays within the internal network, including lateral movement and internal data transfers.

A core switch capture point, using a SPAN port or tap on a link carrying aggregated internal traffic, captures both internal lateral movement and external traffic passing through the core. The trade-off is volume: core links on a large network carry terabytes per day, requiring high-performance capture hardware and large storage. Selective BPF filters reduce volume but risk discarding relevant traffic if the investigator's assumptions about the attack path are wrong. Distributed capture, with sensors at multiple network segments, provides the broadest coverage but requires a centralised collection and analysis platform.

For mobile device investigations, the network capture placement depends on what is being investigated. Capturing the traffic of a single suspect device requires placing a capture point on the access layer switch port or wireless access point that the device connects to. On a wireless network, a dedicated monitor-mode capture interface can capture all 802.11 frames on a channel, including management and control frames that reveal device associations, probe requests (which disclose SSIDs the device has previously connected to), and authentication sequences. See Legal and Jurisdictional Frameworks for the authority requirements before targeting an individual device.

Ensuring completeness and forensic integrity

A forensically sound packet capture requires documentation at five points: before capture starts, at capture start, during capture, at capture stop, and during storage and transfer. Before starting, record the legal authority for capture, the name and role of the person conducting it, the make, model, and serial number of the capture hardware, and the version of the capture software. At start, record the exact UTC time, the interface name, the BPF capture filter (if any), and the network segment being monitored. During capture, log any errors, dropped packet counts (reported by the tool at exit or via ifconfig), and any interruptions. At stop, record the UTC time, the number of packets captured, and the file path.

Immediately after the capture file is closed, compute a cryptographic hash of the file. SHA-256 is the current standard in most jurisdictions; MD5 is no longer considered collision-resistant and should not be used as the sole hash. Record the hash value in the chain-of-custody document and, where possible, in a signed electronic record. Copy the file to evidence storage and compute the hash again to verify that the copy is identical to the original. All subsequent analysis should be conducted on copies, never on the original file. The original should be stored on write-protected media or in a write-once storage system.

Packet drops are the primary completeness risk. tcpdump reports the number of packets received, filtered, and dropped by the kernel at the end of a capture session. A drop count above zero means the capture file is incomplete. High drop counts indicate that the capture system is too slow for the traffic volume and that either hardware must be upgraded, the BPF filter must be narrowed, or a high-performance capture solution must be used. In a court submission, the drop count must be disclosed, and the investigator should explain what class of traffic was most likely to have been dropped and whether that affects the conclusions drawn from the capture.

Check your understanding
Question 1 of 4· 0 answered

A network engineer configures a SPAN port on a core switch to mirror all internal traffic to a capture appliance. During a busy trading window, the capture appliance reports receiving 2 million packets while the switch counters show 2.4 million packets traversed the monitored ports. What is the most likely explanation?

Key Takeaways

  • Wireshark, tcpdump, and tshark all use the libpcap library and write standard PCAP or PCAPng files; the choice between them depends on whether a GUI is available and whether output needs to feed into scripts or pipelines.
  • SPAN ports are fast to configure but drop packets under load and miss error frames; hardware network taps capture every bit on the wire but require a brief physical break in the cable to install.
  • Capture placement determines what evidence is visible: perimeter sensors see external traffic, core switch sensors see internal lateral movement, and per-device or wireless monitor-mode sensors see device-level and management frames.
  • Forensic soundness requires SHA-256 hashing of the capture file immediately after collection, documented chain of custody, NTP-synchronised timestamps, disclosure of any dropped packet counts, and confirmation that legal authority was in place before capture began.
  • Content capture is subject to stricter legal thresholds than metadata collection in every major jurisdiction: a Title III order (US), interception warrant (UK Investigatory Powers Act 2016), Section 69 authorisation (India IT Act 2000), or equivalent national authority is required before capturing the content of communications.
What is the difference between a SPAN port and a network tap for packet capture?
A SPAN (Switched Port Analyzer) port is a software feature on a managed switch that copies selected traffic to a designated monitoring port. It is low cost and non-intrusive but can drop packets under high load and may miss certain error frames. A network tap is a dedicated hardware device inserted inline in the cable path that passively copies every bit to a monitoring port. Taps guarantee completeness and do not drop packets, but they require a physical break in the cable to install.
What does Wireshark do that tcpdump cannot?
Wireshark provides a graphical user interface with protocol dissectors for hundreds of application-layer protocols, live color-coded traffic views, and point-and-click filter building. tcpdump is a command-line tool that writes raw packet data to a file or terminal. Both can read and write PCAP files interchangeably. Wireshark is preferred for interactive analysis; tcpdump is preferred for scriptable headless capture on servers or embedded systems where no GUI is available.
How is packet capture made forensically sound?
Forensic soundness requires: capturing in a read-only mode where possible, immediately hashing the capture file (SHA-256 or better) and recording the hash, logging the start and stop times with synchronized clocks, documenting the capture configuration and interface, storing the file on write-protected media, and maintaining a documented chain of custody from capture to analysis. Some jurisdictions also require that collection authority (court order, statutory power, or consent) is recorded alongside the evidence.
What is promiscuous mode and why does it matter for packet capture?
In normal mode a network interface discards frames not addressed to its own MAC address. Promiscuous mode disables that filter, allowing the interface to receive all frames on the network segment. For packet capture on a shared or mirrored segment, promiscuous mode is mandatory to see traffic destined for other hosts. On switched networks, the interface must be connected to a SPAN port or tap first, because switches unicast traffic only to the relevant port regardless of the capture card's mode.
Which legal authorities govern network packet capture in different jurisdictions?
In the United States, the Electronic Communications Privacy Act (ECPA) and the Wiretap Act (18 U.S.C. 2511) govern interception of network content; law enforcement requires a Title III wiretap order for real-time capture. In the UK, the Investigatory Powers Act 2016 authorises interception under warrant. In India, the Information Technology Act 2000 (Section 69) authorises lawful interception. The EU's GDPR and the European Convention on Human Rights Article 8 constrain member state interception powers. All jurisdictions distinguish between capture of content data and capture of metadata, with content subject to stricter legal thresholds.

Test yourself on Mobile and Network Forensics with free, timed mocks.

Practice Mobile and Network Forensics questions

Found this useful? Pass it along.

Share

Spotted an error in this page? Report a correction or read our editorial standards.

Your journey to becoming a forensic professional starts here.

Practice with mock tests, learn from structured notes, and get your questions answered by a global forensic community, all in one place.