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

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.7.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.7.0
File Size Uploaded Provenance Actions
pypcapkit-1.7.0.tar.gz 5.9 MB Without provenance Details for pypcapkit-1.7.0.tar.gz

Built distributions (wheels)

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

Total release size: 28.5 MB

Release files / pypcapkit-1.7.0.tar.gz

Download URL pypcapkit-1.7.0.tar.gz
Size 5.9 MB
Tags Source
SHA-256 checksum
How to use checksums
efbb38ab70b30aec5403cb8e0563e9cd3db900d3c27e070a5e1666c62285e634
BLAKE2b-256 checksum
How to use checksums
705af668c63c8b8532e9351add0e2077e3561b3f5376925e0e531aaa526afd45
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.7.0-pp312-none-any.whl

Download URL pypcapkit-1.7.0-pp312-none-any.whl
Size 2.5 MB
Tags PyPy 3.12
SHA-256 checksum
How to use checksums
8ec0ce3b35d972968c5e8f7fb3dac58bb61b4631bc7d38fd377999c9d4151745
BLAKE2b-256 checksum
How to use checksums
af232554cebacabc447c7f04fe1ac6f6dce62080dfb67935bd75c76dd7a03f2d
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.7.0-pp311-none-any.whl

Download URL pypcapkit-1.7.0-pp311-none-any.whl
Size 2.5 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
5a2846b0cd17b65f82e24dc1b7e9c99e79738c151ee55953a455e788d9322def
BLAKE2b-256 checksum
How to use checksums
d5bf6a76f3cd36160c66d9107fbf4302ae96ed0a20a98d3025e204325b0d8687
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.7.0-pp310-none-any.whl

Download URL pypcapkit-1.7.0-pp310-none-any.whl
Size 2.5 MB
Tags PyPy 3.10
SHA-256 checksum
How to use checksums
8ca84c196821340671e2f0f8017203cf4db26d288e65a69033594a7b12072d41
BLAKE2b-256 checksum
How to use checksums
36eed9e00b4f546cfe2d7e0f285881d40f506a4a9c857ba7b118a592c8445954
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.7.0-cp315-none-any.whl

Download URL pypcapkit-1.7.0-cp315-none-any.whl
Size 2.5 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
39640b99b855b9b4dc2a79b9c45f1294239306e0c7be110aab4f6743a460c716
BLAKE2b-256 checksum
How to use checksums
07b896eb107c2b29ba3bf945dae04f824fb27b9be79a9717f030694a98528451
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.7.0-cp314-none-any.whl

Download URL pypcapkit-1.7.0-cp314-none-any.whl
Size 2.5 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
77346733f018effda0ed140f355ed76aa883f65242006b6d4aa5f355ab19c98d
BLAKE2b-256 checksum
How to use checksums
be10b6497726f90f665e11493764caf698136588e880e33089b7c6a9ca4b9cb6
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.7.0-cp313-none-any.whl

Download URL pypcapkit-1.7.0-cp313-none-any.whl
Size 2.5 MB
Tags CPython 3.13
SHA-256 checksum
How to use checksums
77a4108d7eeaf2d40184528b5d59d3ed7eadc034c06a24612f50117c290837f1
BLAKE2b-256 checksum
How to use checksums
88111b45349bbb0b869b326fddc9b7489a219a56b10b447d76e5f8ed3c584f60
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.7.0-cp312-none-any.whl

Download URL pypcapkit-1.7.0-cp312-none-any.whl
Size 2.5 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
00d96a783c3722476abdfdbe474a4998f362b19d4ec9cb0f5c91bb65d948b942
BLAKE2b-256 checksum
How to use checksums
dcfd05fa1f9efb855598ef2ed6c3167fd2e92a3f825847a87c86603aa0335edd
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.7.0-cp311-none-any.whl

Download URL pypcapkit-1.7.0-cp311-none-any.whl
Size 2.5 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
18b1cce6256cf25951e8f9b02c040621218227a5fb3264aa4e896ef48e951c6f
BLAKE2b-256 checksum
How to use checksums
5dd7e043c84fb0de3555f47cf60bc23d3d2f6d23576fe0efab909175fa49e9fb
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.7.0-cp310-none-any.whl

Download URL pypcapkit-1.7.0-cp310-none-any.whl
Size 2.5 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
20f579752dab35cb5037e1b8a2fd58fc6649d30194f2d73a6084c10f09f2eaa4
BLAKE2b-256 checksum
How to use checksums
6934a24c4542a95fa21eed8b09a006ed1d1fddf7492370d601550ffba25b5a7d
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.7.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.7.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