Merge pull request #1413 from saber28/patch-1
Improve Orbot Compatibility
This commit is contained in:
commit
9fb7e1b46d
1 changed files with 4 additions and 3 deletions
|
@ -183,12 +183,13 @@ class TorManager(object):
|
||||||
# Auth cookie file
|
# Auth cookie file
|
||||||
res_protocol = self.send("PROTOCOLINFO", conn)
|
res_protocol = self.send("PROTOCOLINFO", conn)
|
||||||
cookie_match = re.search('COOKIEFILE="(.*?)"', res_protocol)
|
cookie_match = re.search('COOKIEFILE="(.*?)"', res_protocol)
|
||||||
if cookie_match:
|
|
||||||
|
if config.tor_password:
|
||||||
|
res_auth = self.send('AUTHENTICATE "%s"' % config.tor_password, conn)
|
||||||
|
elif cookie_match:
|
||||||
cookie_file = cookie_match.group(1).decode("string-escape")
|
cookie_file = cookie_match.group(1).decode("string-escape")
|
||||||
auth_hex = binascii.b2a_hex(open(cookie_file, "rb").read())
|
auth_hex = binascii.b2a_hex(open(cookie_file, "rb").read())
|
||||||
res_auth = self.send("AUTHENTICATE %s" % auth_hex, conn)
|
res_auth = self.send("AUTHENTICATE %s" % auth_hex, conn)
|
||||||
elif config.tor_password:
|
|
||||||
res_auth = self.send('AUTHENTICATE "%s"' % config.tor_password, conn)
|
|
||||||
else:
|
else:
|
||||||
res_auth = self.send("AUTHENTICATE", conn)
|
res_auth = self.send("AUTHENTICATE", conn)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue