Rev1815, Request tor version using GETINFO
This commit is contained in:
parent
2425f9f03e
commit
77e07dd5b5
2 changed files with 9 additions and 7 deletions
|
@ -9,7 +9,7 @@ class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.5.1"
|
self.version = "0.5.1"
|
||||||
self.rev = 1814
|
self.rev = 1815
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.config_file = "zeronet.conf"
|
self.config_file = "zeronet.conf"
|
||||||
|
|
|
@ -155,13 +155,9 @@ class TorManager:
|
||||||
try:
|
try:
|
||||||
with self.lock:
|
with self.lock:
|
||||||
conn.connect((self.ip, self.port))
|
conn.connect((self.ip, self.port))
|
||||||
res_protocol = self.send("PROTOCOLINFO", conn)
|
|
||||||
|
|
||||||
version = re.search('Tor="([0-9\.]+)', res_protocol).group(1)
|
|
||||||
# Version 0.2.7.5 required because ADD_ONION support
|
|
||||||
assert float(version.replace(".", "0", 2)) >= 207.5, "Tor version >=0.2.7.5 required, found: %s" % version
|
|
||||||
|
|
||||||
# Auth cookie file
|
# Auth cookie file
|
||||||
|
res_protocol = self.send("PROTOCOLINFO", conn)
|
||||||
cookie_match = re.search('COOKIEFILE="(.*?)"', res_protocol)
|
cookie_match = re.search('COOKIEFILE="(.*?)"', res_protocol)
|
||||||
if cookie_match:
|
if cookie_match:
|
||||||
cookie_file = cookie_match.group(1)
|
cookie_file = cookie_match.group(1)
|
||||||
|
@ -173,6 +169,12 @@ class TorManager:
|
||||||
res_auth = self.send("AUTHENTICATE", conn)
|
res_auth = self.send("AUTHENTICATE", conn)
|
||||||
|
|
||||||
assert "250 OK" in res_auth, "Authenticate error %s" % res_auth
|
assert "250 OK" in res_auth, "Authenticate error %s" % res_auth
|
||||||
|
|
||||||
|
# Version 0.2.7.5 required because ADD_ONION support
|
||||||
|
res_version = self.send("GETINFO version", conn)
|
||||||
|
version = re.search('version=([0-9\.]+)', res_version).group(1)
|
||||||
|
assert float(version.replace(".", "0", 2)) >= 207.5, "Tor version >=0.2.7.5 required, found: %s" % version
|
||||||
|
|
||||||
self.status = u"Connected (%s)" % res_auth
|
self.status = u"Connected (%s)" % res_auth
|
||||||
self.conn = conn
|
self.conn = conn
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
|
@ -239,7 +241,7 @@ class TorManager:
|
||||||
self.log.debug("> %s" % cmd)
|
self.log.debug("> %s" % cmd)
|
||||||
for retry in range(2):
|
for retry in range(2):
|
||||||
try:
|
try:
|
||||||
conn.send("%s\r\n" % cmd)
|
conn.sendall("%s\r\n" % cmd)
|
||||||
back = conn.recv(1024 * 64).decode("utf8", "ignore")
|
back = conn.recv(1024 * 64).decode("utf8", "ignore")
|
||||||
break
|
break
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
|
|
Loading…
Reference in a new issue