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.

Installation

pip install pypcapkit

Or from a clone, for unreleased changes and 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)

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.

Usage

>>> import pcapkit
>>> extraction = pcapkit.extract('in.pcap', nofile=True)
>>> 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 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

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

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

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.6.1
File Size Uploaded Provenance Actions
pypcapkit-1.6.1.tar.gz 5.6 MB Without provenance Details for pypcapkit-1.6.1.tar.gz

Built distributions (wheels)

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

Total release size: 24.3 MB

Release files / pypcapkit-1.6.1.tar.gz

Download URL pypcapkit-1.6.1.tar.gz
Size 5.6 MB
Tags Source
SHA-256 checksum
How to use checksums
88826a7f239708fb571bb345b42a4fb16cdc67a83589ddd01059ac87667bcd50
BLAKE2b-256 checksum
How to use checksums
5ac8ec7b85663d3f81546cfae1ea09dbab8d2f95a1c1fc6f010278ef498949ba
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.6.1-pp311-none-any.whl

Download URL pypcapkit-1.6.1-pp311-none-any.whl
Size 2.3 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
3585ec48b4328c1533c4f16d4f8f9a74ca1ea872ac3e849f8c2b07a59378880d
BLAKE2b-256 checksum
How to use checksums
3c6c77d5397a312e32b7044e2a1d34bd1e86cd10a94e0aec6b9bbd0ad488ed35
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.6.1-pp310-none-any.whl

Download URL pypcapkit-1.6.1-pp310-none-any.whl
Size 2.3 MB
Tags PyPy 3.10
SHA-256 checksum
How to use checksums
f362f4861188287ca611e12578868f61203a4a6821386b5883795329e58ad4c4
BLAKE2b-256 checksum
How to use checksums
9e77c31bf20dc09c0ff4d8a2c25c769f6c0ba39af7e7505922fc6a223bc9aba1
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.6.1-cp315-none-any.whl

Download URL pypcapkit-1.6.1-cp315-none-any.whl
Size 2.3 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
027d700b85ff72d9df676e7df527e7ec5b4aa870930498af9a892dc500d8134e
BLAKE2b-256 checksum
How to use checksums
89163be06de67a2a87dac8a5ad8821af534dee5e551cd7cd6fe3a38bee6b5ffd
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.6.1-cp314-none-any.whl

Download URL pypcapkit-1.6.1-cp314-none-any.whl
Size 2.3 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
266e1882f2054070f4416ce4179be469a8b18091becc63cb511a72cde4985a21
BLAKE2b-256 checksum
How to use checksums
e7cff97aa6fc46ad1ad466af49ead7ba029a38369563e3036100d89441652b61
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.6.1-cp313-none-any.whl

Download URL pypcapkit-1.6.1-cp313-none-any.whl
Size 2.3 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
6c2f7b70516ffd04fafc7d2a8bc6b6a9bece84c235bab041aa549e7d4386495f
BLAKE2b-256 checksum
How to use checksums
232017e8b88e11d6900398b1c3df118ffac59879611bc5056866a29de1373f7d
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.6.1-cp312-none-any.whl

Download URL pypcapkit-1.6.1-cp312-none-any.whl
Size 2.3 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
24febf7e9978ec44114dae2285c2082611169f42f1dd387533db44c0da441a92
BLAKE2b-256 checksum
How to use checksums
b27360cb4e404984d157bf07a40aa7421eb8b0f6e552b1516a1383576434bcc3
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.6.1-cp311-none-any.whl

Download URL pypcapkit-1.6.1-cp311-none-any.whl
Size 2.3 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
030cb0b686e23483134932ce5ceddd2f6cc95f21015a5df60df3aa766c3a5972
BLAKE2b-256 checksum
How to use checksums
d54e42caef6a4a37b1b140451f347ed9e51f0231b7e1b4857e114571c9d9022c
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.6.1-cp310-none-any.whl

Download URL pypcapkit-1.6.1-cp310-none-any.whl
Size 2.3 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
05074d75341005f289158b64aa507d5604d3f7df2cdf8f15ffc73bdc933c730c
BLAKE2b-256 checksum
How to use checksums
dc5ebb2c5bcafab39c644ac3ed8d2c195eb25d7d0f3a87c2ab5b78aaacb65026
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.6.1

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.6.1 This release

9 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