Skip to content
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

TimeoutError for other port then 80 #24

Open
jrespeto opened this issue Feb 24, 2021 · 2 comments
Open

TimeoutError for other port then 80 #24

jrespeto opened this issue Feb 24, 2021 · 2 comments

Comments

@jrespeto
Copy link

jrespeto commented Feb 24, 2021

Hi

I keep getting a timeout errors trying to connect to anything other than 80.
Is there a verbose setting I can switch on?

keep getting a timeout error.
TimeoutError: Could not connect to ('xxx.xxx.xxx.xxx', #####)

ip="some IP"
port = openPort
from torpy import TorClient

with TorClient() as tor:
    with tor.create_circuit(3) as circuit:
        print("Connected to Tor")
        print(dir(circuit))
        with circuit.create_stream((ip, port)) as stream:
            print(dir(stream))
            data = stream.recv(1024)
            print(data)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/asdf/pyenv/lib/python3.9/site-packages/torpy/circuit.py", line 320, in wrapped
    return fn(self, *args, **kwargs)
  File "/home/asdf/pyenv/lib/python3.9/site-packages/torpy/circuit.py", line 599, in create_stream
    tor_stream.connect(address)
  File "/home/asdf/pyenv/lib/python3.9/site-packages/torpy/stream.py", line 270, in connect
    self._connect(address)
  File "/home/asdf/pyenv/lib/python3.9/site-packages/torpy/stream.py", line 297, in _connect
    self._wait_connected(address, self._conn_timeout)
  File "/home/asdf/pyenv/lib/python3.9/site-packages/torpy/stream.py", line 276, in _wait_connected
    raise TimeoutError('Could not connect to %r' % (address,))
TimeoutError: Could not connect to ('xxx.xxx.xxx.xxx', #####)
@jrespeto
Copy link
Author

I was able to get a test working on a VSP a few times. Like 2 in 20. I guess I'm just getting some slow/crapy tor exit nodes.

Is there a way to just request exit nodes from one country?

server

# echo "Can I get this messages" | nc -l -t -p 11111

Traceback (most recent call last):
File "", line 1, in
File "/home/asdf/pyenv/lib/python3.9/site-packages/torpy/circuit.py", line 320, in wrapped
return fn(self, *args, **kwargs)
File "/home/asdf/pyenv/lib/python3.9/site-packages/torpy/circuit.py", line 599, in create_stream
tor_stream.connect(address)
File "/home/asdf/pyenv/lib/python3.9/site-packages/torpy/stream.py", line 270, in connect
self._connect(address)
File "/home/asdf/pyenv/lib/python3.9/site-packages/torpy/stream.py", line 297, in _connect
self._wait_connected(address, self._conn_timeout)
File "/home/asdf/pyenv/lib/python3.9/site-packages/torpy/stream.py", line 276, in _wait_connected
raise TimeoutError('Could not connect to %r' % (address,))
TimeoutError: Could not connect to ('xx.xx.xx.xx', 11111)

@jbrown299
Copy link
Collaborator

This is happens due to some exit-nodes port restrictions. In current version torpy disregard this restrictions when choose exit-node. Can you show circuit nodes list when connection failed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants