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. Their warnings and failures are reported in the CI reports discussions.

Installation

pip install pypcapkit

Or from a clone of develop (a plain clone is the released main), for unreleased changes and development:

git clone -b develop 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 decryption, HIP signature verification; not on PyPy 3.12+
pip install pypcapkit[cli]          # command line interface
pip install pypcapkit[all]          # core addons only: cli + crypto + NGAP (pycrate); no crypto on PyPy 3.12+

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.

From conda, one package serves every platform and Python, with the core functionality alone:

conda install -c jarryshaw -c conda-forge pypcapkit

An optional feature takes its package from pip in that environment, such as pip install pycrate for NGAP, cryptography for ESP decryption and HIP signatures, or emoji for the command line interface.

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
Documentation versions Where stable, latest and each release's documentation are served

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

Built distributions (wheels)

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

Total release size: 27.4 MB

Release files / pypcapkit-1.9.1.tar.gz

Download URL pypcapkit-1.9.1.tar.gz
Size 6.1 MB
Tags Source
SHA-256 checksum
How to use checksums
8fd7bee36bc978aa1efaab86d7610b40b783b8ba3469012aeeb94d9ab52dc9b5
BLAKE2b-256 checksum
How to use checksums
32a20c85d852c440143b9e9aa3631abd7566757e25581b22ba3b6145229a56a6
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.9.1-pp312-none-any.whl

Download URL pypcapkit-1.9.1-pp312-none-any.whl
Size 2.7 MB
Tags PyPy 3.12
SHA-256 checksum
How to use checksums
5b8855d53038b12f1a605a82ebabf699035516e277295b61406079660533db3e
BLAKE2b-256 checksum
How to use checksums
cb9f0346a900a098cefd0f9e2555501ba517142631d35bacd06edf39733fe2e2
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.9.1-pp311-none-any.whl

Download URL pypcapkit-1.9.1-pp311-none-any.whl
Size 2.7 MB
Tags PyPy 3.11
SHA-256 checksum
How to use checksums
6c5bb1bb4226505349e96ad69db1736592769f7b3e34e6635713675bd6dbf79d
BLAKE2b-256 checksum
How to use checksums
3f3ae679e93b2f964034bc8e9d7af928cfd6182cd3546b6d46bf8d116a2aab9b
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.9.1-pp310-none-any.whl

Download URL pypcapkit-1.9.1-pp310-none-any.whl
Size 2.7 MB
Tags PyPy 3.10
SHA-256 checksum
How to use checksums
c0f7fc2682637a6799649cac44b1cad138d56a3a8b9d00dbcf68522d4da0f54b
BLAKE2b-256 checksum
How to use checksums
25aa2c680baff44645b0ad9911fff38506aa9ed6919631f69773735c520756d1
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.9.1-cp315-none-any.whl

Download URL pypcapkit-1.9.1-cp315-none-any.whl
Size 2.7 MB
Tags CPython 3.15
SHA-256 checksum
How to use checksums
b9a3764eca49fec52bc20354eb1704abc66278b0bb8f7c069359b9471288486e
BLAKE2b-256 checksum
How to use checksums
33ff508a2764006b9727527eaf9e4a1b0792991e1ea77ba67fefa016be7d657d
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.9.1-cp314-none-any.whl

Download URL pypcapkit-1.9.1-cp314-none-any.whl
Size 2.7 MB
Tags CPython 3.14
SHA-256 checksum
How to use checksums
989349984282c4674a6584f2ad9397a509526c9963d2c756d45333610847d7bd
BLAKE2b-256 checksum
How to use checksums
3ab0126db10644d4ec87b99918e6ec7d0fe2a2bc71d15ff4d5ab8b7d52112cb3
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.9.1-cp312-none-any.whl

Download URL pypcapkit-1.9.1-cp312-none-any.whl
Size 2.7 MB
Tags CPython 3.12
SHA-256 checksum
How to use checksums
741c110cf0f388891285d0e59c09c226901abce0049f12d712ee0d9c63cc4d5b
BLAKE2b-256 checksum
How to use checksums
9a2157ce600f6919c36a83e24521b15042cbe74a0005299d29b74669200fcbe5
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.9.1-cp311-none-any.whl

Download URL pypcapkit-1.9.1-cp311-none-any.whl
Size 2.7 MB
Tags CPython 3.11
SHA-256 checksum
How to use checksums
51ef88dd816f0963fcebf8375a88bf2e5230d66be72b6a63f1fb2e030b526f8f
BLAKE2b-256 checksum
How to use checksums
f58d516765d1cd088689f673cac9c3a687e5de8eb6190057baa8eabb81b3180e
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.9.1-cp310-none-any.whl

Download URL pypcapkit-1.9.1-cp310-none-any.whl
Size 2.7 MB
Tags CPython 3.10
SHA-256 checksum
How to use checksums
de47e797219e94cccad8606e6d85545dd719196c0897daca813d93bbd7a6b8bc
BLAKE2b-256 checksum
How to use checksums
d9944714838e9fceecd2d54996b245d7b4b1ade066ed2c27cb93289ac123c663
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.9.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.9.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