-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tor version parser broken? #756
Comments
well, i don't think if thats the problem:
Can you please add a |
Took the liberty to make that
An issue with line handling? Could also be an issue with our control-port-filter-python. It receives:
It replies:
|
Could you please find your print "------", repr(res_protocol) |
@MuxZeroNet he already did that, I think the problem is at https://github.com/HelloZeroNet/ZeroNet/blob/master/src/Tor/TorManager.py#L243, have to put that line to a I will try to reproduce the problem |
Another option, if yo want the Tor version number, send Yet another option would be porting to python-stem, which I created a separate ticket for just now: |
I have added a modification that queries version using GETINFO, please try it: 77e07dd |
No, doesn't work for me. Added a log line below.
|
Tor is getting:
Reply:
|
Hm I don't have other ideas yet. I tried to reproduce it under windows, but no luck. Going to again with a VPS. |
I have just installed on Debian 8 and works for me:
(same with experimental 0.3.x) do you have any other ideas to reproduce it? please try this one:
|
I have no idea either. (Better use >>> import socket
>>> conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> conn.connect(('127.0.0.1', 9151))
>>> conn.sendall('authenticate c5e2d6b540e0b8ea29702e0112740e64f056751d661d03ba0d00d399262e6f77\r\n')
>>> conn.recv(1024*32)
'250 OK\r\n'
>>> conn.sendall('getinfo version\r\n')
>>> conn.recv(1024*32)
'250-version=0.2.8.11 (git-31e7b47fbebe8caf)\r\n250 OK\r\n'
>>> raw_reply = '250-version=0.2.8.11 (git-31e7b47fbebe8caf)\r\n250 OK\r\n'
>>> raw_reply.decode('utf-8')
u'250-version=0.2.8.11 (git-31e7b47fbebe8caf)\r\n250 OK\r\n'
>>> raw_reply.decode('utf-8', 'ignore')
u'250-version=0.2.8.11 (git-31e7b47fbebe8caf)\r\n250 OK\r\n'
>>> raw_reply.decode('utf-8', 'ignore').strip()
u'250-version=0.2.8.11 (git-31e7b47fbebe8caf)\r\n250 OK'
>>> decoded_reply = _
>>> decoded_reply
u'250-version=0.2.8.11 (git-31e7b47fbebe8caf)\r\n250 OK'
>>> import re
>>> re.search('version=([0-9\.]+)', decoded_reply)
<_sre.SRE_Match object at 0x7fc300f3d030>
>>> re.search('version=([0-9\.]+)', decoded_reply).group(1)
u'0.2.8.11' |
Reproduction is a bit hard at the moment. The communication is as follows. (1)
(2)
(3)
This is what ZeroNet gets:
I am not sure yet we gotta blame this on control-port-filter-python. |
To figure out what Python actually got, could you please try this? hex_cookie = 'your hex encoded cookie here'
import socket
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn.connect(('127.0.0.1', 9151))
conn.sendall('authenticate %s\r\n' % hex_cookie)
print repr(conn.recv(1024*32))
conn.sendall('getinfo version\r\n')
raw_reply = conn.recv(1024*32)
print repr(raw_reply)
decoded_reply = raw_reply.decode('utf-8', 'ignore').strip()
print repr(decoded_reply)
import re
print repr(re.search('version=([0-9\.]+)', decoded_reply).group(1)) On my computer:
|
Thank you for looking into this so quickly and diligently! I've put that into a text file, added
Communication went as follow:
|
We should probably blame the control port firewall. 🔓 |
Tor command responses terminate with "250 OK\r\n" so we have to read until that sequence is encountered. The previous implementation is racy: after sending a command it would accept whatever that is found on the socket as its response, no matter if it is correctly terminated or not. This commit fixes: HelloZeroNet#756
Actually, to me (anonym, author of the new |
Also note that |
@adrelanos, did this fix your problem? |
fred-a-kemp:
@adrelanos, did this fix your problem?
Works for me! Thanks for the PR!
|
Tor command responses terminate with "250 OK\r\n" so we have to read until that sequence is encountered. The previous implementation is racy: after sending a command it would accept whatever that is found on the socket as its response, no matter if it is correctly terminated or not. This commit fixes: HelloZeroNet/ZeroNet#756
zeronet --tor always
does not work for me.https://github.com/HelloZeroNet/ZeroNet/blob/master/src/Tor/TorManager.py#L160
The text was updated successfully, but these errors were encountered: