Comments (16)
@zayn1991 could you try:
$ pip3 install --upgrade pip
$ pip3 install --upgrade git+https://github.com/kti/python-netfilterqueue
from geneva.
Hey @compliment - thanks for trying Geneva out! Can you give me more info on your setup? What OS are you running this on, and which netfilterqueue did you install?
from geneva.
Sorry about that.
I'm running Arch Linux with 5.4.14 kernel
Python 3.8.1
libnetfilter_queue 1.0.3
About netfilterqueue, pip has 0.8.1 as latest version but some pip couldn't compile it on my system. 0.8.1 was released on Jan 31, 2017 so I had to install it from the source (https://github.com/kti/python-netfilterqueue) which compiled successfully.
from geneva.
Hey @compliment - I assume by "1.8.1", do you mean "0.8.1". I'm concerned why pip couldn't compile it on your system - my guess is the custom compilation didn't setup the bindings properly or something. I've never had an issue with pip installing it before with the proper dependencies - can you post a log of trying to install that? This might be an issue with missing other dependencies with Arch - I've never tried to set up netfilter on Arch before.
from geneva.
Hi!
I have different issue with netfilterqueue
.
Ubuntu 19.10
Python 3.7.5
1step:
zayn@dell:~/Рабочий стол$ sudo apt-get install build-essential python-dev libnetfilter-queue-dev libffi-dev libssl-dev iptables python3-pip
installed versions:
build-essential (12.8ubuntu1).
iptables (1.8.3-2ubuntu5).
libffi-dev (3.2.1-9).
libssl-dev (1.1.1c-1ubuntu4).
libnetfilter-queue-dev (1.0.3-1).
python-dev (2.7.17-1).
python3-pip (18.1-5).
2step:
zayn@dell:~/Загрузки/geneva-master$ python3 -m pip install -r requirements.txt
Requirement already satisfied: scapy==2.4.3 in /home/zayn/.local/lib/python3.7/site-packages (from -r requirements.txt (line 1)) (2.4.3)
Requirement already satisfied: requests in /usr/lib/python3/dist-packages (from -r requirements.txt (line 2)) (2.21.0)
Requirement already satisfied: netifaces in /usr/lib/python3/dist-packages (from -r requirements.txt (line 3)) (0.10.4)
Collecting netfilterqueue (from -r requirements.txt (line 4))
Using cached https://files.pythonhosted.org/packages/39/c4/8f73f70442aa4094b3c37876c96cddad2c3e74c058f6cd9cb017d37ffac0/NetfilterQueue-0.8.1.tar.gz
Collecting cryptography==2.8 (from -r requirements.txt (line 5))
Using cached https://files.pythonhosted.org/packages/45/73/d18a8884de8bffdcda475728008b5b13be7fbef40a2acc81a0d5d524175d/cryptography-2.8-cp34-abi3-manylinux1_x86_64.whl
Collecting anytree (from -r requirements.txt (line 7))
Using cached https://files.pythonhosted.org/packages/a8/65/be23d8c3ecd68d40541d49812cd94ed0f3ee37eb88669ca15df0e43daed1/anytree-2.8.0-py2.py3-none-any.whl
Collecting cffi!=1.11.3,>=1.8 (from cryptography==2.8->-r requirements.txt (line 5))
Using cached https://files.pythonhosted.org/packages/ff/1d/0b743dadcdf4980b717163fd2d24cd18c1c0c7a78a076268afd7e0e2c25e/cffi-1.14.0-cp37-cp37m-manylinux1_x86_64.whl
Requirement already satisfied: six>=1.4.1 in /usr/lib/python3/dist-packages (from cryptography==2.8->-r requirements.txt (line 5)) (1.12.0)
Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography==2.8->-r requirements.txt (line 5))
Building wheels for collected packages: netfilterqueue
Running setup.py bdist_wheel for netfilterqueue ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-2zedpj5r/netfilterqueue/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-xql2yzjn --python-tag cp37:
running bdist_wheel
running build
running build_ext
building 'netfilterqueue' extension
creating build
creating build/temp.linux-x86_64-3.7
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.7m -c netfilterqueue.c -o build/temp.linux-x86_64-3.7/netfilterqueue.o
netfilterqueue.c: In function ‘__pyx_f_14netfilterqueue_6Packet_set_nfq_data’:
netfilterqueue.c:2150:68: warning: passing argument 2 of ‘nfq_get_payload’ from incompatible pointer type [-Wincompatible-pointer-types]
2150 | __pyx_v_self->payload_len = nfq_get_payload(__pyx_v_self->_nfa, (&__pyx_v_self->payload));
| ~^~~~~~~~~~~~~~~~~~~~~~~
| |
| char **
In file included from netfilterqueue.c:440:
/usr/include/libnetfilter_queue/libnetfilter_queue.h:122:67: note: expected ‘unsigned char **’ but argument is of type ‘char **’
122 | extern int nfq_get_payload(struct nfq_data *nfad, unsigned char **data);
| ~~~~~~~~~~~~~~~~^~~~
netfilterqueue.c: In function ‘__pyx_pf_14netfilterqueue_6Packet_4get_hw’:
netfilterqueue.c:2533:17: warning: implicit declaration of function ‘PyString_FromStringAndSize’; did you mean ‘PyBytes_FromStringAndSize’? [-Wimplicit-function-declaration]
2533 | __pyx_t_3 = PyString_FromStringAndSize(((char *)__pyx_v_self->hw_addr), 8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| PyBytes_FromStringAndSize
netfilterqueue.c:2533:15: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
2533 | __pyx_t_3 = PyString_FromStringAndSize(((char *)__pyx_v_self->hw_addr), 8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
| ^
netfilterqueue.c: In function ‘__Pyx_PyCFunction_FastCall’:
netfilterqueue.c:6436:13: error: too many arguments to function ‘(PyObject * (*)(PyObject *, PyObject * const*, Py_ssize_t))meth’
6436 | return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netfilterqueue.c: In function ‘__Pyx__ExceptionSave’:
netfilterqueue.c:7132:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
7132 | *type = tstate->exc_type;
| ^~~~~~~~
| curexc_type
netfilterqueue.c:7133:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
7133 | *value = tstate->exc_value;
| ^~~~~~~~~
| curexc_value
netfilterqueue.c:7134:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
7134 | *tb = tstate->exc_traceback;
| ^~~~~~~~~~~~~
| curexc_traceback
netfilterqueue.c: In function ‘__Pyx__ExceptionReset’:
netfilterqueue.c:7141:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
7141 | tmp_type = tstate->exc_type;
| ^~~~~~~~
| curexc_type
netfilterqueue.c:7142:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
7142 | tmp_value = tstate->exc_value;
| ^~~~~~~~~
| curexc_value
netfilterqueue.c:7143:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
7143 | tmp_tb = tstate->exc_traceback;
| ^~~~~~~~~~~~~
| curexc_traceback
netfilterqueue.c:7144:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
7144 | tstate->exc_type = type;
| ^~~~~~~~
| curexc_type
netfilterqueue.c:7145:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
7145 | tstate->exc_value = value;
| ^~~~~~~~~
| curexc_value
netfilterqueue.c:7146:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
7146 | tstate->exc_traceback = tb;
| ^~~~~~~~~~~~~
| curexc_traceback
netfilterqueue.c: In function ‘__Pyx__GetException’:
netfilterqueue.c:7201:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
7201 | tmp_type = tstate->exc_type;
| ^~~~~~~~
| curexc_type
netfilterqueue.c:7202:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
7202 | tmp_value = tstate->exc_value;
| ^~~~~~~~~
| curexc_value
netfilterqueue.c:7203:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
7203 | tmp_tb = tstate->exc_traceback;
| ^~~~~~~~~~~~~
| curexc_traceback
netfilterqueue.c:7204:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
7204 | tstate->exc_type = local_type;
| ^~~~~~~~
| curexc_type
netfilterqueue.c:7205:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
7205 | tstate->exc_value = local_value;
| ^~~~~~~~~
| curexc_value
netfilterqueue.c:7206:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
7206 | tstate->exc_traceback = local_tb;
| ^~~~~~~~~~~~~
| curexc_traceback
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Failed building wheel for netfilterqueue
Running setup.py clean for netfilterqueue
Failed to build netfilterqueue
Installing collected packages: netfilterqueue, pycparser, cffi, cryptography, anytree
Running setup.py install for netfilterqueue ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-2zedpj5r/netfilterqueue/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-m2d86x0m/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_ext
building 'netfilterqueue' extension
creating build
creating build/temp.linux-x86_64-3.7
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.7m -c netfilterqueue.c -o build/temp.linux-x86_64-3.7/netfilterqueue.o
netfilterqueue.c: In function ‘__pyx_f_14netfilterqueue_6Packet_set_nfq_data’:
netfilterqueue.c:2150:68: warning: passing argument 2 of ‘nfq_get_payload’ from incompatible pointer type [-Wincompatible-pointer-types]
2150 | __pyx_v_self->payload_len = nfq_get_payload(__pyx_v_self->_nfa, (&__pyx_v_self->payload));
| ~^~~~~~~~~~~~~~~~~~~~~~~
| |
| char **
In file included from netfilterqueue.c:440:
/usr/include/libnetfilter_queue/libnetfilter_queue.h:122:67: note: expected ‘unsigned char **’ but argument is of type ‘char **’
122 | extern int nfq_get_payload(struct nfq_data *nfad, unsigned char **data);
| ~~~~~~~~~~~~~~~~^~~~
netfilterqueue.c: In function ‘__pyx_pf_14netfilterqueue_6Packet_4get_hw’:
netfilterqueue.c:2533:17: warning: implicit declaration of function ‘PyString_FromStringAndSize’; did you mean ‘PyBytes_FromStringAndSize’? [-Wimplicit-function-declaration]
2533 | __pyx_t_3 = PyString_FromStringAndSize(((char *)__pyx_v_self->hw_addr), 8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| PyBytes_FromStringAndSize
netfilterqueue.c:2533:15: warning: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
2533 | __pyx_t_3 = PyString_FromStringAndSize(((char *)__pyx_v_self->hw_addr), 8); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 111, __pyx_L1_error)
| ^
netfilterqueue.c: In function ‘__Pyx_PyCFunction_FastCall’:
netfilterqueue.c:6436:13: error: too many arguments to function ‘(PyObject * (*)(PyObject *, PyObject * const*, Py_ssize_t))meth’
6436 | return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
netfilterqueue.c: In function ‘__Pyx__ExceptionSave’:
netfilterqueue.c:7132:21: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
7132 | *type = tstate->exc_type;
| ^~~~~~~~
| curexc_type
netfilterqueue.c:7133:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
7133 | *value = tstate->exc_value;
| ^~~~~~~~~
| curexc_value
netfilterqueue.c:7134:19: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
7134 | *tb = tstate->exc_traceback;
| ^~~~~~~~~~~~~
| curexc_traceback
netfilterqueue.c: In function ‘__Pyx__ExceptionReset’:
netfilterqueue.c:7141:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
7141 | tmp_type = tstate->exc_type;
| ^~~~~~~~
| curexc_type
netfilterqueue.c:7142:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
7142 | tmp_value = tstate->exc_value;
| ^~~~~~~~~
| curexc_value
netfilterqueue.c:7143:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
7143 | tmp_tb = tstate->exc_traceback;
| ^~~~~~~~~~~~~
| curexc_traceback
netfilterqueue.c:7144:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
7144 | tstate->exc_type = type;
| ^~~~~~~~
| curexc_type
netfilterqueue.c:7145:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
7145 | tstate->exc_value = value;
| ^~~~~~~~~
| curexc_value
netfilterqueue.c:7146:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
7146 | tstate->exc_traceback = tb;
| ^~~~~~~~~~~~~
| curexc_traceback
netfilterqueue.c: In function ‘__Pyx__GetException’:
netfilterqueue.c:7201:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
7201 | tmp_type = tstate->exc_type;
| ^~~~~~~~
| curexc_type
netfilterqueue.c:7202:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
7202 | tmp_value = tstate->exc_value;
| ^~~~~~~~~
| curexc_value
netfilterqueue.c:7203:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
7203 | tmp_tb = tstate->exc_traceback;
| ^~~~~~~~~~~~~
| curexc_traceback
netfilterqueue.c:7204:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
7204 | tstate->exc_type = local_type;
| ^~~~~~~~
| curexc_type
netfilterqueue.c:7205:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
7205 | tstate->exc_value = local_value;
| ^~~~~~~~~
| curexc_value
netfilterqueue.c:7206:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
7206 | tstate->exc_traceback = local_tb;
| ^~~~~~~~~~~~~
| curexc_traceback
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-2zedpj5r/netfilterqueue/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-m2d86x0m/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-2zedpj5r/netfilterqueue/
3step:
zayn@dell:~/Загрузки/geneva-master$ python3 engine.py --server-port 80 --strategy "[TCP:flags:PA]-duplicate(tamper{TCP:dataofs:replace:10}(tamper{TCP:chksum:corrupt},),)-|" --log debug
Traceback (most recent call last):
File "engine.py", line 17, in <module>
import netfilterqueue
ModuleNotFoundError: No module named 'netfilterqueue'
from geneva.
Regarding the error SystemError: <method 'run_socket' of 'netfilterqueue.NetfilterQueue' objects> returned NULL without setting an error
, I have the same issue on Debian 10 (buster) Python 3.7.3 and kali linux 2020.1 Python 3.7.6.
Netfilter queue works fine on my machine with this test:
$ sudo iptables -A OUTPUT -j NFQUEUE --queue-num 3
#!/usr/bin/python3
from netfilterqueue import NetfilterQueue
from scapy.all import *
def packetanalyzer(pkt):
ip=IP(pkt.get_payload())
print(f"New packet from {ip.src} and to {ip.dst}")
pkt.accept()
nfqueue=NetfilterQueue()
nfqueue.bind(3, packetanalyzer)
nfqueue.run()
from geneva.
Checked on Ubuntu 18.04.4 LTS. Works fine
from geneva.
@zayn1991 could you try:
$ pip3 install --upgrade pip $ pip3 install --upgrade git+https://github.com/kti/python-netfilterqueue
(Ubuntu 19.10)
Tried after your commands and this is result:
x1@123:~/Загрузки/geneva-master$ sudo python3 engine.py --server-port 80 --strategy "[TCP:flags:PA]-duplicate(tamper{TCP:dataofs:replace:10}(tamper{TCP:chksum:corrupt},),)-|" --log debug
[sudo] пароль для x1:
Traceback (most recent call last):
File "engine.py", line 17, in <module>
import netfilterqueue
ModuleNotFoundError: No module named 'netfilterqueue'
from geneva.
Try replacing pip3
in his commands with python3 -m pip
. That usually happens when pip and python start pointing to different locations.
from geneva.
It works on ubuntu 18.04 but not on Debian even in a clean venv :
# id
uid=0(root) gid=0(root) groups=0(root)
# python3 -m venv /tmp/geneva
# . /tmp/geneva/bin/activate
# which pip3
/tmp/geneva/bin/pip3
# which python3
/tmp/geneva/bin/python3
# python3 --version
Python 3.7.3
# python3 -m pip install wheel
# python3 -m pip install git+https://github.com/kti/python-netfilterqueue
# python3 -m pip install -r requirements.txt
# python3 -m pip freeze
anytree==2.8.0
certifi==2019.11.28
cffi==1.14.0
chardet==3.0.4
cryptography==2.8
idna==2.8
NetfilterQueue==0.8.1
netifaces==0.10.9
pkg-resources==0.0.0
pycparser==2.19
requests==2.22.0
scapy==2.4.3
six==1.14.0
urllib3==1.25.8
# python3 engine.py --server-port 80 --strategy "[TCP:flags:PA]-duplicate(tamper{TCP:dataofs:replace:10}(tamper{TCP:chksum:corrupt},),)-|" --log debug
2020-02-18 08:38:05 DEBUG:[ENGINE] Engine created with strategy [TCP:flags:PA]-duplicate(tamper{TCP:dataofs:replace:10}(tamper{TCP:chksum:corrupt},),)-| \/ (ID prsz38ve) to port 80
2020-02-18 08:38:05 DEBUG:[ENGINE] Configuring iptables rules
2020-02-18 08:38:05 DEBUG:[ENGINE] iptables -A OUTPUT -p tcp --dport 80 -j NFQUEUE --queue-num 1
2020-02-18 08:38:05 DEBUG:[ENGINE] iptables -A INPUT -p tcp --sport 80 -j NFQUEUE --queue-num 2
2020-02-18 08:38:05 DEBUG:[ENGINE] iptables -A OUTPUT -p udp --dport 80 -j NFQUEUE --queue-num 1
2020-02-18 08:38:05 DEBUG:[ENGINE] iptables -A INPUT -p udp --sport 80 -j NFQUEUE --queue-num 2
2020-02-18 08:38:05 DEBUG:[ENGINE] NFQueue Initialized after 0
2020-02-18 08:38:06 ERROR:[ENGINE] Exception out of run_nfqueue() (direction=in)
Traceback (most recent call last):
File "engine.py", line 115, in run_nfqueue
nfqueue.run_socket(nfqueue_socket)
SystemError: <method 'run_socket' of 'netfilterqueue.NetfilterQueue' objects> returned NULL without setting an error
2020-02-18 08:38:06 ERROR:[ENGINE] Exception out of run_nfqueue() (direction=out)
Traceback (most recent call last):
File "engine.py", line 115, in run_nfqueue
nfqueue.run_socket(nfqueue_socket)
SystemError: <method 'run_socket' of 'netfilterqueue.NetfilterQueue' objects> returned NULL without setting an error
# cat test.py
from netfilterqueue import NetfilterQueue
def print_and_accept(pkt):
print(pkt)
pkt.accept()
nfqueue = NetfilterQueue()
nfqueue.bind(1, print_and_accept)
try:
nfqueue.run()
except KeyboardInterrupt:
print('')
nfqueue.unbind()
# iptables -A OUTPUT -j NFQUEUE --queue-num 1
# python3 test.py
TCP packet, 52 bytes
TCP packet, 64 bytes
UDP packet, 60 bytes
from geneva.
Try replacing
pip3
in his commands withpython3 -m pip
. That usually happens when pip and python start pointing to different locations.
Ubuntu 19.10:
Did
x1@123:~/Загрузки/geneva-master$ sudo python3 -m pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 1.1MB/s
Installing collected packages: pip
Found existing installation: pip 18.1
Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'pip'. No files were found to uninstall.
Successfully installed pip-20.0.2
x1@123:~/Загрузки/geneva-master$ sudo python3 -m pip install --upgrade git+https://github.com/kti/python-netfilterqueue
Collecting git+https://github.com/kti/python-netfilterqueue
Cloning https://github.com/kti/python-netfilterqueue to /tmp/pip-req-build-mnbtqctk
Running command git clone -q https://github.com/kti/python-netfilterqueue /tmp/pip-req-build-mnbtqctk
Building wheels for collected packages: NetfilterQueue
Building wheel for NetfilterQueue (setup.py) ... done
Created wheel for NetfilterQueue: filename=NetfilterQueue-0.8.1-cp37-cp37m-linux_x86_64.whl size=170060 sha256=bff2c8891203f5af17af8b824ec8dffa7a61330296d75b9506f550a109297da2
Stored in directory: /tmp/pip-ephem-wheel-cache-heagpw9a/wheels/bf/2b/65/62cbc5ee216b5e6985d40dd82d38feaf9efe5945ec946cea1b
Successfully built NetfilterQueue
Installing collected packages: NetfilterQueue
Successfully installed NetfilterQueue-0.8.1
x1@123:~/Загрузки/geneva-master$ sudo python3 engine.py --server-port 80 --strategy "[TCP:flags:PA]-duplicate(tamper{TCP:dataofs:replace:10}(tamper{TCP:chksum:corrupt},),)-|" --log debug
Traceback (most recent call last):
File "engine.py", line 19, in <module>
from scapy.layers.inet import IP
ModuleNotFoundError: No module named 'scapy'
Still can't run this
from geneva.
from geneva.
@zayn1991 could you try:
$ pip3 install --upgrade pip $ pip3 install --upgrade git+https://github.com/kti/python-netfilterqueue
This worked for me on Ubuntu 19.10, Thank you!
from geneva.
I have the same problem and reinstalling with the comment you said didn't help.
5.5.7-150.current
Solus OS
Traceback (most recent call last):
File "engine.py", line 115, in run_nfqueue
nfqueue.run_socket(nfqueue_socket)
SystemError: <method 'run_socket' of 'netfilterqueue.NetfilterQueue' objects> returned NULL without setting an error
from geneva.
Hey @Xcess - sorry for the delay. I don't know if Solus is supported by netfilterqueue - sounds like an issue that should be taken up with their team. If you do get it supported, please reach back out and I'd be happy to update the docs!
from geneva.
I'm getting the same error in Ubuntu 20.04 unfortunately. Any idea on what I can do?
ubuntu@instance-20200501-0913:~/geneva$ sudo python3 engine.py --server-port 80 --strategy "[TCP:flags:PA]-duplicate(tamper{IP:len:replace:64},)-|" --log debug
2020-08-18 21:38:36 WARNING:[ENGINE] No environment ID given, one has been generated (2mn7qqlc)
2020-08-18 21:38:36 DEBUG:[ENGINE] Engine created with strategy [TCP:flags:PA]-duplicate(tamper{IP:len:replace:64},)-| \/ (ID 2mn7qqlc) to port 80
2020-08-18 21:38:36 DEBUG:[ENGINE] Configuring iptables rules
2020-08-18 21:38:36 DEBUG:[ENGINE] iptables -A OUTPUT -p tcp --dport 80 -j NFQUEUE --queue-num 2
2020-08-18 21:38:36 DEBUG:[ENGINE] iptables -A INPUT -p tcp --sport 80 -j NFQUEUE --queue-num 1
2020-08-18 21:38:36 DEBUG:[ENGINE] iptables -A OUTPUT -p udp --dport 80 -j NFQUEUE --queue-num 2
2020-08-18 21:38:36 DEBUG:[ENGINE] iptables -A INPUT -p udp --sport 80 -j NFQUEUE --queue-num 1
2020-08-18 21:38:36 DEBUG:[ENGINE] NFQueue Initialized after 0
2020-08-18 21:38:37 ERROR:[ENGINE] Exception out of run_nfqueue() (direction=in)
Traceback (most recent call last):
File "engine.py", line 197, in run_nfqueue
nfqueue.run_socket(nfqueue_socket)
SystemError: <method 'run_socket' of 'netfilterqueue.NetfilterQueue' objects> returned NULL without setting an error
2020-08-18 21:38:37 ERROR:[ENGINE] Exception out of run_nfqueue() (direction=out)
Traceback (most recent call last):
File "engine.py", line 197, in run_nfqueue
nfqueue.run_socket(nfqueue_socket)
SystemError: <method 'run_socket' of 'netfilterqueue.NetfilterQueue' objects> returned NULL without setting an error
from geneva.
Related Issues (20)
- How to use it ?
- How to use it ? HOT 6
- What should I do if the server is particularly memory hungry? HOT 1
- os support HOT 1
- OSError: Failed to create queue 1. HOT 2
- Where working strategies are stored HOT 1
- No strategies found
- Make geneva a package HOT 7
- My Geneva is not working properly,Who can help me?
- geneva HOT 1
- geneva error: Traceback (most recent call last) HOT 3
- How to setup alpha version in Windows 10? HOT 3
- FileNotFoundError: [Errno 2] No such file or directory: b'liblibc.a' HOT 3
- Sharing some points about Geneva Project HOT 1
- NAT problem
- libc.a not found
- How to evolve DNS strategies
- how to deal with Code 501
- Failure when the number of connections are huge! HOT 2
- FileNotFoundError: [Errno 2] No such file or directory: b'liblibc.a' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geneva.