libsniffpy
Motivation
I wanted to have a nice cython/python wrapper around libsniff. This name might confuse you, I just care about sniffing wifi packets from a nic in monitor mode.
Installation
pip install libsniffpy
Usage
Simple: Low level usage
from sniff import get_socket
# You might have to adjust
s = get_socket("wlan0mon")
# or whatever big number, forgot how big those frames are lel
raw = s.recv(3000)
Advanced: Iterate over the Radiotap frames
from sniff import get_socket, type_predicate, subtype_predicate, loop
from sys import stderr
from dpkt import ieee80211
from dpkt.radiotap import Radiotap
if __name__ == "__main__":
mgmt_predicate = type_predicate(ieee80211.MGMT_TYPE)
probe_request_predicate = subtype_predicate(ieee80211.M_PROBE_REQ)
mgmt_packets = filter(mgmt_predicate, loop("wlan0mon"))
probe_requests = filter(probe_request_predicate, mgmt_packets)
for pkg in probe_requests:
print(pkg)
Guidance for n00bs
This lib opens a raw socket for a monitor mode enabled interface. It needs privs that your user probably don't have.
Either you run this stuff as root or you do sth like this:
sudo setcap cap_net_raw,cap_net_admin=eip
on a wrapper script that calls your python interpreter.
License
This project is licensed under the GPL-3 license.
Metadata
Release files for libsniffpy 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| libsniffpy-0.3.2.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| libsniffpy-0.3.2-cp39-cp39-manylinux_2_31_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.31+ x86-64 | Details |
Total release size: 85.2 kB
Release files / libsniffpy-0.3.2.tar.gz
| Download URL | libsniffpy-0.3.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00ae244885dec28675faaf4fe827425810d0d06e7b427da91f0f65b0e9357129
|
|
BLAKE2b-256 checksum How to use checksums |
62bbe7772ca743864307a92f5bf5c3fe05a37d37782ee73e6da1afe90de94594
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.9.5 Linux/5.11.0-27-generic
|
Release files / libsniffpy-0.3.2-cp39-cp39-manylinux_2_31_x86_64.whl
| Download URL | libsniffpy-0.3.2-cp39-cp39-manylinux_2_31_x86_64.whl |
|---|---|
| Size | 81.5 kB |
| Tags | CPython 3.9 Linux glibc 2.31+ x86-64 |
|
SHA-256 checksum How to use checksums |
5ca6491a4f6540f85187951e6c4e8e8f7fcfcb4510ca38fc6ff2bc158778d6ef
|
|
BLAKE2b-256 checksum How to use checksums |
4b8a765a90206d2b7932544440f8c89f649f4416ea65d402b3965efa2658a689
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.8 CPython/3.9.5 Linux/5.11.0-27-generic
|