diff --git a/src/Tor/TorManager.py b/src/Tor/TorManager.py index ac48143d..20d0a259 100644 --- a/src/Tor/TorManager.py +++ b/src/Tor/TorManager.py @@ -183,12 +183,13 @@ class TorManager(object): # Auth cookie file res_protocol = self.send("PROTOCOLINFO", conn) 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") auth_hex = binascii.b2a_hex(open(cookie_file, "rb").read()) res_auth = self.send("AUTHENTICATE %s" % auth_hex, conn) - elif config.tor_password: - res_auth = self.send('AUTHENTICATE "%s"' % config.tor_password, conn) else: res_auth = self.send("AUTHENTICATE", conn)