Skip to main content

PyPCAPKit: comprehensive network packet analysis library

Project description

For any technical and/or maintenance information, please kindly refer to the Official Documentation.

The PyPCAPKit project is an open source Python program focus on network packet parsing and analysis, which works as a comprehensive PCAP file extraction, construction and analysis library.

The whole project supports Python 3.6 or later.

About

PyPCAPKit is a comprehensive Python-native network packet analysis library, with DictDumper as its formatted output dumper.

Unlike popular PCAP file extractors, such as Scapy, DPKT, PyShark, and etc, pcapkit uses streaming strategy to read input files. That is to read frame by frame, decrease occupation on memory, as well as enhance efficiency in some way.

Module Structure

In pcapkit, all files can be described as following eight parts.

  • Interface (pcapkit.interface)

    User interface for the pcapkit library, which standardises and simplifies the usage of this library.

  • Foundation (pcapkit.foundation)

    Synthesises file I/O and protocol analysis, coordinates information exchange in all network layers, as well as provides the foundamental functions for pcapkit.

  • Protocols (pcapkit.protocols)

    Collection of all protocol family, with detailed implementation and methods.

  • Utilities (pcapkit.utilities)

    Auxiliary functions and tools for pcapkit.

  • CoreKit (pcapkit.corekit)

    Core utilities for pcapkit implementation, mainly for internal data structure and processing.

  • ToolKit (pcapkit.toolkit)

    Auxiliary tools for pcapkit to support the multiple extraction engines with a unified interface.

  • DumpKit (pcapkit.dumpkit)

    File output formatters for pcapkit.

  • Constants (pcapkit.const)

    Constant enumerations used in pcapkit for protocol family extraction and representation.

Engine Comparison

Due to the general overhead of pcapkit, its extraction procedure takes around 0.2 milliseconds per packet, which is already impressive but not enough comparing to other popular extration engines availbale on the market, given the fact that pcapkit is a comprehensive packet processing module.

Additionally, pcapkit introduced alternative extractionengines to accelerate this procedure. By now pcapkit supports Scapy, DPKT, and PyShark.

Test Environment

Operating System

macOS Ventura 13.4.1

Chip

Apple M2 Pro

Memory

16 GB

Test Results

Engine

Performance (ms per packet)

dpkt

0.010390_056723

scapy

0.091690_233567

pcapkit

0.200390_390390

pyshark

24.682185_018351

Installation

Simply run the following to install the current version from PyPI:

pip install pypcapkit

Or install the latest version from the gi repository:

git clone https://github.com/JarryShaw/PyPCAPKit.git
cd pypcapkit
pip install -e .
# and to update at any time
git pull

And since pcapkit supports various extraction engines, and extensive plug-in functions, you may want to install the optional ones:

# for DPKT only
pip install pypcapkit[DPKT]
# for Scapy only
pip install pypcapkit[Scapy]
# for PyShark only
pip install pypcapkit[PyShark]
# and to install all the optional packages
pip install pypcapkit[all]
# or to do this explicitly
pip install pypcapkit dpkt scapy pyshark

For CLI usage, you will need to install the optional packages:

pip install pypcapkit[cli]
# or explicitly...
pip install pypcapkit emoji

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypcapkit-1.2.2.post2.tar.gz (667.1 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pypcapkit-1.2.2.post2-pp39-none-any.whl (971.0 kB view details)

Uploaded PyPy

pypcapkit-1.2.2.post2-pp38-none-any.whl (971.0 kB view details)

Uploaded PyPy

pypcapkit-1.2.2.post2-cp311-none-any.whl (971.0 kB view details)

Uploaded CPython 3.11

pypcapkit-1.2.2.post2-cp310-none-any.whl (971.0 kB view details)

Uploaded CPython 3.10

pypcapkit-1.2.2.post2-cp39-none-any.whl (971.0 kB view details)

Uploaded CPython 3.9

pypcapkit-1.2.2.post2-cp38-none-any.whl (971.0 kB view details)

Uploaded CPython 3.8

File details

Details for the file pypcapkit-1.2.2.post2.tar.gz.

File metadata

  • Download URL: pypcapkit-1.2.2.post2.tar.gz
  • Upload date:
  • Size: 667.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pypcapkit-1.2.2.post2.tar.gz
Algorithm Hash digest
SHA256 19549dc9ca68a3068cd169fd9f4a77cf1cc441608e0e6a829351d08782c0e2d1
MD5 28ff7061135c70a864392a050ed10745
BLAKE2b-256 b6a8cebb7de0fb2cf02ccf2d143ca761cf207a803f9d229e6c17c4e09cc41d62

See more details on using hashes here.

File details

Details for the file pypcapkit-1.2.2.post2-pp39-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.2.2.post2-pp39-none-any.whl
Algorithm Hash digest
SHA256 1754be80f9d33c27724e4ae26a221b439d1c622cc45f6e6c57b213730a736d73
MD5 c9f70540828506166d6e819d124d9da7
BLAKE2b-256 ddaa9d03774d9484b30449a84b9f90f5d704d200ea399bee4e78012183a3db07

See more details on using hashes here.

File details

Details for the file pypcapkit-1.2.2.post2-pp38-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.2.2.post2-pp38-none-any.whl
Algorithm Hash digest
SHA256 542bb6cefe9b610db3952267549f6ffbac342f42c980d39a2d9dd36dfb2cdc11
MD5 e5ef77025dbf2c45243e955c901db880
BLAKE2b-256 e2b0b8773a90b562ca7badfbdb1bf923aea84b3fc6d76cfcba529eee30ae08d6

See more details on using hashes here.

File details

Details for the file pypcapkit-1.2.2.post2-cp311-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.2.2.post2-cp311-none-any.whl
Algorithm Hash digest
SHA256 f3268d9178a7153fa00ee244db4727df317baa24e17ba851157d5a5e1acc9fe6
MD5 3b6a7c47632cc012b37f4c5c63f2a1c6
BLAKE2b-256 e38aa7871b27a1c472b164f9449760ec73c72ae4f503d5b7f95f616aa82f5c5a

See more details on using hashes here.

File details

Details for the file pypcapkit-1.2.2.post2-cp310-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.2.2.post2-cp310-none-any.whl
Algorithm Hash digest
SHA256 e6aafd6070eb1d995b6ae89a36a935a4f033465c332aa60131d9c806007afc5c
MD5 188b3de8b5f0cc39c13da35f567c26a3
BLAKE2b-256 eddbd0bd9b0ab6c96cd314d9a0f1a9a845b4c17f93c28963462bcbacb495645e

See more details on using hashes here.

File details

Details for the file pypcapkit-1.2.2.post2-cp39-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.2.2.post2-cp39-none-any.whl
Algorithm Hash digest
SHA256 de5731ce47284237419609472d9f29e051f90ecad5f8046a2282d1740aa41fa5
MD5 3218b0c243fff8d60f041e9ad2f09137
BLAKE2b-256 c9b833f24d0db42809cadce6a2a0b2575cfc9ac937431e21119203d69c3d0059

See more details on using hashes here.

File details

Details for the file pypcapkit-1.2.2.post2-cp38-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.2.2.post2-cp38-none-any.whl
Algorithm Hash digest
SHA256 ecc8255938f38ae94ef3db1bb2d5d3b38cf89831758d175c61f9cdaa96c9d932
MD5 7e995c20f620332daa4444f5fb2ed846
BLAKE2b-256 49dbe026e35f7533ed5c33959d3710b25cb86b5224463559de736744f553d26e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page