Pcapy is a Python extension module that interfaces with the libpcap packet capture library. Pcapy enables python scripts to capture packets on the network. Pcapy is highly effective when used in conjunction with a packet-handling package such as Impacket, which is a collection of Python classes for constructing and dissecting network packets.
- You can download latest stable and development version at https://github.com/CoreSecurity/pcapy
- Latest stable release (0.11.3), updated March 31, 2018 - gzip'd tarball
- 0.11.1, updated January 16, 2017 - gzip'd tarball, zip file.
- 0.10.8, updated August 26, 2010 - gzip'd tarball, zip file.
- 0.10.7, updated July 30, 2010 - gzip'd tarball, zip file.
- 0.10.6, updated December 4, 2008 - gzip'd tarball, zip file
- 0.10.5, updated on March 27, 2007 - gzip'd tarball, zip file
Win32 binaries: Pick the appropriate Python or WinPcap version.
- 0.11.1, updated on January 16, 2017 - windows installer - Python 2.7 and WinPcap 4.1.2.
- 0.10.8, updated on August 26, 2010 - - windows installer - Python 2.5 and WinPcap 4.0.
- 0.10.6, updated on December 4, 2008 - windows installer - Python 2.5 and WinPcap 4.0.
- 0.10.5, updated on March 27, 2007 - windows installer - Python 2.5 and WinPcap 4.0.
Advantages of Pcapy
- Works with Python threads.
- Functions in both UNIX with libpcap and Windows with WinPcap.
- Provides a simpler Object Oriented API.
Click the following link to get the latest stable release. Once you have done that, unpack it and run the
python setup.py install
from the directory where you placed it.
- A Python interpreter. Versions 2.1.3 and higher.
- A C++ compiler. GCC G++ 2.95, as well as Microsoft Visual Studio 6.0 or MSVC 2003 depending on the Python version.
- A Libpcap 0.9.3 or newer. Windows users should have installed WinPcap 4.0 or newer.
Compiling the source and installing
As this extension is written in C++ it needs to be compiled for the host system before it can be accessed from Python. In order to compile and install the source, execute
python setup.py install
from the directory where Pcapy's distribution has been unpacked. This will install the extension into the default Python modules path (you might need special permissions to write there). For more information on what commands and options are available from setup.py, run:
python setup.py --help-commands
This extension has been tested on Linux and Windows 7 systems and is known to work there. However, it should work on any box where Python and libpcap are available.
Documentation is in the same folder than the source code.
Some functions that are part of the pcap API have not been wrapped.
This software is provided under a slightly modified version of the Apache Software License. Feel free to review it here and compare it to the official Apache Software License.
Whether you want to report a bug, send a patch or give some suggestions on this package, drop us a few lines at oss /at/ coresecurity.com.