Skip to main content

PyPCAPKit -- Comprehensive Network Packet Analysis Library

For technical and maintenance information, see the Official Documentation.

PyPCAPKit is an open-source Python library for parsing, constructing and analysing network packets and PCAP files, with DictDumper as its output dumper.

Compared with Scapy, DPKT and PyShark, pcapkit reports more detail about each packet through a more Pythonic interface. Where that depth is not needed, the same interface drives those tools as third-party extraction engines.

Requires Python 3.8 or later. CI supports 3.11 to 3.15, and tests the end-of-life 3.8 to 3.10 without letting a failure block anything. Their warnings and failures are reported in the CI reports discussions.

Installation

pip install pypcapkit

Or from a clone of develop (a plain clone is the released main), for unreleased changes and development:

git clone -b develop https://github.com/JarryShaw/PyPCAPKit.git
cd PyPCAPKit
pip install -e .

The extraction engines and plug-ins are optional extras:

pip install pypcapkit[DPKT]         # or Scapy, PyShark, PyPCAPFile, PyPCAP, PCAP_CT
pip install pypcapkit[crypto]       # ESP decryption, HIP signature verification
pip install pypcapkit[cli]          # command line interface
pip install pypcapkit[all]          # core addons only: cli + crypto + NGAP (pycrate)

Some engines need more than pip install -- a tshark binary, a C compiler, libpcap headers, or an older interpreter -- and pypcap and pcap-ct must not be installed together. The engine prerequisites give each constraint and its reason. Asking for an engine that cannot run here warns with the cause and falls back to pcapkit's own parser.

From conda, one package serves every platform and Python, with the core functionality alone:

conda install -c jarryshaw -c conda-forge pypcapkit

An optional feature takes its package from pip in that environment, such as pip install pycrate for NGAP, cryptography for ESP decryption and HIP signatures, or emoji for the command line interface.

Usage

>>> import pcapkit
>>> extraction = pcapkit.extract('in.pcap')
>>> len(extraction.frame)
6
>>> frame = extraction.frame[0]
>>> str(frame.protochain)
'Ethernet:IPv6:ICMPv6'
>>> frame.info.time
datetime.datetime(2017, 11, 19, 15, 49, 5, 471719, tzinfo=datetime.timezone.utc)
>>> frame.payload.payload.src
IPv6Address('fe80::a6:87f9:2793:16ee')

The output is from the committed examples/captures/in.pcap.

Reassembly, TCP flow tracing, the engine and the output are keyword arguments to the same call. A report is written only when dump asks for one; flow tracing writes each flow under ./tmp, or the fout of a TraceFlowOptions passed as traceflow:

>>> from pcapkit import DumpOptions
>>> scapy = pcapkit.extract('in.pcap', engine='scapy')
>>> reasm = pcapkit.extract('in.pcap', reassembly=['ipv6'])
>>> flows = pcapkit.extract('in.pcap', traceflow=['tcp'])
>>> len(flows.traceflow.tcp)
2
>>> report = pcapkit.extract('in.pcap', dump=DumpOptions(fout='out.json', format='json'))

More examples, including the command line interface, are in How to ....

Documentation

Pages of the official documentation worth knowing by name:

Page What is in it
API reference Every module, protocol and constant
Module structure What each subpackage is for
Engine comparison Which engines exist, which Python versions they run on, what each needs installed, and measured speed per packet
Engine support What each engine does not support, and how the gap is surfaced
Installation Extras and the local development setup
Testing Running the suite, and the sample captures it needs
How to ... Worked examples, library and CLI
Extensions Registering your own protocols, engines and dumpers
Documentation versions Where stable, latest and each release's documentation are served

The newest changelog entry is in CHANGELOG.md, which links to the full history; contribution guidelines are in CONTRIBUTING.md.

Metadata

Release files for pypcapkit 1.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypcapkit 1.9.0
File Size Uploaded Provenance Actions
pypcapkit-1.9.0.tar.gz 6.1 MB Without provenance Details for pypcapkit-1.9.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pypcapkit 1.9.0
File Actions
pypcapkit-1.9.0-pp312-none-any.whl PyPy 3.12 none any Details for pypcapkit-1.9.0-pp312-none-any.whl
pypcapkit-1.9.0-pp311-none-any.whl PyPy 3.11 none any Details for pypcapkit-1.9.0-pp311-none-any.whl
pypcapkit-1.9.0-pp310-none-any.whl PyPy 3.10 none any Details for pypcapkit-1.9.0-pp310-none-any.whl
pypcapkit-1.9.0-cp315-none-any.whl CPython 3.15 none any Details for pypcapkit-1.9.0-cp315-none-any.whl
pypcapkit-1.9.0-cp314-none-any.whl CPython 3.14 none any Details for pypcapkit-1.9.0-cp314-none-any.whl
pypcapkit-1.9.0-cp313-none-any.whl CPython 3.13 none any Details for pypcapkit-1.9.0-cp313-none-any.whl
pypcapkit-1.9.0-cp312-none-any.whl CPython 3.12 none any Details for pypcapkit-1.9.0-cp312-none-any.whl
pypcapkit-1.9.0-cp311-none-any.whl CPython 3.11 none any Details for pypcapkit-1.9.0-cp311-none-any.whl
pypcapkit-1.9.0-cp310-none-any.whl CPython 3.10 none any Details for pypcapkit-1.9.0-cp310-none-any.whl

Total release size: 30.1 MB

Release files / pypcapkit-1.9.0.tar.gz

Download URL pypcapkit-1.9.0.tar.gz
Size 6.1 MB
Tags Source
SHA-256 checksum
How to use checksums
b98b50897a5c516e227751bcbf0e299b44212c0c131a7b645a54562c79faa7ae
BLAKE2b-256 checksum
How to use checksums
a5df2ea2c188ea35090d537e97c96c53c900591946a6e5fc9f442d0bc621b470
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.9.0-pp312-none-any.whl

Download URL pypcapkit-1.9.0-pp312-none-any.whl
Size 2.7 MB
Tags PyPy 3.12
SHA-256 checksum
How to use checksums
b96ed7299e47cb9c59bc0b766e3d690cd3b117d1c7f0fa5d327b3b37f2866e01
BLAKE2b-256 checksum
How to use checksums
72ae957939d2d4f120e050abaf4b2089e03402b004234946e560f7c380ef6cb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.9.0-pp311-none-any.whl

Download URL pypcapkit-1.9.0-pp311-none-any.whl
Size 2.7 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
6874efc19c6bed3f74666977a83c07661077059044837fe3bbe40f0492b71fdb
BLAKE2b-256 checksum
How to use checksums
355361a31e78d9adf2dedb2249f8c9fb43bb0a51e9a552e3c1962376aa6b2678
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.9.0-pp310-none-any.whl

Download URL pypcapkit-1.9.0-pp310-none-any.whl
Size 2.7 MB
Tags PyPy 3.10
SHA-256 checksum
How to use checksums
6c1c74cf73f39d249a41fc06bf8d1641360516e043f1684a9b98b9fa62d4d759
BLAKE2b-256 checksum
How to use checksums
2a1238bcdd5095cbd63bb981500fa50352d17f8ca7e9533b5f8283bed8d5cdf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.9.0-cp315-none-any.whl

Download URL pypcapkit-1.9.0-cp315-none-any.whl
Size 2.7 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
f418513be119361db39c3374b30a70247251d43fdab0a8690dfb0fddb1e96369
BLAKE2b-256 checksum
How to use checksums
e67e83802104e40d6b8999d98fd75db94d886e44fc5709f3f825659c9ad5d551
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.9.0-cp314-none-any.whl

Download URL pypcapkit-1.9.0-cp314-none-any.whl
Size 2.7 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
09e2b2b0dfd5e8b8ba5db4b803c5aebccea8d5abae8cd1d57006088a39e0e304
BLAKE2b-256 checksum
How to use checksums
b0e1d5f4ae9d3e86ed8015d836e92ef15eac8eb0be8144269d2d119609e92f87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.9.0-cp313-none-any.whl

Download URL pypcapkit-1.9.0-cp313-none-any.whl
Size 2.7 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
9602714a3a49a70a5a84c79607733956210b8caa9e5f8de2d78bdb9830fd63dc
BLAKE2b-256 checksum
How to use checksums
2608a902fa9f57f356381c4a400d2a1a0c21ef735b239a7d0167c785e3d2c044
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.9.0-cp312-none-any.whl

Download URL pypcapkit-1.9.0-cp312-none-any.whl
Size 2.7 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
2ed432f252849223b1d2f05c1fd3ec4e68d0995970e32978bdf760ee48026c7e
BLAKE2b-256 checksum
How to use checksums
f87aaf87f9eff0c0e94c19a970add9095d127724e42f1c39e4d0da66a1a066a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.9.0-cp311-none-any.whl

Download URL pypcapkit-1.9.0-cp311-none-any.whl
Size 2.7 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
7e4dd9d787873c9ba63b5e6177e35d320bef64b79559520a0eff519e8b3e09bf
BLAKE2b-256 checksum
How to use checksums
0cd3c451e1edbbd4603aab09a91f7d23c83703222252c05e09e42e2440a0ae8c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / pypcapkit-1.9.0-cp310-none-any.whl

Download URL pypcapkit-1.9.0-cp310-none-any.whl
Size 2.7 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
5ab4bbc0889d510e9e6a372a9861d12ef56fc068f6620fa9e1b137a2f8bbe95a
BLAKE2b-256 checksum
How to use checksums
a4de5aece3dc952ee62509eb91cabe330b2a4503af829c9770fe4e31ebaee90d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Security for pypcapkit 1.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.9.0 This release

10 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page