Code Monkey home page Code Monkey logo

pysocksipychain's Issues

Confusing package naming convention

It's confusing for package management that the package is named sockschain and SocksipyChain.

$ python3 -m pip show sockschain
WARNING: Package(s) not found: sockschain
$ python3 -m pip show SocksipyChain
Name: SocksipyChain
Version: 2.1.2
Summary: A Python SOCKS/HTTP Proxy module
Home-page: http://github.com/PageKite/SocksiPyChain
Author: Bjarni R. Einarsson
Author-email: [email protected]
License: BSD
Location: /opt/intel/PySocksipyChain/venv/lib/python3.9/site-packages/SocksipyChain-2.1.2-py3.9.egg
Requires: six
Required-by: 

I noticed this package is not on PyPi. I hope you don't mind I will publish it there under sockschain with attribution back to you and this repo. Let me know if you want me to change anything. Thank you!

PROTOCOL_SSLv3 is not defined error

Python 2.7.9 in Debian sid (a pre-release version) is built without support for SSLv3, which causes this constant to be unavailable. This causes the library to fail to build/run on these systems.

There's no explicit discussion about this in Debain anywhere I've seen, but the Python documentation talks about this being a possibility, and there are other people/packages experiencing this issue: https://docs.python.org/2/library/ssl.html#ssl.PROTOCOL_SSLv3

At this point, it's probably safe and easiest to just totally drop SSL3 support.

Example build log on Debian sid:
https://reproducible.debian.net/rbuild/pagekite_0.5.6d-3.rbuild.log

make[1]: Entering directory '/tmp/buildd/pagekite-0.5.6d'
make doc/pagekite.1
make[2]: Entering directory '/tmp/buildd/pagekite-0.5.6d'
Traceback (most recent call last):
  File "./pagekite/manual.py", line 9, in <module>
    from compat import ts_to_iso
  File "/tmp/buildd/pagekite-0.5.6d/pagekite/compat.py", line 117, in <module>
    import sockschain
  File "/usr/lib/python2.7/dist-packages/sockschain/__init__.py", line 130, in <module>
    class SSL(object):
  File "/usr/lib/python2.7/dist-packages/sockschain/__init__.py", line 132, in SSL
    SSLv3_METHOD = ssl.PROTOCOL_SSLv3
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'
Makefile:59: recipe for target 'doc/pagekite.1' failed

TypeError: addproxy() got an unexpected keyword argument 'append'

When running the Python example code, I get the following error:

In [8]: for hop in chain:
...: socks.setdefaultproxy(*socks.parseproxy(hop), append=True)

...:

TypeError Traceback (most recent call last)

/home/joseph/utils/src/PySocksipyChain/ in ()

/home/joseph/utils/src/PySocksipyChain/socks.py in setdefaultproxy(_args, *_kwargs)
405 if args and args[P_TYPE] == PROXY_TYPE_DEFAULT:
406 raise ValueError("Circular reference to default proxy.")
--> 407 return setproxy(DEFAULT_ROUTE, _args, *_kwargs)
408
409 def adddefaultproxy(_args, *_kwargs):

/home/joseph/utils/src/PySocksipyChain/socks.py in setproxy(dest, _args, *_kwargs)
389 if args:
390 _proxyroutes[dest] = []
--> 391 return addproxy(dest, _args, *_kwargs)
392 else:
393 if dest in _proxyroutes:

TypeError: addproxy() got an unexpected keyword argument 'append'

Support Python 3

The current module at least superficially runs under Python 3, but I'm leaving this issue open until porting @pagekite to Python 3 is finished - it's very likely that effort will uncover some bugs on this side, and I would prefer packages and others were aware that work was still ongoing.

'wrapmodule' is pointless

def wrapmodule(module):
"""wrapmodule(module)
Attempts to replace a module's socket library with a SOCKS socket.
This will only work on modules that import socket directly into the
namespace; most of the Python Standard Library falls into this category.
"""
module.socket.socket = socksocket
module.socket.create_connection = sockcreateconn

This function is pointless, in fact it just made a monkey patch to socket.socket, cannot be applied to the given module only. Please change or remove it.

six dependency not completely removed

Although the dependency on six was removed in ccb4267, it is still referred to by setup.py and a test:

$ grep -R six
setup.py:    install_requires=["six"],
test.py:from six.moves.urllib.request import urlopen

SOCKS proxy authentication is broken

Traceback (most recent call last):
  File "/opt/intel/PySocksipyChain/venv/lib/python3.9/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/opt/intel/PySocksipyChain/venv/lib/python3.9/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/opt/intel/PySocksipyChain/venv/lib/python3.9/site-packages/requests/adapters.py", line 440, in send
    resp = conn.urlopen(
  File "/opt/intel/PySocksipyChain/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/opt/intel/PySocksipyChain/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 398, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/opt/intel/PySocksipyChain/venv/lib/python3.9/site-packages/urllib3/connection.py", line 239, in request
    super(HTTPConnection, self).request(method, url, body=body, headers=headers)
  File "/usr/lib/python3.9/http/client.py", line 1285, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1331, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1280, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1040, in _send_output
    self.send(msg)
  File "/usr/lib/python3.9/http/client.py", line 980, in send
    self.connect()
  File "/opt/intel/PySocksipyChain/venv/lib/python3.9/site-packages/urllib3/connection.py", line 205, in connect
    conn = self._new_conn()
  File "/opt/intel/PySocksipyChain/venv/lib/python3.9/site-packages/urllib3/connection.py", line 174, in _new_conn
    conn = connection.create_connection(
  File "/opt/intel/PySocksipyChain/venv/lib/python3.9/site-packages/urllib3/util/connection.py", line 85, in create_connection
    sock.connect(sa)
  File "/opt/intel/PySocksipyChain/sockschain/__init__.py", line 1079, in connect
    self.__negotiatesocks5(nexthop[0], nexthop[1], proxy)
  File "/opt/intel/PySocksipyChain/sockschain/__init__.py", line 650, in __negotiatesocks5
    self.sendall(chr(0x01).encode() +
TypeError: can't concat str to bytes

All files are in DOS encoding

Is this intentional or bug?

I am getting some warnings from rpmlint. If this is intention, just close :-)

[lzap@lzapx SPECS]$ rpmlint /home/lzap/rpmbuild/RPMS/noarch/python-SocksipyChain-2.0.12-1.noarch.rpm /home/lzap/rpmbuild/SRPMS/python-SocksipyChain-2.0.12-1.src.rpm
python-SocksipyChain.noarch: W: wrong-file-end-of-line-encoding /usr/share/doc/python-SocksipyChain-2.0.12/BUGS
python-SocksipyChain.noarch: W: wrong-file-end-of-line-encoding /usr/share/doc/python-SocksipyChain-2.0.12/LICENSE
python-SocksipyChain.noarch: W: wrong-file-end-of-line-encoding /usr/share/doc/python-SocksipyChain-2.0.12/README.md

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.