0

After successfully installing QPython and Orbot on my Android device, I've pip-installed a well-known stem library and tried to use it for changing Tor identity by sending NEWNYM signal to control port. On PC, this code

from stem.control import Controller
from stem import Signal

with Controller.from_port(port=9051) as ctrl:
    ctrl.authenticate()
    ctrl.signal(Signal.NEWNYM)

works perfectly. But, on Android device, QPython returns an error:TypeError: decode() argument 1 must be string, not None. Authentication fails.

How could I overcome this problem? Maybe, I should look towards AnroidFacade SL4A API to interact with Tor?

I'am running Android 7.1 at Nokia 3. ControlPort was set to constantly be 9051 by using Torrc Custom Config in Orbot Settings.

Upd Here's a traceback stack:

/data/user/0/org.qpython.qpy/files/bin/qpython-android5.sh "/storage/emulated/0/qpython/scripts/new.py" && exit
d/0/qpython/scripts/new.py" && exit     <
Traceback (most recent call last):
  File "/storage/emulated/0/qpython/scripts/new.py", line 6, in <module>
    ctrl.authenticate()
  File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/stem-1.6.0-py2.7.egg/stem/control.py", line 1092, in authenticate
    stem.connection.authenticate(self, *args, **kwargs)
  File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/stem-1.6.0-py2.7.egg/stem/connection.py", line 530, in authenticate
    protocolinfo_response = get_protocolinfo(controller)
  File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/stem-1.6.0-py2.7.egg/stem/connection.py", line 1022, in get_protocolinfo
    stem.response.convert('PROTOCOLINFO', protocolinfo_response)
  File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/stem-1.6.0-py2.7.egg/stem/response/__init__.py", line 124, in convert
    message._parse_message(**kwargs)
  File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/stem-1.6.0-py2.7.egg/stem/response/protocolinfo.py", line 110, in _parse_message
    self.cookie_path = line.pop_mapping(True, True, get_bytes = True)[1].decode(sys.getfilesystemencoding())
TypeError: decode() argument 1 must be string, not None
1|NE1:/ $
Vifonius
  • 43
  • 8
  • What's the full stack trace? It needs to do cookie auth if you don't set a HashedControlPassword so there may be issues with auth. – drew010 Dec 21 '17 at 23:28
  • Thanks for your reply. Unfortunately, I can't get full stack traceback from smartphone (just a screenshot).It's quite sad if I need additional efforts to auth... – Vifonius Dec 22 '17 at 13:09
  • Unfortunately that exception alone doesn't help because we have no idea where the error is originating from. Stem, other code, inside an auth routine, during connection, etc. – drew010 Dec 22 '17 at 19:54
  • @drew010 I've, updated my post. Problem is with auth – Vifonius Dec 22 '17 at 21:58

0 Answers0