shramos / polymorph

Polymorph is a real-time network packet manipulation framework with support for almost all existing protocols
GNU General Public License v2.0
445 stars 61 forks source link

Exception generator raised StopIteration #8

Closed ghost closed 5 years ago

ghost commented 5 years ago

When I launch polymorph command in a python3.7 virtualenv, I get an error loop

Unhandled exception in event loop: File "/usr/pip3/lib/python3.7/site-packages/polymorph/deps/prompt_toolkit/eventloop/coroutine.py", line 90, in step_next new_f = coroutine.throw(exc)

File "/usr/pip3/lib/python3.7/site-packages/polymorph/deps/prompt_toolkit/history.py", line 57, in _start_loading item_callback=add_string))

File "/usr/pip3/lib/python3.7/site-packages/polymorph/deps/prompt_toolkit/eventloop/coroutine.py", line 86, in step_next new_f = coroutine.send(None)

Any solution to fix this ?

shramos commented 5 years ago

Hello jJit0, thanks for the comment. That error has been fixed in the latest version, please try to reinstall polymorph (with pip) or update it.

More information: https://github.com/shramos/polymorph/issues/7

ghost commented 5 years ago

The thing is I can't update it from pip, because NetfilterQueue can't be installed in python3.7

Requirement already up-to-date: polymorph in /usr/pip3/lib/python3.7/site-packages (1.0.3) Requirement already satisfied, skipping upgrade: termcolor in /usr/pip3/lib/python3.7/site-packages (from polymorph) (1.1.0) Requirement already satisfied, skipping upgrade: netaddr in /usr/pip3/lib/python3.7/site-packages (from polymorph) (0.7.19) Collecting NetfilterQueue (from polymorph) Using cached https://files.pythonhosted.org/packages/39/c4/8f73f70442aa4094b3c37876c96cddad2c3e74c058f6cd9cb017d37ffac0/NetfilterQueue-0.8.1.tar.gz

netfilterqueue.c:2150:68: warning: passing argument 2 of ‘nfq_get_payload’ from incompatible pointer type [-Wincompatible-pointer-types] pyx_v_self->payload_len = nfq_get_payload(__pyx_v_self->_nfa, (&pyx_v_self->payload)); ~^~~~~~~ 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 ’ 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]
       __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]
       __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’
       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’?
       *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’?
       *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’?
       *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’?
       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’?
       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’?
       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’?
       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’?
       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’?
       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’?
       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’?
       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’?
       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’?
       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’?
       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’?
       tstate->exc_traceback = local_tb;
               ^~~~~~~~~~~~~
               curexc_traceback
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Failed building wheel for NetfilterQueue

I copied the last version I had from my backup disk

Any idea how to fix that ?
shramos commented 5 years ago

Yes, NetfilterQueue is having problems when installing from pip with python3.7. To solve the problem you can clone the repository (https://github.com/kti/python-netfilterqueue) and run python setup.py install. In this way you should be able to install the dependency.

ghost commented 5 years ago

That's great, it worked for me that way. What I did was :

pip3 install -U git+https://github.com/kti/python-netfilterqueue pip3 install -U polymorph

Thanks again, appreciate it :smile: