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

Uploaded PyPy

pypcapkit-1.2.2.dev0-pp38-none-any.whl (966.8 kB view details)

Uploaded PyPy

pypcapkit-1.2.2.dev0-cp311-none-any.whl (966.8 kB view details)

Uploaded CPython 3.11

pypcapkit-1.2.2.dev0-cp310-none-any.whl (966.8 kB view details)

Uploaded CPython 3.10

pypcapkit-1.2.2.dev0-cp39-none-any.whl (966.8 kB view details)

Uploaded CPython 3.9

pypcapkit-1.2.2.dev0-cp38-none-any.whl (966.8 kB view details)

Uploaded CPython 3.8

File details

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

File metadata

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

File hashes

Hashes for pypcapkit-1.2.2.dev0.tar.gz
Algorithm Hash digest
SHA256 88391c91d45bd5c074efbad09fb9bcb39278eea16138d4ff6f2f31bad23379f7
MD5 92eafb1b3d709dfc4336b211337acb5d
BLAKE2b-256 09cb66bc4fc6bd3c1c28ce4029ca75097a99be22570a4c473d9c1496f97e983a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypcapkit-1.2.2.dev0-pp39-none-any.whl
Algorithm Hash digest
SHA256 a616b453b650d987843cd9bfd35ae79d5fd9c8e5a06d8cb872fb0488e65ab59a
MD5 6b8b54cf06c40cce48adc23d9c844d17
BLAKE2b-256 f4566e40e902b71bc8d48a8f3542e942e520918e589ef7f00eea36495d0ee8ea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypcapkit-1.2.2.dev0-pp38-none-any.whl
Algorithm Hash digest
SHA256 ad2bb1b71f5f38fbc3dce3c4748b2390512a1fda178fabec144605ac87c2bd33
MD5 710622482b465122b55218322028019d
BLAKE2b-256 089529d72ec4b4e940da5067b7f4bae67d4323c82da9d314cd913e9421e177a8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypcapkit-1.2.2.dev0-cp311-none-any.whl
Algorithm Hash digest
SHA256 3497ec5fbac4c848402ef266cbce28fde11a952e5860d32b53e3c31f2e3af376
MD5 9bd49539291f036de0d05450e67c9b6b
BLAKE2b-256 c55e276c1250540f71885f40706f26f07088a141694d3a1b87f02df8f786a9a3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pypcapkit-1.2.2.dev0-cp310-none-any.whl
Algorithm Hash digest
SHA256 4e86fb3d319a367a6914e9a40e0ba6f0f407138ce052a878ec8c287a952f4528
MD5 2a8f79784a135d174dec735bb23e805d
BLAKE2b-256 6ca0b566786bf84ce59f055763cee44e0cfb93c8c85d9c5ae83acfe16bafbec7

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pypcapkit-1.2.2.dev0-cp39-none-any.whl
Algorithm Hash digest
SHA256 6770d3f990ad0951ac950f81e5343de828d9d6ecbad0af5b17c067aa24fdef90
MD5 af2bc583369124675d04df389359249b
BLAKE2b-256 8ee3bce90d887535764e9a5f405ce111b8e473cf81ee947aa309d483f287c163

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for pypcapkit-1.2.2.dev0-cp38-none-any.whl
Algorithm Hash digest
SHA256 46e906490875b1dbea95bd7e85850fdd3b1a5c54ddccdbdd114f1a962172b716
MD5 4dc3dbd2c4e1ef52377c0cedded035ea
BLAKE2b-256 f683f9efda924e7769c9f5bbdaed355babe84e6fa5df0a4e337c77f018b5a570

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