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 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 requires Python 3.8 or later. CI supports 3.11 to 3.15, and still 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 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 engine prerequisites give 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: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, 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, 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, and contribution guidelines are in CONTRIBUTING.md.

Metadata

Release files for pypcapkit 1.6.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.6.0
File Size Uploaded Provenance Actions
pypcapkit-1.6.0.tar.gz 5.7 MB Without provenance Details for pypcapkit-1.6.0.tar.gz

Built distributions (wheels)

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

Total release size: 25.0 MB

Release files / pypcapkit-1.6.0.tar.gz

Download URL pypcapkit-1.6.0.tar.gz
Size 5.7 MB
Tags Source
SHA-256 checksum
How to use checksums
276670bfdbc4bcf864512816b3aa07fad3c15fe602b01f2c00bd66c64ec5477f
BLAKE2b-256 checksum
How to use checksums
dc4cc65df0740dbffe24e6dab8c642b668b085a90ca8836e94db60f1d325716a
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.0-pp311-none-any.whl

Download URL pypcapkit-1.6.0-pp311-none-any.whl
Size 2.4 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
1f1cad9e1e68218e1b1b51e8d934251aac90806aca0b0128705e39c9376781c2
BLAKE2b-256 checksum
How to use checksums
bb3763cac2519b5c7927540b6f7f608c683c43e006df5330cf72b838cda3e796
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.0-pp310-none-any.whl

Download URL pypcapkit-1.6.0-pp310-none-any.whl
Size 2.4 MB
Tags PyPy 3.10
SHA-256 checksum
How to use checksums
e846f8845829d980d93230f3ffcd0bb6badec5b426403a2f5eee68600ace019b
BLAKE2b-256 checksum
How to use checksums
1fb151a9276347a6d91dab490b32497acf010cfae414c431fee8bc981cea9b73
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.0-cp315-none-any.whl

Download URL pypcapkit-1.6.0-cp315-none-any.whl
Size 2.4 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
31107ec6f1cde0eabf2dabefe9cbae5fef355d7ce15857e82cd504cb2cb491ae
BLAKE2b-256 checksum
How to use checksums
c1d8a3ac4cf3c8858925358930aee54220bcfe581c8e7ff227914630586585e6
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.0-cp314-none-any.whl

Download URL pypcapkit-1.6.0-cp314-none-any.whl
Size 2.4 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
be788f26a0e8ac1cfde4a3412944ddac39fc57be7906f4092b896af10666d751
BLAKE2b-256 checksum
How to use checksums
6602ece0ea6a5180777024a067d5fe36cc26b2148289fac2da0acde6f34b850c
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.0-cp313-none-any.whl

Download URL pypcapkit-1.6.0-cp313-none-any.whl
Size 2.4 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
14f8593792905c6b72d8699ebd105fa7c8e1f81ba08fa4e121dc2d58207eccfd
BLAKE2b-256 checksum
How to use checksums
803ebaa79209ebc0b94917732f2b6c9e3d5423c0a7f1b2404eb810dcf25feaa4
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.0-cp312-none-any.whl

Download URL pypcapkit-1.6.0-cp312-none-any.whl
Size 2.4 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
e61f12f9603097fb8bc1af801b4c505b60ccf1726dc6637f17f00e0d52580b34
BLAKE2b-256 checksum
How to use checksums
b793e4c915e82740533cbadfb4eef63e68d1ac4608e02f6c9146add7c6307b7f
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.0-cp311-none-any.whl

Download URL pypcapkit-1.6.0-cp311-none-any.whl
Size 2.4 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
71aaaafd6520521616416d5cec0b5189e0d385e42c49eea9346663ba48d48e8b
BLAKE2b-256 checksum
How to use checksums
584feafe228120dfc75de339b56ee46d5fb552be59d998d4e5f0c080b00e1051
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.0-cp310-none-any.whl

Download URL pypcapkit-1.6.0-cp310-none-any.whl
Size 2.4 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
5a1818ad46644e2b23cea3821ac9ae1c9f47d2c584b9f2cfac91c3384e8d90d3
BLAKE2b-256 checksum
How to use checksums
6b25ee5c0bb643ceca650ad97c7e82ec2862453781c703b18ef05ca080f26778
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.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.6.0 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