pagekite / pysocksipychain Goto Github PK
View Code? Open in Web Editor NEWModified socks.py which supports chained proxies
Home Page: http://pagekite.net/wiki/Floss/PySocksipyChain/
License: Other
Modified socks.py which supports chained proxies
Home Page: http://pagekite.net/wiki/Floss/PySocksipyChain/
License: Other
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!
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
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'
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.
PySocksipyChain/sockschain/__init__.py
Lines 1042 to 1049 in 535f493
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.
This package is (via the fork https://github.com/GreenPonik/PySocksipyChain) 3 times on PyPi:
In addition, there is the ancient SocksiPy-branch 1.01, which is with over 629.000 downloads in the last 6 month one of the top projects on PyPi.
For the sake of supply chain security, it would be a good idea to try to clean up this situation.
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
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
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.