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 Beta (22F5037d)

Chip

Apple M2 Pro

Memory

16 GB

Test Results

Engine

Performance (ms per packet)

dpkt

0.010694_027361

scapy

0.093399_399399

pcapkit

0.199796_296296

pyshark

25.066692_025359

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.0.3.post1.tar.gz (647.3 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.0.3.post1-pp39-none-any.whl (949.8 kB view details)

Uploaded PyPy

pypcapkit-1.0.3.post1-pp38-none-any.whl (949.8 kB view details)

Uploaded PyPy

pypcapkit-1.0.3.post1-cp311-none-any.whl (949.8 kB view details)

Uploaded CPython 3.11

pypcapkit-1.0.3.post1-cp39-none-any.whl (949.8 kB view details)

Uploaded CPython 3.9

pypcapkit-1.0.3.post1-cp38-none-any.whl (949.8 kB view details)

Uploaded CPython 3.8

File details

Details for the file pypcapkit-1.0.3.post1.tar.gz.

File metadata

  • Download URL: pypcapkit-1.0.3.post1.tar.gz
  • Upload date:
  • Size: 647.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.4

File hashes

Hashes for pypcapkit-1.0.3.post1.tar.gz
Algorithm Hash digest
SHA256 bdf89a33426a050580ab44b08854aab7623a61bec29c4f6f1ad0e5254c172cf4
MD5 e39325d12a7bebd3fb8f9f61da755446
BLAKE2b-256 ddb1698a8833ec9f337ed913a674eb17fd02c0c6ee141b57edeba1c13f3cda94

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.3.post1-pp39-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.0.3.post1-pp39-none-any.whl
Algorithm Hash digest
SHA256 f1ff2565859f648a969b76b6d614e927b50abfae09b5bd659b28fe738999dc0c
MD5 a03988f090040bbe9137adccf21990ac
BLAKE2b-256 cf811f97faa5870f1238a20333978fbb751bd86887f57ac76b3d970a2f39e3a2

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.3.post1-pp38-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.0.3.post1-pp38-none-any.whl
Algorithm Hash digest
SHA256 bd27d042c7b24e977e3fa13b1eca999fa85aae62079b3e03b502612a5102f3bb
MD5 153dbbe2020d1e2801636e985884d444
BLAKE2b-256 abf1e555fcd6f049d3752e832b57f2d9b2ef11e8e71e17b6c53d464e24a58522

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.3.post1-cp311-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.0.3.post1-cp311-none-any.whl
Algorithm Hash digest
SHA256 b38c4f9d805a811f103ab5b6eb39588c1483fcf0d22ed8e7a0694dc109398c5d
MD5 780a2abf02f1b933cd65e08e7924cd00
BLAKE2b-256 0023d9325d62686ac04867d57e57634f59d9000cf39d56727e8e069f3a540bce

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.3.post1-cp39-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.0.3.post1-cp39-none-any.whl
Algorithm Hash digest
SHA256 cccee4c1bd64ad21cddcbe56086d4800950b6bf2421d2fd75a59cf040d3a814c
MD5 f6d65241d6e415f9de7423832d0c0364
BLAKE2b-256 cd7d4eb2e1aebc601c0ee2b0f374ea2059ff7631a4f23dca4cdc9b6aebd3ae50

See more details on using hashes here.

File details

Details for the file pypcapkit-1.0.3.post1-cp38-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.0.3.post1-cp38-none-any.whl
Algorithm Hash digest
SHA256 f655a1135c7952d9d5f5754786b00768b8ccafe372733959401172b71faf78ea
MD5 6c7b557857c45f0c3136c43c18c20c70
BLAKE2b-256 3e6a2a8846837eecba819f23da3f8bb605084225f9cc2d0be87147e58d47c9ca

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