Pcap
  • Introduction
  • Getting Started
    • Dependency management
    • Installing Libpcap or Npcap
    • Run as non root user
    • Logging
    • Obtaining the device list
    • Opening an adapter and capturing the packets
    • Capturing the packets without the callback
    • Capture statistics
    • Filtering the traffic
    • Write the packets to a capture file
    • Read packets from a capture file.
    • Sending packets
    • I/O Multiplexing
    • Restricted Method
  • Developer Guide
    • Branches to look
    • Build from Source
    • Notes
  • Packet Structure
    • Packet Header
    • Packet Buffer
  • Packet Codec
    • Using packet codec
    • Adding protocol support
  • Others
  • Thanks to
  • Fork me on Github
Powered by GitBook
On this page
  • On Windows
  • On Linux
  • On Mac OS X

Was this helpful?

  1. Getting Started

Installing Libpcap or Npcap

Installing required third party software.

PreviousDependency managementNextRun as non root user

Last updated 4 years ago

Was this helpful?

On Windows

  1. Download Npcap installer from .

  2. Install Npcap in "Winpcap Compatible Mode"

Other installation methods:

$urlPath = "https://nmap.org/npcap/dist/npcap-0.96.exe"
$checksum = "83667e1306fdcf7f9967c10277b36b87e50ee8812e1ee2bb9443bdd065dc04a1"

# Download the file
echo "Downloading... ($urlPath)"
wget $urlPath -UseBasicParsing -OutFile $PSScriptRoot"\npcap.exe"

# Now let's check its checksum
$_chksum = $(CertUtil -hashfile $PSScriptRoot"\npcap.exe" SHA256)[1] -replace " ",""
if ($_chksum -ne $checksum){
    echo "Hashes NOT match."
    exit
} else {
    echo "Hashes match."
    echo "Installing Npcap..."
}
# Run installer
Start-Process $PSScriptRoot"\npcap.exe" -ArgumentList "/S /npf_startup=yes /loopback_support=yes /dlt_null=no /admin_only=no /dot11_support=no /vlan_support=no /winpcap_mode=yes" -wait
echo "Npcap has been installed."
choco install nmap -y

On Linux

sudo apt install libpcap0.8
yum install libpcap

On Mac OS X

Libpcap should be installed on Mac OS X by default.

Using latest version of libpcap:

  1. tar -xzvf libpcap*.tar.gz

  2. cd libpcap

  3. ./configure --prefix=/usr/local

  4. make

  5. sudo make install

  6. Run your application with custom native library path jna.library.path=/usr/local/lib

Download libpcap source code from

https://nmap.org/npcap
https://www.tcpdump.org