Opened 4 years ago

Last modified 3 years ago

#10522 new enhancement

Client usage tutorial incompatable with some SocksiPy versions

Reported by: atagar Owned by: atagar
Priority: Low Milestone:
Component: Core Tor/Stem Version:
Severity: Keywords: website
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

Our client usage tutorial (To Russia With Love) is reportedly incompatible with certain SocksiPy versions.

The tutorial works with the standard SocksiPy Version 1.4.2 as well as Version 1.0 but not version 1.01...

Socks5:

[...]
  File "/usr/lib64/python2.7/site-packages/socks.py", line 163, in sendall
    if 'encode' in dir(bytes):
RuntimeError: maximum recursion depth exceeded while calling a Python object

Socks4:

[...]
  File "/usr/lib64/python2.7/site-packages/socks.py", line 399, in connect
    self.__negotiatesocks4(destpair[0],destpair[1])
  File "/usr/lib64/python2.7/site-packages/socks.py", line 313, in __negotiatesocks4
    req = "\x04\x01" + struct.pack(">H",destport).decode() + ipaddr
UnicodeDecodeError: 'ascii' codec can't decode byte 0xbb in position 1: ordinal not in range(128)

Child Tickets

Change History (3)

comment:1 Changed 4 years ago by robinson

Have you tried this with neehi <https://pypi.python.org/pypi/neehi>? I forked SocksiPy, added various patches I found around the web, and added fixes of my own (including Python 3 support). I renamed the result to neehi and posted it to PyPi. I would be interested to know if your tutorial does not work with neehi.

I do not think SocksiPy or SocksiPy-branch are supported any longer and you probably do not need to worry about finding bugs in them.

By "standard SocksiPy Version 1.4.2", do you mean PySocks <https://github.com/Anorov/PySocks>? PySocks and neehi are both currently maintained.

comment:2 Changed 4 years ago by atagar

Have you tried this with neehi <​https://pypi.python.org/pypi/neehi>?

Hi Sean. Nope, I haven't tried Neehi. If you'd care to add a subsection for using Neehi (like the one for PycURL) I'd be happy to add it. Bonus points for adding it to our tutorial tests but not mandatory (I've shamefully not written tests for this tutorial yet).

By "standard SocksiPy Version 1.4.2", do you mean PySocks?

When I first wrote this tutorial it was for SocksiPy 1.0. I'm not quite sure what the original reporter meant by 1.4.2 but that might be it. Sounds like we should double check that our tutorial works with PySocks then replace SocksPy with PySocks.

comment:3 Changed 3 years ago by atagar

Quick other note that the bit where we monkey patch socket is causing confusion since people then try to combine this example with a controller connection. Monkey patching means the controller is routed over tor, naturally then being rejected.

I've seen questions about this a few times now. Improvements to the example would be welcome.

Note: See TracTickets for help on using tickets.