Skip to main content

Python wrapper for the pcap library.

Project description

pcap-ct

Python wrapper for the pcap library.

Overview

Python pcap-ct package is a simplified object-oriented Python wrapper for libpcap C library - the current tcpdump.org version, and the WinPcap port for Windows..

pcap-ct is a pure Python package, based on the low-level libcap package.
It is fully compliant implementation of the original PyPCAP 1.2.3 API (with some minor improvements and bug fixes) by implementing whole its functionality in a clean Python instead of Cython and C.

PyPI record.

Documentation.

About original PyPCAP:

Borrowed from the original website:

PyPCAP

This is a simplified object-oriented Python wrapper for libpcap - the current tcpdump.org version, and the WinPcap port for Windows.

Example use:

>>> import pcap
>>> sniffer = pcap.pcap(name=None, promisc=True, immediate=True, timeout_ms=50)
>>> addr = lambda pkt, offset: '.'.join(str(ord(pkt[i])) for i in range(offset, offset + 4))
>>> for ts, pkt in sniffer:
...     print('%d\tSRC %-16s\tDST %-16s' % (ts, addr(pkt, sniffer.dloff + 12), addr(pkt, sniffer.dloff + 16)))
...

Windows notes

WinPcap has compatibility issues with Windows 10, therefore it’s recommended to use Npcap (Nmap’s packet sniffing library for Windows, based on the WinPcap/Libpcap libraries, but with improved speed, portability, security, and efficiency). Please enable WinPcap API-compatible mode during the library installation.

Installation

Prerequisites:

To install run:

python -m pip install --upgrade pcap-ct

Development

Prerequisites:

  • Development is strictly based on tox. To install it run:

    python -m pip install --upgrade tox

Visit development page.

Installation from sources:

clone the sources:

git clone https://github.com/karpierz/pcap-ct.git pcap-ct

and run:

python -m pip install ./pcap-ct

or on development mode:

python -m pip install --editable ./pcap-ct

License

Copyright (c) 2016-2021, Adam Karpierz
Licensed under the BSD license
Please refer to the accompanying LICENSE file.

Authors

Changelog

1.2.3b9 (2021-11-10)

  • Update for libpcap>=1.11.0b2

  • Copyright year update.

  • Fixes for Linux.

  • Setup update.

1.2.3b5 (2020-10-18)

  • Add support for Python 3.9.

  • Drop support for Python 3.5.

  • Fixed a critical setup of ‘libpcap’ package
    (thank you very much msrst@Github!).
  • General update and cleanup.

  • Fixed docs setup.

1.2.3b1 (2019-11-14)

  • Update for PyPCAP 1.2.3.

  • Add support for Python 3.8.

  • Drop support for Python 2.

  • Drop support for Python 3.4.

  • Update required setuptools version.

  • Setup improvements and cleanup.

1.2.0b5 (2018-11-08)

  • Update required setuptools version.

  • Minor setup and tests improvements.

1.2.0b4 (2018-02-26)

  • Improve and simplify setup and packaging.

1.2.0b3 (2018-02-01)

  • Update for PyPCAP 1.2.0.

1.2.0b2 (2017-10-10)

  • Minor changes.

1.2.0b1 (2017-10-05)

  • Next beta release.

  • Update for PyPCAP 1.2.0rc.

1.1.6b4 (2017-10-04)

  • Fourth beta release.

1.1.6b3 (2017-08-28)

  • Third beta release.

1.1.6b2 (2017-08-28)

  • Second beta release.

1.1.6b1 (2017-08-27)

  • First beta release.

1.1.6a15 (2017-08-25)

  • Next alpha release.

1.1.6a0 (2017-06-10)

  • First alpha release.

0.0.1 (2016-09-23)

  • Initial release.

Project details


Download files

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

Source Distribution

pcap-ct-1.2.3b9.zip (32.0 kB view details)

Uploaded Source

Built Distribution

pcap_ct-1.2.3b9-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file pcap-ct-1.2.3b9.zip.

File metadata

  • Download URL: pcap-ct-1.2.3b9.zip
  • Upload date:
  • Size: 32.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for pcap-ct-1.2.3b9.zip
Algorithm Hash digest
SHA256 579ec6ba584ee5385e69db06064a49fec429d476fcbd243af3c1b5142c248670
MD5 3eee209dc2507d42ad3f8f6e61d70c3a
BLAKE2b-256 a00be2e854438d0bcfb438581e270e043c1c28d072ae1968815b1a4e44b8cf50

See more details on using hashes here.

File details

Details for the file pcap_ct-1.2.3b9-py3-none-any.whl.

File metadata

  • Download URL: pcap_ct-1.2.3b9-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

File hashes

Hashes for pcap_ct-1.2.3b9-py3-none-any.whl
Algorithm Hash digest
SHA256 70f5cab3fc2e2cf964c4efca2867bf1ce021feaa8aa7a51d07c04cf4693a531d
MD5 47c239d9e5d1a902898fa50a06912abf
BLAKE2b-256 0d629347a7d432c2a76fa6e6a5cc4d54dbc7f0eb545fd8b16442651a02ebca11

See more details on using hashes here.

Supported by

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