NullPointerMaker/dynamic_proxy

Not compatible with SOCKS4 proxy

NullPointerMaker opened this issue · 1 comments

When using pysocks for SOCKS4 proxies:

s=socks.socksocket()
s.set_proxy(socks.SOCKS4,addr,port)
s.connect((host, 80))

will occur errors:

Traceback (most recent call last):
  File "/usr/local/lib64/python3.6/site-packages/socks.py", line 809, in connect
    negotiate(self, dest_addr, dest_port)
  File "/usr/local/lib64/python3.6/site-packages/socks.py", line 651, in _negotiate_SOCKS4
    raise SOCKS4Error("{:#04x}: {}".format(status, error))
socks.SOCKS4Error: 0x5b: Request rejected or failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "dynamic_proxy.py", line 98, in conn_client
    from_server, to_server = await conn_server(server_host, server_port)
  File "dynamic_proxy.py", line 47, in conn_server
    sock.connect((server_host, server_port))
  File "/usr/local/lib64/python3.6/site-packages/socks.py", line 47, in wrapper
    return function(*args, **kwargs)
  File "/usr/local/lib64/python3.6/site-packages/socks.py", line 814, in connect
    raise GeneralProxyError("Socket error", error)
socks.GeneralProxyError: Socket error: 0x5b: Request rejected or failed

Raled issue: Anorov/PySocks#118

If anyone knows how to fix it, or have other solutions, please let me know.

Using python-socks instead of pysocks fix this issue.