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 is designed to be much more comprehensive, which means it is able to provide more detailed information about the packet, as well as a more Pythonic interface for users to interact with.

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.3.1.dev0.tar.gz (670.7 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.3.1.dev0-pp39-none-any.whl (975.0 kB view details)

Uploaded PyPy

pypcapkit-1.3.1.dev0-cp311-none-any.whl (975.0 kB view details)

Uploaded CPython 3.11

pypcapkit-1.3.1.dev0-cp310-none-any.whl (975.0 kB view details)

Uploaded CPython 3.10

pypcapkit-1.3.1.dev0-cp39-none-any.whl (975.0 kB view details)

Uploaded CPython 3.9

pypcapkit-1.3.1.dev0-cp38-none-any.whl (975.0 kB view details)

Uploaded CPython 3.8

File details

Details for the file pypcapkit-1.3.1.dev0.tar.gz.

File metadata

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

File hashes

Hashes for pypcapkit-1.3.1.dev0.tar.gz
Algorithm Hash digest
SHA256 9ecbe68c624ad776efa0aecd1be885f0ede5aa14f36c24c0c44fe19c86edb758
MD5 467d6c6a6826fc0179e4aabb36bc182a
BLAKE2b-256 ebad4161394a44d9a0b69998adee21327ec2d49b29aba0c49721decc03ca936b

See more details on using hashes here.

File details

Details for the file pypcapkit-1.3.1.dev0-pp39-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.3.1.dev0-pp39-none-any.whl
Algorithm Hash digest
SHA256 48445981a3e6a0a291af5ea020f07b6a4841c3691f34a16f9d0ac9a777d31222
MD5 dfd0c188f67022675481c95bfedc21ab
BLAKE2b-256 b22e39521579f269afd209b66a42fda3687683c9b631bf5ff9a652c32a822701

See more details on using hashes here.

File details

Details for the file pypcapkit-1.3.1.dev0-cp311-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.3.1.dev0-cp311-none-any.whl
Algorithm Hash digest
SHA256 0dcd025ade017c1d066aac6aecf6663f9bdc3f17e4e8345f2df18f3dea402af6
MD5 731b9603863b91bd07b6c45d5860e3f8
BLAKE2b-256 3ce81a36f75bc8a411275686d452e92794dd188702c29c66243f30514fc15f4f

See more details on using hashes here.

File details

Details for the file pypcapkit-1.3.1.dev0-cp310-none-any.whl.

File metadata

File hashes

Hashes for pypcapkit-1.3.1.dev0-cp310-none-any.whl
Algorithm Hash digest
SHA256 d540fc4b3cd463ec9ad0eab48decd7cec5de4a295c5e2d6f2a99b549b7b001f5
MD5 3316a58f230ae0d6533242c301b37d01
BLAKE2b-256 777467caba09004e97342f7969c5876b525e69ba3e6e58f6b6a8a5bf8bf8989e

See more details on using hashes here.

File details

Details for the file pypcapkit-1.3.1.dev0-cp39-none-any.whl.

File metadata

  • Download URL: pypcapkit-1.3.1.dev0-cp39-none-any.whl
  • Upload date:
  • Size: 975.0 kB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pypcapkit-1.3.1.dev0-cp39-none-any.whl
Algorithm Hash digest
SHA256 7460303294818ed7509062795b0e7be7bdd6f730b436f9acbefdee0068309611
MD5 e822d281978bd1244751e055ae3a13d1
BLAKE2b-256 ee33374f5e9c8159775358aaaa552fc0f2ae2c0de4913910da8b42c85997531f

See more details on using hashes here.

File details

Details for the file pypcapkit-1.3.1.dev0-cp38-none-any.whl.

File metadata

  • Download URL: pypcapkit-1.3.1.dev0-cp38-none-any.whl
  • Upload date:
  • Size: 975.0 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for pypcapkit-1.3.1.dev0-cp38-none-any.whl
Algorithm Hash digest
SHA256 43bfb951a47c7de9cb97e17dd5ff0f9aa280f9a6d14ad15d038612b82e14fcd3
MD5 9515fd3b69558ada05a5beaf4d636624
BLAKE2b-256 62d348578c01a471729fd95ad651d474de4d1e1cce29babd5aea87c07592ece5

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