Hello community, here is the log from the commit of package python-PySocks for openSUSE:Factory checked in at 2019-06-22 11:22:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-PySocks (Old) and /work/SRC/openSUSE:Factory/.python-PySocks.new.4615 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-PySocks" Sat Jun 22 11:22:36 2019 rev:6 rq:710312 version:1.7.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-PySocks/python-PySocks.changes 2018-12-21 08:19:44.413664288 +0100 +++ /work/SRC/openSUSE:Factory/.python-PySocks.new.4615/python-PySocks.changes 2019-06-22 11:22:39.861288248 +0200 @@ -1,0 +2,13 @@ +Sat Jun 15 15:53:16 UTC 2019 - Arun Persaud <a...@gmx.de> + +- specfile: + * update copyright year + * be more specific in %files section + +- update to version 1.7.0: + * (no changelog available) + +- changes from 1.6.8: + * Python 2.7 and 3.4+ only + +------------------------------------------------------------------- Old: ---- PySocks-1.6.8.tar.gz New: ---- PySocks-1.7.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-PySocks.spec ++++++ --- /var/tmp/diff_new_pack.rNxUA2/_old 2019-06-22 11:22:41.481290014 +0200 +++ /var/tmp/diff_new_pack.rNxUA2/_new 2019-06-22 11:22:41.513290049 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-PySocks # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2016 LISA GmbH, Bingen, Germany. # # All modifications and additions to the file contributed by third parties @@ -20,22 +20,20 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define oldpython python Name: python-PySocks -Version: 1.6.8 +Version: 1.7.0 Release: 0 Summary: A Python SOCKS client module License: BSD-3-Clause Group: Development/Languages/Python -Url: https://github.com/Anorov/PySocks +URL: https://github.com/Anorov/PySocks Source: https://files.pythonhosted.org/packages/source/P/PySocks/PySocks-%{version}.tar.gz BuildRequires: %{python_module setuptools} BuildRequires: python-rpm-macros +BuildArch: noarch %ifpython2 Provides: %{oldpython}-SocksiPy = %{version} Obsoletes: %{oldpython}-SocksiPy < %{version} %endif -BuildRoot: %{_tmppath}/%{name}-%{version}-build -BuildArch: noarch - %python_subpackages %description @@ -56,7 +54,9 @@ %python_install %files %{python_files} -%defattr(-,root,root,-) -%{python_sitelib}/* +%{python_sitelib}/socks.py* +%{python_sitelib}/sockshandler.py* +%{python_sitelib}/PySocks-%{version}-py*.egg-info +%pycache_only %{python_sitelib}/__pycache__ %changelog ++++++ PySocks-1.6.8.tar.gz -> PySocks-1.7.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PySocks-1.6.8/PKG-INFO new/PySocks-1.7.0/PKG-INFO --- old/PySocks-1.6.8/PKG-INFO 2017-12-21 05:25:34.000000000 +0100 +++ new/PySocks-1.7.0/PKG-INFO 2019-05-11 12:16:31.000000000 +0200 @@ -1,14 +1,323 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: PySocks -Version: 1.6.8 +Version: 1.7.0 Summary: A Python SOCKS client module. See https://github.com/Anorov/PySocks for more information. Home-page: https://github.com/Anorov/PySocks Author: Anorov Author-email: anorov.vor...@gmail.com License: BSD -Description: UNKNOWN +Description: PySocks + ======= + + PySocks lets you send traffic through SOCKS and HTTP proxy servers. It is a modern fork of [SocksiPy](http://socksipy.sourceforge.net/) with bug fixes and extra features. + + 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 + * 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. + + Installation + ============ + + pip install PySocks + + Or download the tarball / `git clone` and... + + python setup.py install + + These will install both the `socks` and `sockshandler` modules. + + Alternatively, include just `socks.py` in your project. + + -------------------------------------------- + + *Warning:* PySocks/SocksiPy only supports HTTP proxies that use CONNECT tunneling. Certain HTTP proxies may not work with this library. If you wish to use HTTP (not SOCKS) proxies, it is recommended that you rely on your HTTP client's native proxy support (`proxies` dict for `requests`, or `urllib2.ProxyHandler` for `urllib2`) instead. + + -------------------------------------------- + + Usage + ===== + + ## socks.socksocket ## + + import socks + + s = socks.socksocket() # Same API as socket.socket in the standard lib + + s.set_proxy(socks.SOCKS5, "localhost") # SOCKS4 and SOCKS5 use port 1080 by default + # Or + s.set_proxy(socks.SOCKS4, "localhost", 4444) + # Or + s.set_proxy(socks.HTTP, "5.5.5.5", 8888) + + # Can be treated identical to a regular socket object + s.connect(("www.somesite.com", 80)) + s.sendall("GET / HTTP/1.1 ...") + print s.recv(4096) + + ## Monkeypatching ## + + To monkeypatch the entire standard library with a single default proxy: + + import urllib2 + import socket + import socks + + socks.set_default_proxy(socks.SOCKS5, "localhost") + socket.socket = socks.socksocket + + urllib2.urlopen("http://www.somesite.com/") # All requests will pass through the SOCKS proxy + + Note that monkeypatching may not work for all standard modules or for all third party modules, and generally isn't recommended. Monkeypatching is usually an anti-pattern in Python. + + ## urllib2 Handler ## + + Example use case with the `sockshandler` urllib2 handler. Note that you must import both `socks` and `sockshandler`, as the handler is its own module separate from PySocks. The module is included in the PyPI package. + + import urllib2 + import socks + from sockshandler import SocksiPyHandler + + opener = urllib2.build_opener(SocksiPyHandler(socks.SOCKS5, "127.0.0.1", 9050)) + print opener.open("http://www.somesite.com/") # All requests made by the opener will pass through the SOCKS proxy + + -------------------------------------------- + + Original SocksiPy README attached below, amended to reflect API changes. + + -------------------------------------------- + + SocksiPy + + A Python SOCKS module. + + (C) 2006 Dan-Haim. All rights reserved. + + See LICENSE file for details. + + + *WHAT IS A SOCKS PROXY?* + + A SOCKS proxy is a proxy server at the TCP level. In other words, it acts as + a tunnel, relaying all traffic going through it without modifying it. + SOCKS proxies can be used to relay traffic using any network protocol that + uses TCP. + + *WHAT IS SOCKSIPY?* + + This Python module allows you to create TCP connections through a SOCKS + proxy without any special effort. + It also supports relaying UDP packets with a SOCKS5 proxy. + + *PROXY COMPATIBILITY* + + SocksiPy is compatible with three different types of proxies: + + 1. SOCKS Version 4 (SOCKS4), including the SOCKS4a extension. + 2. SOCKS Version 5 (SOCKS5). + 3. HTTP Proxies which support tunneling using the CONNECT method. + + *SYSTEM REQUIREMENTS* + + Being written in Python, SocksiPy can run on any platform that has a Python + interpreter and TCP/IP support. + This module has been tested with Python 2.3 and should work with greater versions + just as well. + + + INSTALLATION + ------------- + + Simply copy the file "socks.py" to your Python's `lib/site-packages` directory, + and you're ready to go. [Editor's note: it is better to use `python setup.py install` for PySocks] + + + USAGE + ------ + + First load the socks module with the command: + + >>> import socks + >>> + + The socks module provides a class called `socksocket`, which is the base to all of the module's functionality. + + The `socksocket` object has the same initialization parameters as the normal socket + object to ensure maximal compatibility, however it should be noted that `socksocket` will only function with family being `AF_INET` and + type being either `SOCK_STREAM` or `SOCK_DGRAM`. + Generally, it is best to initialize the `socksocket` object with no parameters + + >>> s = socks.socksocket() + >>> + + The `socksocket` object has an interface which is very similiar to socket's (in fact + the `socksocket` class is derived from socket) with a few extra methods. + To select the proxy server you would like to use, use the `set_proxy` method, whose + syntax is: + + set_proxy(proxy_type, addr[, port[, rdns[, username[, password]]]]) + + Explanation of the parameters: + + `proxy_type` - The type of the proxy server. This can be one of three possible + choices: `PROXY_TYPE_SOCKS4`, `PROXY_TYPE_SOCKS5` and `PROXY_TYPE_HTTP` for SOCKS4, + SOCKS5 and HTTP servers respectively. `SOCKS4`, `SOCKS5`, and `HTTP` are all aliases, respectively. + + `addr` - The IP address or DNS name of the proxy server. + + `port` - The port of the proxy server. Defaults to 1080 for socks and 8080 for http. + + `rdns` - This is a boolean flag than modifies the behavior regarding DNS resolving. + If it is set to True, DNS resolving will be preformed remotely, on the server. + If it is set to False, DNS resolving will be preformed locally. Please note that + setting this to True with SOCKS4 servers actually use an extension to the protocol, + called SOCKS4a, which may not be supported on all servers (SOCKS5 and http servers + always support DNS). The default is True. + + `username` - For SOCKS5 servers, this allows simple username / password authentication + with the server. For SOCKS4 servers, this parameter will be sent as the userid. + This parameter is ignored if an HTTP server is being used. If it is not provided, + authentication will not be used (servers may accept unauthenticated requests). + + `password` - This parameter is valid only for SOCKS5 servers and specifies the + respective password for the username provided. + + Example of usage: + + >>> s.set_proxy(socks.SOCKS5, "socks.example.com") # uses default port 1080 + >>> s.set_proxy(socks.SOCKS4, "socks.test.com", 1081) + + After the set_proxy method has been called, simply call the connect method with the + traditional parameters to establish a connection through the proxy: + + >>> s.connect(("www.sourceforge.net", 80)) + >>> + + Connection will take a bit longer to allow negotiation with the proxy server. + Please note that calling connect without calling `set_proxy` earlier will connect + without a proxy (just like a regular socket). + + Errors: Any errors in the connection process will trigger exceptions. The exception + may either be generated by the underlying socket layer or may be custom module + exceptions, whose details follow: + + class `ProxyError` - This is a base exception class. It is not raised directly but + rather all other exception classes raised by this module are derived from it. + This allows an easy way to catch all proxy-related errors. It descends from `IOError`. + + All `ProxyError` exceptions have an attribute `socket_err`, which will contain either a + caught `socket.error` exception, or `None` if there wasn't any. + + class `GeneralProxyError` - When thrown, it indicates a problem which does not fall + into another category. + + * `Sent invalid data` - This error means that unexpected data has been received from + the server. The most common reason is that the server specified as the proxy is + not really a SOCKS4/SOCKS5/HTTP proxy, or maybe the proxy type specified is wrong. + + * `Connection closed unexpectedly` - The proxy server unexpectedly closed the connection. + This may indicate that the proxy server is experiencing network or software problems. + + * `Bad proxy type` - This will be raised if the type of the proxy supplied to the + set_proxy function was not one of `SOCKS4`/`SOCKS5`/`HTTP`. + + * `Bad input` - This will be raised if the `connect()` method is called with bad input + parameters. + + class `SOCKS5AuthError` - This indicates that the connection through a SOCKS5 server + failed due to an authentication problem. + + * `Authentication is required` - This will happen if you use a SOCKS5 server which + requires authentication without providing a username / password at all. + + * `All offered authentication methods were rejected` - This will happen if the proxy + requires a special authentication method which is not supported by this module. + + * `Unknown username or invalid password` - Self descriptive. + + class `SOCKS5Error` - This will be raised for SOCKS5 errors which are not related to + authentication. + The parameter is a tuple containing a code, as given by the server, + and a description of the + error. The possible errors, according to the RFC, are: + + * `0x01` - General SOCKS server failure - If for any reason the proxy server is unable to + fulfill your request (internal server error). + * `0x02` - connection not allowed by ruleset - If the address you're trying to connect to + is blacklisted on the server or requires authentication. + * `0x03` - Network unreachable - The target could not be contacted. A router on the network + had replied with a destination net unreachable error. + * `0x04` - Host unreachable - The target could not be contacted. A router on the network + had replied with a destination host unreachable error. + * `0x05` - Connection refused - The target server has actively refused the connection + (the requested port is closed). + * `0x06` - TTL expired - The TTL value of the SYN packet from the proxy to the target server + has expired. This usually means that there are network problems causing the packet + to be caught in a router-to-router "ping-pong". + * `0x07` - Command not supported - For instance if the server does not support UDP. + * `0x08` - Address type not supported - The client has provided an invalid address type. + When using this module, this error should not occur. + + class `SOCKS4Error` - This will be raised for SOCKS4 errors. The parameter is a tuple + containing a code and a description of the error, as given by the server. The + possible error, according to the specification are: + + * `0x5B` - Request rejected or failed - Will be raised in the event of an failure for any + reason other then the two mentioned next. + * `0x5C` - request rejected because SOCKS server cannot connect to identd on the client - + The Socks server had tried an ident lookup on your computer and has failed. In this + case you should run an identd server and/or configure your firewall to allow incoming + connections to local port 113 from the remote server. + * `0x5D` - request rejected because the client program and identd report different user-ids - + The Socks server had performed an ident lookup on your computer and has received a + different userid than the one you have provided. Change your userid (through the + username parameter of the set_proxy method) to match and try again. + + class `HTTPError` - This will be raised for HTTP errors. The message will contain + the HTTP status code and provided error message. + + After establishing the connection, the object behaves like a standard socket. + + Methods like `makefile()` and `settimeout()` should behave just like regular sockets. + Call the `close()` method to close the connection. + + In addition to the `socksocket` class, an additional function worth mentioning is the + `set_default_proxy` function. The parameters are the same as the `set_proxy` method. + This function will set default proxy settings for newly created `socksocket` objects, + in which the proxy settings haven't been changed via the `set_proxy` method. + This is quite useful if you wish to force 3rd party modules to use a SOCKS proxy, + by overriding the socket object. + For example: + + >>> socks.set_default_proxy(socks.SOCKS5, "socks.example.com") + >>> socket.socket = socks.socksocket + >>> urllib.urlopen("http://www.sourceforge.net/") + + + PROBLEMS + --------- + + Please open a GitHub issue at https://github.com/Anorov/PySocks + Keywords: socks,proxy Platform: UNKNOWN -Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PySocks-1.6.8/PySocks.egg-info/PKG-INFO new/PySocks-1.7.0/PySocks.egg-info/PKG-INFO --- old/PySocks-1.6.8/PySocks.egg-info/PKG-INFO 2017-12-21 05:25:34.000000000 +0100 +++ new/PySocks-1.7.0/PySocks.egg-info/PKG-INFO 2019-05-11 12:16:31.000000000 +0200 @@ -1,14 +1,323 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: PySocks -Version: 1.6.8 +Version: 1.7.0 Summary: A Python SOCKS client module. See https://github.com/Anorov/PySocks for more information. Home-page: https://github.com/Anorov/PySocks Author: Anorov Author-email: anorov.vor...@gmail.com License: BSD -Description: UNKNOWN +Description: PySocks + ======= + + PySocks lets you send traffic through SOCKS and HTTP proxy servers. It is a modern fork of [SocksiPy](http://socksipy.sourceforge.net/) with bug fixes and extra features. + + 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 + * 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. + + Installation + ============ + + pip install PySocks + + Or download the tarball / `git clone` and... + + python setup.py install + + These will install both the `socks` and `sockshandler` modules. + + Alternatively, include just `socks.py` in your project. + + -------------------------------------------- + + *Warning:* PySocks/SocksiPy only supports HTTP proxies that use CONNECT tunneling. Certain HTTP proxies may not work with this library. If you wish to use HTTP (not SOCKS) proxies, it is recommended that you rely on your HTTP client's native proxy support (`proxies` dict for `requests`, or `urllib2.ProxyHandler` for `urllib2`) instead. + + -------------------------------------------- + + Usage + ===== + + ## socks.socksocket ## + + import socks + + s = socks.socksocket() # Same API as socket.socket in the standard lib + + s.set_proxy(socks.SOCKS5, "localhost") # SOCKS4 and SOCKS5 use port 1080 by default + # Or + s.set_proxy(socks.SOCKS4, "localhost", 4444) + # Or + s.set_proxy(socks.HTTP, "5.5.5.5", 8888) + + # Can be treated identical to a regular socket object + s.connect(("www.somesite.com", 80)) + s.sendall("GET / HTTP/1.1 ...") + print s.recv(4096) + + ## Monkeypatching ## + + To monkeypatch the entire standard library with a single default proxy: + + import urllib2 + import socket + import socks + + socks.set_default_proxy(socks.SOCKS5, "localhost") + socket.socket = socks.socksocket + + urllib2.urlopen("http://www.somesite.com/") # All requests will pass through the SOCKS proxy + + Note that monkeypatching may not work for all standard modules or for all third party modules, and generally isn't recommended. Monkeypatching is usually an anti-pattern in Python. + + ## urllib2 Handler ## + + Example use case with the `sockshandler` urllib2 handler. Note that you must import both `socks` and `sockshandler`, as the handler is its own module separate from PySocks. The module is included in the PyPI package. + + import urllib2 + import socks + from sockshandler import SocksiPyHandler + + opener = urllib2.build_opener(SocksiPyHandler(socks.SOCKS5, "127.0.0.1", 9050)) + print opener.open("http://www.somesite.com/") # All requests made by the opener will pass through the SOCKS proxy + + -------------------------------------------- + + Original SocksiPy README attached below, amended to reflect API changes. + + -------------------------------------------- + + SocksiPy + + A Python SOCKS module. + + (C) 2006 Dan-Haim. All rights reserved. + + See LICENSE file for details. + + + *WHAT IS A SOCKS PROXY?* + + A SOCKS proxy is a proxy server at the TCP level. In other words, it acts as + a tunnel, relaying all traffic going through it without modifying it. + SOCKS proxies can be used to relay traffic using any network protocol that + uses TCP. + + *WHAT IS SOCKSIPY?* + + This Python module allows you to create TCP connections through a SOCKS + proxy without any special effort. + It also supports relaying UDP packets with a SOCKS5 proxy. + + *PROXY COMPATIBILITY* + + SocksiPy is compatible with three different types of proxies: + + 1. SOCKS Version 4 (SOCKS4), including the SOCKS4a extension. + 2. SOCKS Version 5 (SOCKS5). + 3. HTTP Proxies which support tunneling using the CONNECT method. + + *SYSTEM REQUIREMENTS* + + Being written in Python, SocksiPy can run on any platform that has a Python + interpreter and TCP/IP support. + This module has been tested with Python 2.3 and should work with greater versions + just as well. + + + INSTALLATION + ------------- + + Simply copy the file "socks.py" to your Python's `lib/site-packages` directory, + and you're ready to go. [Editor's note: it is better to use `python setup.py install` for PySocks] + + + USAGE + ------ + + First load the socks module with the command: + + >>> import socks + >>> + + The socks module provides a class called `socksocket`, which is the base to all of the module's functionality. + + The `socksocket` object has the same initialization parameters as the normal socket + object to ensure maximal compatibility, however it should be noted that `socksocket` will only function with family being `AF_INET` and + type being either `SOCK_STREAM` or `SOCK_DGRAM`. + Generally, it is best to initialize the `socksocket` object with no parameters + + >>> s = socks.socksocket() + >>> + + The `socksocket` object has an interface which is very similiar to socket's (in fact + the `socksocket` class is derived from socket) with a few extra methods. + To select the proxy server you would like to use, use the `set_proxy` method, whose + syntax is: + + set_proxy(proxy_type, addr[, port[, rdns[, username[, password]]]]) + + Explanation of the parameters: + + `proxy_type` - The type of the proxy server. This can be one of three possible + choices: `PROXY_TYPE_SOCKS4`, `PROXY_TYPE_SOCKS5` and `PROXY_TYPE_HTTP` for SOCKS4, + SOCKS5 and HTTP servers respectively. `SOCKS4`, `SOCKS5`, and `HTTP` are all aliases, respectively. + + `addr` - The IP address or DNS name of the proxy server. + + `port` - The port of the proxy server. Defaults to 1080 for socks and 8080 for http. + + `rdns` - This is a boolean flag than modifies the behavior regarding DNS resolving. + If it is set to True, DNS resolving will be preformed remotely, on the server. + If it is set to False, DNS resolving will be preformed locally. Please note that + setting this to True with SOCKS4 servers actually use an extension to the protocol, + called SOCKS4a, which may not be supported on all servers (SOCKS5 and http servers + always support DNS). The default is True. + + `username` - For SOCKS5 servers, this allows simple username / password authentication + with the server. For SOCKS4 servers, this parameter will be sent as the userid. + This parameter is ignored if an HTTP server is being used. If it is not provided, + authentication will not be used (servers may accept unauthenticated requests). + + `password` - This parameter is valid only for SOCKS5 servers and specifies the + respective password for the username provided. + + Example of usage: + + >>> s.set_proxy(socks.SOCKS5, "socks.example.com") # uses default port 1080 + >>> s.set_proxy(socks.SOCKS4, "socks.test.com", 1081) + + After the set_proxy method has been called, simply call the connect method with the + traditional parameters to establish a connection through the proxy: + + >>> s.connect(("www.sourceforge.net", 80)) + >>> + + Connection will take a bit longer to allow negotiation with the proxy server. + Please note that calling connect without calling `set_proxy` earlier will connect + without a proxy (just like a regular socket). + + Errors: Any errors in the connection process will trigger exceptions. The exception + may either be generated by the underlying socket layer or may be custom module + exceptions, whose details follow: + + class `ProxyError` - This is a base exception class. It is not raised directly but + rather all other exception classes raised by this module are derived from it. + This allows an easy way to catch all proxy-related errors. It descends from `IOError`. + + All `ProxyError` exceptions have an attribute `socket_err`, which will contain either a + caught `socket.error` exception, or `None` if there wasn't any. + + class `GeneralProxyError` - When thrown, it indicates a problem which does not fall + into another category. + + * `Sent invalid data` - This error means that unexpected data has been received from + the server. The most common reason is that the server specified as the proxy is + not really a SOCKS4/SOCKS5/HTTP proxy, or maybe the proxy type specified is wrong. + + * `Connection closed unexpectedly` - The proxy server unexpectedly closed the connection. + This may indicate that the proxy server is experiencing network or software problems. + + * `Bad proxy type` - This will be raised if the type of the proxy supplied to the + set_proxy function was not one of `SOCKS4`/`SOCKS5`/`HTTP`. + + * `Bad input` - This will be raised if the `connect()` method is called with bad input + parameters. + + class `SOCKS5AuthError` - This indicates that the connection through a SOCKS5 server + failed due to an authentication problem. + + * `Authentication is required` - This will happen if you use a SOCKS5 server which + requires authentication without providing a username / password at all. + + * `All offered authentication methods were rejected` - This will happen if the proxy + requires a special authentication method which is not supported by this module. + + * `Unknown username or invalid password` - Self descriptive. + + class `SOCKS5Error` - This will be raised for SOCKS5 errors which are not related to + authentication. + The parameter is a tuple containing a code, as given by the server, + and a description of the + error. The possible errors, according to the RFC, are: + + * `0x01` - General SOCKS server failure - If for any reason the proxy server is unable to + fulfill your request (internal server error). + * `0x02` - connection not allowed by ruleset - If the address you're trying to connect to + is blacklisted on the server or requires authentication. + * `0x03` - Network unreachable - The target could not be contacted. A router on the network + had replied with a destination net unreachable error. + * `0x04` - Host unreachable - The target could not be contacted. A router on the network + had replied with a destination host unreachable error. + * `0x05` - Connection refused - The target server has actively refused the connection + (the requested port is closed). + * `0x06` - TTL expired - The TTL value of the SYN packet from the proxy to the target server + has expired. This usually means that there are network problems causing the packet + to be caught in a router-to-router "ping-pong". + * `0x07` - Command not supported - For instance if the server does not support UDP. + * `0x08` - Address type not supported - The client has provided an invalid address type. + When using this module, this error should not occur. + + class `SOCKS4Error` - This will be raised for SOCKS4 errors. The parameter is a tuple + containing a code and a description of the error, as given by the server. The + possible error, according to the specification are: + + * `0x5B` - Request rejected or failed - Will be raised in the event of an failure for any + reason other then the two mentioned next. + * `0x5C` - request rejected because SOCKS server cannot connect to identd on the client - + The Socks server had tried an ident lookup on your computer and has failed. In this + case you should run an identd server and/or configure your firewall to allow incoming + connections to local port 113 from the remote server. + * `0x5D` - request rejected because the client program and identd report different user-ids - + The Socks server had performed an ident lookup on your computer and has received a + different userid than the one you have provided. Change your userid (through the + username parameter of the set_proxy method) to match and try again. + + class `HTTPError` - This will be raised for HTTP errors. The message will contain + the HTTP status code and provided error message. + + After establishing the connection, the object behaves like a standard socket. + + Methods like `makefile()` and `settimeout()` should behave just like regular sockets. + Call the `close()` method to close the connection. + + In addition to the `socksocket` class, an additional function worth mentioning is the + `set_default_proxy` function. The parameters are the same as the `set_proxy` method. + This function will set default proxy settings for newly created `socksocket` objects, + in which the proxy settings haven't been changed via the `set_proxy` method. + This is quite useful if you wish to force 3rd party modules to use a SOCKS proxy, + by overriding the socket object. + For example: + + >>> socks.set_default_proxy(socks.SOCKS5, "socks.example.com") + >>> socket.socket = socks.socksocket + >>> urllib.urlopen("http://www.sourceforge.net/") + + + PROBLEMS + --------- + + Please open a GitHub issue at https://github.com/Anorov/PySocks + Keywords: socks,proxy Platform: UNKNOWN -Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PySocks-1.6.8/README.md new/PySocks-1.7.0/README.md --- old/PySocks-1.6.8/README.md 2017-12-21 05:05:00.000000000 +0100 +++ new/PySocks-1.7.0/README.md 2019-05-11 11:10:10.000000000 +0200 @@ -15,7 +15,7 @@ Features ======== -* SOCKS proxy client for Python 2.6 - 3.x +* SOCKS proxy client for Python 2.7 and 3.4+ * TCP and UDP both supported * 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.6.8/setup.cfg new/PySocks-1.7.0/setup.cfg --- old/PySocks-1.6.8/setup.cfg 2017-12-21 05:25:34.000000000 +0100 +++ new/PySocks-1.7.0/setup.cfg 2019-05-11 12:16:31.000000000 +0200 @@ -1,5 +1,4 @@ [egg_info] -tag_date = 0 tag_build = -tag_svn_revision = 0 +tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PySocks-1.6.8/setup.py new/PySocks-1.7.0/setup.py --- old/PySocks-1.6.8/setup.py 2017-12-21 05:21:04.000000000 +0100 +++ new/PySocks-1.7.0/setup.py 2019-05-11 11:18:35.000000000 +0200 @@ -1,29 +1,43 @@ #!/usr/bin/env python import os import sys +import re from setuptools import setup -VERSION = "1.6.8" +base_path = os.path.dirname(__file__) requirements = [] if os.name == "nt" and sys.version_info < (3, 0): # Required due to missing socket.inet_ntop & socket.inet_pton method in Windows Python 2.x requirements.append("win-inet-pton") +with open("README.md") as f: + long_description = f.read() + + +with open(os.path.join(base_path, "socks.py")) as f: + VERSION = re.compile(r'.*__version__ = "(.*?)"', re.S).match(f.read()).group(1) + setup( - name = "PySocks", - version = VERSION, - description = "A Python SOCKS client module. See https://github.com/Anorov/PySocks for more information.", - url = "https://github.com/Anorov/PySocks", - license = "BSD", - author = "Anorov", - author_email = "anorov.vor...@gmail.com", - keywords = ["socks", "proxy"], + name="PySocks", + version=VERSION, + description="A Python SOCKS client module. See https://github.com/Anorov/PySocks for more information.", + long_description=long_description, + long_description_content_type="text/markdown", + url="https://github.com/Anorov/PySocks", + license="BSD", + author="Anorov", + author_email="anorov.vor...@gmail.com", + keywords=["socks", "proxy"], py_modules=["socks", "sockshandler"], install_requires=requirements, + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", classifiers=( - 'Programming Language :: Python :: 2.6', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3', - ) + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + ), ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PySocks-1.6.8/socks.py new/PySocks-1.7.0/socks.py --- old/PySocks-1.6.8/socks.py 2017-12-21 05:05:00.000000000 +0100 +++ new/PySocks-1.7.0/socks.py 2019-05-11 11:30:38.000000000 +0200 @@ -1,61 +1,8 @@ -"""SocksiPy - Python SOCKS module. - -Copyright 2006 Dan-Haim. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. -3. Neither the name of Dan Haim nor the names of his contributors may be used - to endorse or promote products derived from this software without specific - prior written permission. - -THIS SOFTWARE IS PROVIDED BY DAN HAIM "AS IS" AND ANY EXPRESS OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -EVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA -OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -This module provides a standard socket-like interface for Python -for tunneling connections through SOCKS proxies. - -=============================================================================== - -Minor modifications made by Christopher Gilbert (http://motomastyle.com/) -for use in PyLoris (http://pyloris.sourceforge.net/) - -Minor modifications made by Mario Vilas (http://breakingcode.wordpress.com/) -mainly to merge bug fixes found in Sourceforge - -Modifications made by Anorov (https://github.com/Anorov) --Forked and renamed to PySocks --Fixed issue with HTTP proxy failure checking (same bug that was in the - old ___recvall() method) --Included SocksiPyHandler (sockshandler.py), to be used as a urllib2 handler, - courtesy of e000 (https://github.com/e000): - https://gist.github.com/869791#file_socksipyhandler.py --Re-styled code to make it readable - -Aliased PROXY_TYPE_SOCKS5 -> SOCKS5 etc. - -Improved exception handling and output - -Removed irritating use of sequence indexes, replaced with tuple unpacked - variables - -Fixed up Python 3 bytestring handling - chr(0x03).encode() -> b"\x03" - -Other general fixes --Added clarification that the HTTP proxy connection method only supports - CONNECT-style tunneling HTTP proxies --Various small bug fixes -""" - from base64 import b64encode -from collections import Callable +try: + from collections.abc import Callable +except ImportError: + from collections import Callable from errno import EOPNOTSUPP, EINVAL, EAGAIN import functools from io import BytesIO @@ -66,7 +13,7 @@ import struct import sys -__version__ = "1.6.7" +__version__ = "1.7.0" if os.name == "nt" and sys.version_info < (3, 0): @@ -114,7 +61,7 @@ self.socket_err = socket_err if socket_err: - self.msg += ": {0}".format(socket_err) + self.msg += ": {}".format(socket_err) def __str__(self): return self.msg @@ -533,6 +480,14 @@ if chosen_auth[1:2] == b"\x02": # Okay, we need to perform a basic username/password # authentication. + if not (username and password): + # Although we said we don't support authentication, the + # server may still request basic username/password + # authentication + raise SOCKS5AuthError("No username/password supplied. " + "Server requested username/password" + " authentication") + writer.write(b"\x01" + chr(len(username)).encode() + username + chr(len(password)).encode() @@ -575,7 +530,7 @@ if status != 0x00: # Connection failed: server returned an error error = SOCKS5_ERRORS.get(status, "Unknown error") - raise SOCKS5Error("{0:#04x}: {1}".format(status, error)) + raise SOCKS5Error("{:#04x}: {}".format(status, error)) # Get the bound address/port bnd = self._read_SOCKS5_address(reader) @@ -693,7 +648,7 @@ if status != 0x5A: # Connection failed: server returned an error error = SOCKS4_ERRORS.get(status, "Unknown error") - raise SOCKS4Error("{0:#04x}: {1}".format(status, error)) + raise SOCKS4Error("{:#04x}: {}".format(status, error)) # Get the bound address/port self.proxy_sockname = (socket.inet_ntoa(resp[4:]), @@ -753,7 +708,7 @@ "HTTP proxy server did not return a valid HTTP status") if status_code != 200: - error = "{0}: {1}".format(status_code, status_msg) + error = "{}: {}".format(status_code, status_msg) if status_code in (400, 403, 405): # It's likely that the HTTP proxy server does not support the # CONNECT tunneling method @@ -772,7 +727,7 @@ } @set_self_blocking - def connect(self, dest_pair): + def connect(self, dest_pair, catch_errors=None): """ Connects to the specified destination through a proxy. Uses the same API as socket's connect(). @@ -834,14 +789,17 @@ except socket.error as error: # Error while connecting to proxy self.close() - proxy_addr, proxy_port = proxy_addr - proxy_server = "{0}:{1}".format(proxy_addr, proxy_port) - printable_type = PRINTABLE_PROXY_TYPES[proxy_type] - - msg = "Error connecting to {0} proxy {1}".format(printable_type, - proxy_server) - log.debug("%s due to: %s", msg, error) - raise ProxyConnectionError(msg, error) + if not catch_errors: + proxy_addr, proxy_port = proxy_addr + proxy_server = "{}:{}".format(proxy_addr, proxy_port) + printable_type = PRINTABLE_PROXY_TYPES[proxy_type] + + msg = "Error connecting to {} proxy {}".format(printable_type, + proxy_server) + log.debug("%s due to: %s", msg, error) + raise ProxyConnectionError(msg, error) + else: + raise error else: # Connected to proxy server, now negotiate @@ -850,13 +808,32 @@ negotiate = self._proxy_negotiators[proxy_type] negotiate(self, dest_addr, dest_port) except socket.error as error: - # Wrap socket errors - self.close() - raise GeneralProxyError("Socket error", error) + if not catch_errors: + # Wrap socket errors + self.close() + raise GeneralProxyError("Socket error", error) + else: + raise error except ProxyError: # Protocol error while negotiating with proxy self.close() raise + + @set_self_blocking + def connect_ex(self, dest_pair): + """ https://docs.python.org/3/library/socket.html#socket.socket.connect_ex + Like connect(address), but return an error indicator instead of raising an exception for errors returned by the C-level connect() call (other problems, such as "host not found" can still raise exceptions). + """ + try: + self.connect(dest_pair, catch_errors=True) + return 0 + except OSError as e: + # If the error is numeric (socket errors are numeric), then return number as + # connect_ex expects. Otherwise raise the error again (socket timeout for example) + if e.errno: + return e.errno + else: + raise def _proxy_addr(self): """ @@ -867,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 + return proxy_addr, proxy_port \ No newline at end of file