Skip to main content

Python wrapper for the pcap library (ctypes/cffi-based pypcap)

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.0 API (with some minor improvements and bug fixes) by implementing whole its functionality in a clean Python instead of Cython and C.

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.

Requirements

  • It is fully independent package.
    All necessary things are installed during the normal installation process.
  • ATTENTION: currently works and tested only for Windows.

Installation

Prerequisites:

To install run:

python -m pip install --upgrade pcap-ct

Development

Visit development page

Installation from sources:

Clone the sources and run:

python -m pip install ./pcap-ct

or on development mode:

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

Prerequisites:

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

    python -m pip install tox

License

Copyright (c) 2016-2018, Adam Karpierz

Licensed under the BSD license
Please refer to the LICENSE file.

Authors

Changelog

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.0b5.zip (26.1 kB view details)

Uploaded Source

File details

Details for the file pcap-ct-1.2.0b5.zip.

File metadata

  • Download URL: pcap-ct-1.2.0b5.zip
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for pcap-ct-1.2.0b5.zip
Algorithm Hash digest
SHA256 759779df7e787f5f6c2aa052e4becd74f0fee29793d124279504bb1b397c4519
MD5 652502faae28c646c92e4e9414da2525
BLAKE2b-256 a72f678e987a26eb2656c32b786d1c31f463a910a635f337d1d2b1575b2b9779

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