Hello community, here is the log from the commit of package python-PySocks for openSUSE:Factory checked in at 2019-09-30 15:55:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-PySocks (Old) and /work/SRC/openSUSE:Factory/.python-PySocks.new.2352 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-PySocks" Mon Sep 30 15:55:11 2019 rev:7 rq:732897 version:1.7.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-PySocks/python-PySocks.changes 2019-06-22 11:22:39.861288248 +0200 +++ /work/SRC/openSUSE:Factory/.python-PySocks.new.2352/python-PySocks.changes 2019-09-30 15:55:12.953884560 +0200 @@ -1,0 +2,6 @@ +Tue Sep 24 09:48:18 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com> + +- Update to 1.7.1: + * no changelog provided + +------------------------------------------------------------------- Old: ---- PySocks-1.7.0.tar.gz New: ---- PySocks-1.7.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-PySocks.spec ++++++ --- /var/tmp/diff_new_pack.2CNWXx/_old 2019-09-30 15:55:13.413883336 +0200 +++ /var/tmp/diff_new_pack.2CNWXx/_new 2019-09-30 15:55:13.417883325 +0200 @@ -20,7 +20,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define oldpython python Name: python-PySocks -Version: 1.7.0 +Version: 1.7.1 Release: 0 Summary: A Python SOCKS client module License: BSD-3-Clause ++++++ PySocks-1.7.0.tar.gz -> PySocks-1.7.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PySocks-1.7.0/PKG-INFO new/PySocks-1.7.1/PKG-INFO --- old/PySocks-1.7.0/PKG-INFO 2019-05-11 12:16:31.000000000 +0200 +++ new/PySocks-1.7.1/PKG-INFO 2019-09-20 04:06:52.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: PySocks -Version: 1.7.0 +Version: 1.7.1 Summary: A Python SOCKS client module. See https://github.com/Anorov/PySocks for more information. Home-page: https://github.com/Anorov/PySocks Author: Anorov @@ -13,18 +13,14 @@ Acts as a drop-in replacement to the socket module. Seamlessly configure SOCKS proxies for any socket object by calling `socket_object.set_proxy()`. - Status Update - ------------- - - I no longer have the time to actively work on this project. I will gladly accept thoughtful pull requests and continue to update here and on PyPI in response to PRs, but I won't be putting in any changes of my own other than version bumps. If anyone would like to take the project off of my hands, please email me or create an issue. Thanks. - ---------------- Features ======== * SOCKS proxy client for Python 2.7 and 3.4+ - * TCP and UDP both supported + * TCP supported + * UDP mostly supported (issues may occur in some edge cases) * HTTP proxy client included but not supported or recommended (you should use urllib2's or requests' own HTTP proxy interface) * urllib2 handler included. `pip install` / `setup.py install` will automatically install the `sockshandler` module. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PySocks-1.7.0/PySocks.egg-info/PKG-INFO new/PySocks-1.7.1/PySocks.egg-info/PKG-INFO --- old/PySocks-1.7.0/PySocks.egg-info/PKG-INFO 2019-05-11 12:16:31.000000000 +0200 +++ new/PySocks-1.7.1/PySocks.egg-info/PKG-INFO 2019-09-20 04:06:52.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: PySocks -Version: 1.7.0 +Version: 1.7.1 Summary: A Python SOCKS client module. See https://github.com/Anorov/PySocks for more information. Home-page: https://github.com/Anorov/PySocks Author: Anorov @@ -13,18 +13,14 @@ Acts as a drop-in replacement to the socket module. Seamlessly configure SOCKS proxies for any socket object by calling `socket_object.set_proxy()`. - Status Update - ------------- - - I no longer have the time to actively work on this project. I will gladly accept thoughtful pull requests and continue to update here and on PyPI in response to PRs, but I won't be putting in any changes of my own other than version bumps. If anyone would like to take the project off of my hands, please email me or create an issue. Thanks. - ---------------- Features ======== * SOCKS proxy client for Python 2.7 and 3.4+ - * TCP and UDP both supported + * TCP supported + * UDP mostly supported (issues may occur in some edge cases) * HTTP proxy client included but not supported or recommended (you should use urllib2's or requests' own HTTP proxy interface) * urllib2 handler included. `pip install` / `setup.py install` will automatically install the `sockshandler` module. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PySocks-1.7.0/README.md new/PySocks-1.7.1/README.md --- old/PySocks-1.7.0/README.md 2019-05-11 11:10:10.000000000 +0200 +++ new/PySocks-1.7.1/README.md 2019-09-20 03:58:31.000000000 +0200 @@ -5,18 +5,14 @@ Acts as a drop-in replacement to the socket module. Seamlessly configure SOCKS proxies for any socket object by calling `socket_object.set_proxy()`. -Status Update -------------- - -I no longer have the time to actively work on this project. I will gladly accept thoughtful pull requests and continue to update here and on PyPI in response to PRs, but I won't be putting in any changes of my own other than version bumps. If anyone would like to take the project off of my hands, please email me or create an issue. Thanks. - ---------------- Features ======== * SOCKS proxy client for Python 2.7 and 3.4+ -* TCP and UDP both supported +* TCP supported +* UDP mostly supported (issues may occur in some edge cases) * HTTP proxy client included but not supported or recommended (you should use urllib2's or requests' own HTTP proxy interface) * urllib2 handler included. `pip install` / `setup.py install` will automatically install the `sockshandler` module. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PySocks-1.7.0/socks.py new/PySocks-1.7.1/socks.py --- old/PySocks-1.7.0/socks.py 2019-05-11 11:30:38.000000000 +0200 +++ new/PySocks-1.7.1/socks.py 2019-09-20 03:58:31.000000000 +0200 @@ -13,7 +13,7 @@ import struct import sys -__version__ = "1.7.0" +__version__ = "1.7.1" if os.name == "nt" and sys.version_info < (3, 0): @@ -199,7 +199,7 @@ sock.connect((remote_host, remote_port)) return sock - except (socket.error, ProxyConnectionError) as e: + except (socket.error, ProxyError) as e: err = e if sock: sock.close() @@ -844,4 +844,4 @@ proxy_port = proxy_port or DEFAULT_PORTS.get(proxy_type) if not proxy_port: raise GeneralProxyError("Invalid proxy type") - return proxy_addr, proxy_port \ No newline at end of file + return proxy_addr, proxy_port diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PySocks-1.7.0/sockshandler.py new/PySocks-1.7.1/sockshandler.py --- old/PySocks-1.7.0/sockshandler.py 2019-05-11 11:10:10.000000000 +0200 +++ new/PySocks-1.7.1/sockshandler.py 2019-09-20 03:58:31.000000000 +0200 @@ -7,6 +7,7 @@ This module provides a Handler which you can use with urllib2 to allow it to tunnel your connection through a socks.sockssocket socket, with out monkey patching the original socket... """ +import socket import ssl try: @@ -23,17 +24,45 @@ d.update(b) return d +def is_ip(s): + try: + if ':' in s: + socket.inet_pton(socket.AF_INET6, s) + elif '.' in s: + socket.inet_aton(s) + else: + return False + except: + return False + else: + return True + +socks4_no_rdns = set() + class SocksiPyConnection(httplib.HTTPConnection): def __init__(self, proxytype, proxyaddr, proxyport=None, rdns=True, username=None, password=None, *args, **kwargs): self.proxyargs = (proxytype, proxyaddr, proxyport, rdns, username, password) httplib.HTTPConnection.__init__(self, *args, **kwargs) def connect(self): - self.sock = socks.socksocket() - self.sock.setproxy(*self.proxyargs) - if type(self.timeout) in (int, float): - self.sock.settimeout(self.timeout) - self.sock.connect((self.host, self.port)) + (proxytype, proxyaddr, proxyport, rdns, username, password) = self.proxyargs + rdns = rdns and proxyaddr not in socks4_no_rdns + while True: + try: + sock = socks.create_connection( + (self.host, self.port), self.timeout, None, + proxytype, proxyaddr, proxyport, rdns, username, password, + ((socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),)) + break + except socks.SOCKS4Error as e: + if rdns and "0x5b" in str(e) and not is_ip(self.host): + # Maybe a SOCKS4 server that doesn't support remote resolving + # Let's try again + rdns = False + socks4_no_rdns.add(proxyaddr) + else: + raise + self.sock = sock class SocksiPyConnectionS(httplib.HTTPSConnection): def __init__(self, proxytype, proxyaddr, proxyport=None, rdns=True, username=None, password=None, *args, **kwargs): @@ -41,12 +70,15 @@ httplib.HTTPSConnection.__init__(self, *args, **kwargs) def connect(self): - sock = socks.socksocket() - sock.setproxy(*self.proxyargs) - if type(self.timeout) in (int, float): - sock.settimeout(self.timeout) - sock.connect((self.host, self.port)) - self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file) + SocksiPyConnection.connect(self) + self.sock = self._context.wrap_socket(self.sock, server_hostname=self.host) + if not self._context.check_hostname and self._check_hostname: + try: + ssl.match_hostname(self.sock.getpeercert(), self.host) + except Exception: + self.sock.shutdown(socket.SHUT_RDWR) + self.sock.close() + raise class SocksiPyHandler(urllib2.HTTPHandler, urllib2.HTTPSHandler): def __init__(self, *args, **kwargs):