Kkevsterrr / geneva

automated censorship evasion for the client-side and server-side
https://censorship.ai
BSD 3-Clause "New" or "Revised" License
1.89k stars 175 forks source link

TypeError: '_sre.SRE_Match' object is not subscriptable #4

Closed xhdix closed 4 years ago

xhdix commented 4 years ago

I can't run it.

# 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 329, in main
    log_level=args["log"])
  File "engine.py", line 54, in __init__
    self.strategy = actions.utils.parse(string_strategy, self.logger)
  File "/root/geneva/actions/utils.py", line 74, in parse
    new_tree.parse(str_action, logger)
  File "/root/geneva/actions/tree.py", line 180, in parse
    if not match or not match[0]:
TypeError: '_sre.SRE_Match' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "engine.py", line 338, in <module>
    main(vars(get_args()))
  File "engine.py", line 334, in main
    eng.shutdown_nfqueue()
UnboundLocalError: local variable 'eng' referenced before assignment

Debian GNU/Linux 9.11 (stretch)

ecthros commented 4 years ago

This looks like a Python 3.5 issue - could you show us your python version?

xhdix commented 4 years ago

Python 3.5.3

Also, netfilterqueue cannot be installed in Python 3.7.3. What version did you test?

ecthros commented 4 years ago

All of our testing has been on python3.6. could you try that? We'll look into porting it to older versions of Python too.

xhdix commented 4 years ago

I used: https://github.com/chriskuehl/python3.6-debian-stretch Then: # /usr/bin/python3.6 -m pip install -r requirements.txt And finally:

# /usr/bin/python3.6 engine.py --server-port 80 --strategy "[TCP:flags:PA]-duplicate(tamper{TCP:dataofs:replace:10}(tamper{TCP:chksum:corrupt},),)-|" --log debug
2019-11-16 02:15:36 DEBUG:[ENGINE] Engine created with strategy [TCP:flags:PA]-duplicate(tamper{TCP:dataofs:replace:10}(tamper{TCP:chksum:corrupt},),)-| \/ (ID ex02e8i6) to port 80
2019-11-16 02:15:36 DEBUG:[ENGINE] Configuring iptables rules
2019-11-16 02:15:36 DEBUG:[ENGINE] iptables -A OUTPUT -p tcp --dport 80 -j NFQUEUE --queue-num 1
2019-11-16 02:15:37 DEBUG:[ENGINE] iptables -A INPUT -p tcp --sport 80 -j NFQUEUE --queue-num 2
2019-11-16 02:15:37 DEBUG:[ENGINE] iptables -A OUTPUT -p udp --dport 80 -j NFQUEUE --queue-num 1
2019-11-16 02:15:37 DEBUG:[ENGINE] iptables -A INPUT -p udp --sport 80 -j NFQUEUE --queue-num 2
2019-11-16 02:15:37 DEBUG:[ENGINE] NFQueue Initialized after 0

Thank You But it is better to support higher versions of Python too.

ecthros commented 4 years ago

Thanks so much for testing this out. Sorry to make you the guinea pig on this issue.

We have a fix for python3.5 and we'll be pushing that soon. The fix for python 3.7+ is tougher, but we'll work on it!

I'm leaving this issue open until the fix comes out as I imagine other people will run into it.

xhdix commented 4 years ago

You're welcome Thanks for making this amazing project an open source.

Kkevsterrr commented 4 years ago

Hey @xhdix - I updated the parsing code to support Python 3.5. Let us know if you have any other issues!