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

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

Built distributions (wheels)

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

Total release size: 26.5 MB

Release files / pypcapkit-1.6.2.tar.gz

Download URL pypcapkit-1.6.2.tar.gz
Size 5.6 MB
Tags Source
SHA-256 checksum
How to use checksums
a8b420d501576320617349552be39d20cb179f12c2f7ca93a5db6318c4912bfe
BLAKE2b-256 checksum
How to use checksums
f41e8ace4351e904a99707f981b8efbfc708a61dfeb7fabd7a373301c541940a
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.2-pp312-none-any.whl

Download URL pypcapkit-1.6.2-pp312-none-any.whl
Size 2.3 MB
Tags PyPy 3.12
SHA-256 checksum
How to use checksums
32dc494f0cc657359871a976ca349a3d314f2cfd803a21c97250f5a26cee3799
BLAKE2b-256 checksum
How to use checksums
971fa01df4476389465025e7541b9a2029cb06ac166725983740c68e503c5cb9
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.2-pp311-none-any.whl

Download URL pypcapkit-1.6.2-pp311-none-any.whl
Size 2.3 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
93d48509e9d895c811063fdf82265270ab88746aab4a5af8e6269e2a36fc6b98
BLAKE2b-256 checksum
How to use checksums
d244e0389791810ffdabc50146d4931751beb2aa82ad3b4fed2f53aa0b0d05aa
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.2-pp310-none-any.whl

Download URL pypcapkit-1.6.2-pp310-none-any.whl
Size 2.3 MB
Tags PyPy 3.10
SHA-256 checksum
How to use checksums
34a9457f4273ed42c193a8e527adfff01a57315d9e3c1d8f538f3ed1769a29e4
BLAKE2b-256 checksum
How to use checksums
62a2d13b463a889ea8d65205bd4502edf60f6ef077e5e92a2b895e91cb91b73d
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.2-cp315-none-any.whl

Download URL pypcapkit-1.6.2-cp315-none-any.whl
Size 2.3 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
e7cee218d62445c2256e85b33989c670d89df51bcb594efbdcbec072f2f7c228
BLAKE2b-256 checksum
How to use checksums
3e5c5b97414e78510277ab990767e4aa64209e800d70a03c9a861ed4e2d1d24b
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.2-cp314-none-any.whl

Download URL pypcapkit-1.6.2-cp314-none-any.whl
Size 2.3 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
aa817f5ac26faac4d45f4b0ef6a5936fb626fa5c634a8f2252050160772ef45d
BLAKE2b-256 checksum
How to use checksums
601c8cfb073b0d76174dea30b0feebc67d347f6517a33c769660a04e4d5639d8
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.2-cp313-none-any.whl

Download URL pypcapkit-1.6.2-cp313-none-any.whl
Size 2.3 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
f94286b2697658a1dc19f4477028febc4464fade66dc42be275605375abec304
BLAKE2b-256 checksum
How to use checksums
b9c6d189176c48b229cdb1fe046fc2bad3f2d2b96145dcb8300e5250716bec97
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.2-cp312-none-any.whl

Download URL pypcapkit-1.6.2-cp312-none-any.whl
Size 2.3 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
51498408a63954fa7f946fb0629eb6a5c7d592af0c0c4f4883f614e6b86d5ff8
BLAKE2b-256 checksum
How to use checksums
581ded9b0cd75198dfce686e2dc85de28b26e7df0bdad9bb12a76b83372ef3e5
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.2-cp311-none-any.whl

Download URL pypcapkit-1.6.2-cp311-none-any.whl
Size 2.3 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
baed55080be605c58bada8282351afced7cc02ab95119d20b42ecae797cf2168
BLAKE2b-256 checksum
How to use checksums
a0d740836fa07c8aaa979cbe9c71e0919f24ccbf91ad0fdf9a957431737f7ef1
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.2-cp310-none-any.whl

Download URL pypcapkit-1.6.2-cp310-none-any.whl
Size 2.3 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
6dae33d32bc54160a2924efa62cb311e634721a0bb630a01ed82ab63970cc19b
BLAKE2b-256 checksum
How to use checksums
b644a27d464d27beda99ca0d37de520bdb215037535a5dd3b970be5b908c109a
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.2

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