I have a fully functional tor hidden service with his v3 url, created with stem and the controller class. The server is redirecting the traffic into a local tcp server running on port 5000 created with socket
. But now I want to connect to this hidden service using python. So I tried socks
with SOCKS5 proxies, no way of making it work. I also tried the torpy
library with the example provided on the offical doc but, again, no way to make it works:
from torpy import TorClient
url = 'myv3torurl.onion'
tor = TorClient()
with tor.create_circuit() as circuit:
print('circuit done')
with circuit.create_stream(('http://' + url, 5000)) as client:
print('sending')
client.send(b'yeah yeah im there')
print(client.recv(1024))
Also tried changing the url adding http:// or https://, or tried to change the port with 80, 9050 or 9051. The torpy
logs are always the same and you can find them here.
At this point I do not really know what to try. I just want a tcp connection hosted by the onion website. And by the way, I'm sure it's not a problem of the server because if I try to copy and paste the url on the tor browser it is fully reachable. Thank you for any help.
torsocks telnet foo.onion
?