Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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 formatted output dumper.

Unlike popular PCAP extractors such as 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 also drives third-party extraction engines.

The whole project declares Python 3.6 or later. CI supports 3.11 to 3.15, and still tests the end-of-life 3.7 to 3.10 without letting a failure block anything; 3.7 cannot import the package yet.

Installation

pip install pypcapkit

Or from a clone, for the latest version and for development:

git clone 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 payload decryption
pip install pypcapkit[cli]          # command line interface
pip install pypcapkit[all]          # core addons only: cli + crypto + NGAP (pycrate)

Engines are on demand; all bundles only the core addons the library needs for full functionality. Some engines also need something beyond pip install -- a tshark binary, a C compiler, libpcap headers, or an older interpreter -- and pypcap/pcap-ct must never be installed together. The installation guide gives each constraint and its reason. pcapkit enforces them in code: asking for an engine that cannot run in the current environment warns with the cause and falls back to its own parser.

Usage

>>> import pcapkit
>>> extraction = pcapkit.extract('in.pcap', nofile=True)
>>> len(extraction.frame)
6
>>> frame = extraction.frame[0]
>>> str(frame.protochain)
'Ethernet:IPv6:IPv6_ICMP'
>>> 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, so it is reproducible from a clone.

Reassembly, TCP flow tracing and the engine are keyword arguments to the same call:

>>> scapy = pcapkit.extract('in.pcap', nofile=True, engine='scapy')
>>> reasm = pcapkit.extract('in.pcap', nofile=True, reassembly=True, ipv6=True)
>>> flows = pcapkit.extract('in.pcap', nofile=True, trace=True, tcp=True)
>>> len(flows.trace.tcp)
2

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

Documentation

The official documentation is the reference. Pages 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, and measured speed per packet
Engine support What each engine does not support, and how the gap is surfaced
Installation Extras, engine prerequisites 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

Release history is in CHANGELOG.md, and contribution guidelines are in CONTRIBUTING.md.

Metadata

Release files for pypcapkit 1.5.0b14

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.5.0b14
File Size Uploaded Provenance
pypcapkit-1.5.0b14.tar.gz 4.3 MB Without provenance Details

Built distributions (wheels)

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

Total release size: 19.5 MB

Release files / pypcapkit-1.5.0b14.tar.gz

Download URL pypcapkit-1.5.0b14.tar.gz
Size 4.3 MB
Tags Source
SHA-256 checksum
How to use checksums
7d88ceac7277096c2facf1458bea37309997f246f5115383b50ed1941c315473
BLAKE2b-256 checksum
How to use checksums
e0ce3a682127b06ffc850e62109bb4d1a10e0dc81d5a01068bb675bb5f516cf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pypcapkit-1.5.0b14-pp311-none-any.whl

Download URL pypcapkit-1.5.0b14-pp311-none-any.whl
Size 1.9 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
774dbc3aca7ed6ae933786ac210e332a9fcee64dcf2e3e03a5a451ef2f8050b7
BLAKE2b-256 checksum
How to use checksums
23447c1f198e0350c5c4ee90999458ba1994e71060c5b17808bec35f5d41280e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pypcapkit-1.5.0b14-pp310-none-any.whl

Download URL pypcapkit-1.5.0b14-pp310-none-any.whl
Size 1.9 MB
Tags PyPy 3.10
SHA-256 checksum
How to use checksums
1c6942d5bf65ca756b997f7b5fe8c987d304ff430c198570f9b401efe4f1c9b3
BLAKE2b-256 checksum
How to use checksums
ee5a29e060e79cd769525f9498fb883914fe5fe70ff905a815b2b9cb3d7c8c1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pypcapkit-1.5.0b14-cp315-none-any.whl

Download URL pypcapkit-1.5.0b14-cp315-none-any.whl
Size 1.9 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
944b45ebfc9d14561b3cfc9ec024e0407e1ee4eddae608a7ce974645f0a7ee6c
BLAKE2b-256 checksum
How to use checksums
e8aa210444dcc3dbba3a66d086ee9f82f209bb59151b6d9010e14cc21f7f04b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pypcapkit-1.5.0b14-cp314-none-any.whl

Download URL pypcapkit-1.5.0b14-cp314-none-any.whl
Size 1.9 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
d88e4013466da40cfbf184a88dcf1c01deba3e7dceefdfbac681318669e52bca
BLAKE2b-256 checksum
How to use checksums
c398fbe4574440f03f1a78d7c691b8dbc64d5d1279a6ea40507fb9b325f8c4a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pypcapkit-1.5.0b14-cp313-none-any.whl

Download URL pypcapkit-1.5.0b14-cp313-none-any.whl
Size 1.9 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
9a814fa3cbfe28c53af573cacf5c53c315ca443ccae1cff56dc33b9ea5599cca
BLAKE2b-256 checksum
How to use checksums
ebc6d7c61d9e312f8490261ee0a6a21fb257a09824c4df95162adf9458a669ab
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pypcapkit-1.5.0b14-cp312-none-any.whl

Download URL pypcapkit-1.5.0b14-cp312-none-any.whl
Size 1.9 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
ad197bcfe4a8e79c87aa9c882638f7a1d86739fd8e5659a21e39ef5126e30f98
BLAKE2b-256 checksum
How to use checksums
e19e2d9ce0e7183d3f725e8e56b829c7313e4df6738879453d1f138290b12c0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pypcapkit-1.5.0b14-cp311-none-any.whl

Download URL pypcapkit-1.5.0b14-cp311-none-any.whl
Size 1.9 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
c8b4e44af5ae513e4fe0d0ef8715abac88ed8b4a2d3cf718bf84fef99c0f687a
BLAKE2b-256 checksum
How to use checksums
0f7cd329686b06cd21fed950e330224c7bc97b6571e9b25ffc10c8526c5c4ca6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / pypcapkit-1.5.0b14-cp310-none-any.whl

Download URL pypcapkit-1.5.0b14-cp310-none-any.whl
Size 1.9 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
3938fc9b3302c4e908af0da314ac623f3148ac2f72c10a8e927fbccd7c679900
BLAKE2b-256 checksum
How to use checksums
cad2a2a974169d079bce7e2bad16cbbb4d4059e045e5dfad94914004e2391a00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Security for pypcapkit 1.5.0b14

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
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