fnfqueue
Fast netfilter nfqueue python and C interface. Gets the speed from
- avoiding memory allocation
- batching reads (uses
recv_mmsg)
It also does not use the callback-like interface of libnetfilter-queue and provides a more python like iterator interface. Additionally, it doesn't assume anything and therefore doesn't automatically set verdicts on packets (unlike python-nfqueue in debian which accepts everything after you return from the callback...)
It can handle ping -f (even iperf if the moon is in the right spot) to localhost from within python.
Focus is on a python like interface.
Short example for mangling packets:
iptables -A OUTPUT <filter here> -j NFQUEUE --queue-num 1
import fnfqueue
queue = 1
conn = fnfqueue.Connection()
try:
q = conn.bind(queue)
q.set_mode(0xffff, fnfqueue.COPY_PACKET)
except PermissionError:
print("Access denied; Do I have root rights or the needed capabilities?")
sys.exit(-1)
while True:
try:
for packet in conn:
packet.payload = packet.payload # modify the packet here
packet.mangle()
except fnfqueue.BufferOverflowException:
print("buffer error")
pass
conn.close() # this can be called concurrently to cancel the above for loop
Help is provided as python docs.
No C libraries are needed. Needs cffi for building. Kernel and libc must be recent enough to support nfqueue and recvmmsg (linux 2.6.33, glibc 2.12 - more recent kernels provide better performance).
Release files for fnfqueue 1.1.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 | |
|---|---|---|---|
| fnfqueue-1.1.2.tar.gz | 14.5 kB | Details |
Built distributions (wheels)
Total release size:344.0 kB
Release files / fnfqueue-1.1.2.tar.gz
| Download URL | fnfqueue-1.1.2.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4aa1843058fc6b4e3e7537d980f01163d4605f9e4a829f23098e5c6979b61a8
|
|
BLAKE2b-256 checksum How to use checksums |
e08456aaa9de8eddaf78f48c82de0db5b1463c10dd7bb596367a09ed8f82bf0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / fnfqueue-1.1.2-pp39-pypy39_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fnfqueue-1.1.2-pp39-pypy39_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 16.4 kB |
| Tags | Linux glibc 2.12+ x86-64 Linux glibc 2.28+ x86-64 PyPy 3.9 PyPy 3.9 7.3 |
|
SHA-256 checksum How to use checksums |
2a444e8202f0f67c6ff35e861ae27132742c45794df546b61f27182c3b2d7069
|
|
BLAKE2b-256 checksum How to use checksums |
a76e3e9e229fad36637d94b328c2f78a88a5aa69eb65e07dd231cdbbfa0e15d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / fnfqueue-1.1.2-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fnfqueue-1.1.2-pp38-pypy38_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 16.3 kB |
| Tags | Linux glibc 2.12+ x86-64 Linux glibc 2.28+ x86-64 PyPy 3.8 PyPy 3.8 7.3 |
|
SHA-256 checksum How to use checksums |
992ed387dc4a562daf51045da1a41b43742e80e0284e602823f0c780fa188d76
|
|
BLAKE2b-256 checksum How to use checksums |
178e4c4a4720eee4cd5a803a41dee09c48adb58a40a6661dfdd1152fda926140
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / fnfqueue-1.1.2-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fnfqueue-1.1.2-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Linux glibc 2.12+ x86-64 Linux glibc 2.28+ x86-64 PyPy 3.7 PyPy 3.7 7.3 |
|
SHA-256 checksum How to use checksums |
b47c991f002246ed2dfb9c2f973e4e85e5567129274f435a2458c7be7988c22b
|
|
BLAKE2b-256 checksum How to use checksums |
b318aee03f48a0b1e5636399693c4f21cfe245165a1ed55fa0efb5257bc3ac9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / fnfqueue-1.1.2-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fnfqueue-1.1.2-cp311-cp311-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 46.7 kB |
| Tags | CPython 3.11 Linux glibc 2.12+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
0ce8f3832de95026d7f9fa5a20d2cd394d9bc201573529cc142c6b9b4e07b413
|
|
BLAKE2b-256 checksum How to use checksums |
23d0e15a9b3c63ccb029f9c0cf1bbe81074ed617ee911709a8324f63ba621fdf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / fnfqueue-1.1.2-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fnfqueue-1.1.2-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 46.7 kB |
| Tags | CPython 3.10 Linux glibc 2.12+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
abe6ed5f66e4cd2f6b6aaac1bd35acfb11803488ace617509b60af0dd3f53b0c
|
|
BLAKE2b-256 checksum How to use checksums |
4f7c705a8da06e849c0ab05e51925b4a20293071e4daa93442a54858d0bd17d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / fnfqueue-1.1.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fnfqueue-1.1.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 46.7 kB |
| Tags | CPython 3.9 Linux glibc 2.12+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
2ccd3b144af2d63f4dd3ad2eefdaeeb020e05e2f2757e76e327d3a40adb30f0f
|
|
BLAKE2b-256 checksum How to use checksums |
250257f1cf5f196d37eebf090adc00c0311015bc13f8b256c7555c95e9414dc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / fnfqueue-1.1.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fnfqueue-1.1.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 46.9 kB |
| Tags | CPython 3.8 Linux glibc 2.12+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
b917c4c765fd76573998ed799db6de6fc48453ba8a594e12e7f77b5290b3ab18
|
|
BLAKE2b-256 checksum How to use checksums |
9efa274c1d11b176cd768c9dfa9b8d9029b79abd7335181595889ba2a8708f2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / fnfqueue-1.1.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fnfqueue-1.1.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 46.6 kB |
| Tags | CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
39f69c1d96aca17b53af895ccd7b906c441e986d28ff2ae68c2f7f2e778d93d1
|
|
BLAKE2b-256 checksum How to use checksums |
1421f10f2504f0bd970e18652cfe405a1d94cc9d4f4c674847fd7170265d603b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|
Release files / fnfqueue-1.1.2-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl
| Download URL | fnfqueue-1.1.2-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 46.6 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f9330c8d8ec801f2d30fdcb8613a794dc7442d36503e5ea9f6f5c15e568c2356
|
|
BLAKE2b-256 checksum How to use checksums |
4593cc377e1bc3977640c346d5733a19749c8c6604cda4f0eedd65de90cc4f14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.2
|