pcap-ct documentation¶
pcap-ct¶
Python wrapper for the pcap library.
Overview¶
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 #1:
>>> 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)))
...
Example use #2:
Listing Interfaces
>>> import pcap
>>> print ("Interfaces:\n" + '\n'.join(pcap.findalldevs()))
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:
Python 3.7 or higher
3.7 with C libpcap 1.8.1 is a primary test environment.
ATTENTION: currently tested only for Windows.
pip and setuptools
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-2022, Adam KarpierzLicensed under the BSD licensePlease refer to the accompanying LICENSE file.
Contents¶
- Changelog
- 1.3.0b1 (2022-09-10)
- 1.2.3b14 (2022-08-30)
- 1.2.3b12 (2022-01-19)
- 1.2.3b11 (2022-01-10)
- 1.2.3b9 (2021-11-10)
- 1.2.3b5 (2020-10-18)
- 1.2.3b1 (2019-11-14)
- 1.2.0b5 (2018-11-08)
- 1.2.0b4 (2018-02-26)
- 1.2.0b3 (2018-02-01)
- 1.2.0b2 (2017-10-10)
- 1.2.0b1 (2017-10-05)
- 1.1.6b4 (2017-10-04)
- 1.1.6b3 (2017-08-28)
- 1.1.6b2 (2017-08-28)
- 1.1.6b1 (2017-08-27)
- 1.1.6a15 (2017-08-25)
- 1.1.6a0 (2017-06-10)
- 0.0.1 (2016-09-23)