SocksiPy - Python SOCKS module. Version 1.00
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.
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 DAMANGE.
This module provides a standard socket-like interface for Python for tunneling connections through SOCKS proxies.
Sets a default proxy which all further socksocket objects will use, unless explicitly changed.
Bases: socket._socketobject
socksocket([family[, type[, proto]]]) -> socket object Open a SOCKS enabled socket. The parameters are the same as those of the standard socket init. In order for SOCKS to work, you must specify family=AF_INET, type=SOCK_STREAM and proto=0.
Connects to the specified destination through a proxy. destpar - A tuple of the IP/DNS address and the port number. (identical to socket’s connect). To select the proxy server use setproxy().
Returns the IP address and port number of the destination machine (note: getproxypeername returns the proxy)
getsockname() -> address info Returns the bound IP address and port number at the proxy.
override socket.socket.sendall method to rewrite the header for non-tunneling proxies if needed
Sets the proxy to be used. proxytype - The type of the proxy to be used. Three types
are supported: PROXY_TYPE_SOCKS4 (including socks4a), PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP
addr - The address of the server (IP or DNS). port - The port of the server. Defaults to 1080 for SOCKS
servers and 8080 for HTTP proxy servers.
Attempts to replace a module’s socket library with a SOCKS socket. Must set a default proxy using setdefaultproxy(...) first. This will only work on modules that import socket directly into the namespace; most of the Python Standard Library falls into this category.
Bases: object
An HTTP client that handles:
and more.
Add a key and cert that will be used any time a request requires authentication.
Add a name and password that will be used any time a request requires authentication.
Performs a single HTTP request.
The ‘uri’ is the URI of the HTTP resource and can begin with either ‘http’ or ‘https’. The value of ‘uri’ must be an absolute URI.
The ‘method’ is the HTTP method to perform, such as GET, POST, DELETE, etc. There is no restriction on the methods allowed.
The ‘body’ is the entity body to be sent with the request. It is a string object.
Any extra headers that are to be sent with the request should be provided in the ‘headers’ dictionary.
The maximum number of redirect to follow before raising an exception is ‘redirections. The default is 5.
The return value is a tuple of (response, content), the first being and instance of the ‘Response’ class, the second being a string that contains the response entity body.
Bases: dict
An object more like email.Message than httplib.HTTPResponse.
HTTP protocol version used by server. 10 for HTTP/1.0, 11 for HTTP/1.1.
Reason phrase returned by server.
Status code returned by server.
Bases: object
Collect information required to use a proxy.
Bases: cup.thirdp.httplib2.HttpLib2ErrorWithResponse
Bases: cup.thirdp.httplib2.HttpLib2ErrorWithResponse
Bases: cup.thirdp.httplib2.HttpLib2ErrorWithResponse
Bases: cup.thirdp.httplib2.HttpLib2ErrorWithResponse