403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/httplib2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/httplib2/socks.pyc
ó
âQÁNc
@sadZddlZddlZddlZddlZeeddƒdkr]edƒ‚ndZdZ	dZ
dZdaejZ
d	efd
„ƒYZdefd„ƒYZd
efd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZd1Zd2Zd3Zd4Zdddeddd-„Zd.„Zd/ejfd0„ƒYZdS(5sSocksiPy - 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.
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 DAMANGE.


This module provides a standard socket-like interface for Python
for tunneling connections through SOCKS proxies.

iÿÿÿÿNtsockets-socket.socket missing, proxy support unusableiiiit
ProxyErrorcBseZRS((t__name__t
__module__(((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyR;stGeneralProxyErrorcBseZRS((RR(((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyR<stSocks5AuthErrorcBseZRS((RR(((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyR=stSocks5ErrorcBseZRS((RR(((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyR>stSocks4ErrorcBseZRS((RR(((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyR?st	HTTPErrorcBseZRS((RR(((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyR@stsuccesssinvalid datas
not connecteds
not availablesbad proxy types	bad inputt	succeededsgeneral SOCKS server failures!connection not allowed by rulesetsNetwork unreachablesHost unreachablesConnection refusedsTTL expiredsCommand not supportedsAddress type not supporteds
Unknown errorsauthentication is requireds0all offered authentication methods were rejecteds$unknown username or invalid passwords
unknown errorsrequest grantedsrequest rejected or failedsLrequest rejected because SOCKS server cannot connect to identd on the clientsPrequest rejected because the client program and identd report different user-idscCs||||||fadS(s´setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]])
    Sets a default proxy which all further socksocket objects will use,
    unless explicitly changed.
    N(t
_defaultproxy(t	proxytypetaddrtporttrdnstusernametpassword((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pytsetdefaultproxy`scCs+tdkrt|j_ntdƒ‚dS(s2wrapmodule(module)
    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.
    isno proxy specifiedN(isno proxy specified(RtNonet
socksocketRR(tmodule((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyt
wrapmodulehsRcBs§eZdZejejddd„Zd„Zd„Z	d„Z
d„Zdddeddd„Z
d„Zd	„Zd
„Zd„Zd„Zd
„Zd„ZRS(ssocksocket([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.
    icCsYtj|||||ƒtdkr1t|_n	d|_d|_d|_t|_dS(N(NNNNNN(	t
_orgsockett__init__RRt_socksocket__proxyt_socksocket__proxysocknamet_socksocket__proxypeernametTruet_socksocket__httptunnel(tselftfamilyttypetprotot_sock((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyR{s			cCsd|j|ƒ}xNt|ƒ|kr_|j|t|ƒƒ}|sRtdƒ‚n||}qW|S(s®__recvall(count) -> data
        Receive EXACTLY the number of bytes requested from the socket.
        Blocks until the required number of bytes have been received.
        isconnection closed unexpectedly(isconnection closed unexpectedly(trecvtlenR(Rtcounttdatatd((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyt	__recvall…scGs4|js|j|ƒ}ntt|ƒj||ŒS(ss override socket.socket.sendall method to rewrite the header 
        for non-tunneling proxies if needed 
        (Rt_socksocket__rewriteproxytsuperRtsendall(Rtcontenttargs((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyR+‘s	c
CsTd\}}|jdƒ}x_|D]W}|jƒjdƒrF|}q"|jƒjdƒsp|jƒjdƒr"|}q"q"W|rG|rG|j|ƒ|j|ƒ|jdƒd}|jdƒ}|jdd
kr|jdd
kr|jd	|jƒƒn|jd	d
|ƒ|jd	d|d	||d|dfƒndj|ƒS(sÓ rewrite HTTP request headers to support non-tunneling proxies 
        (i.e. those which do not support the CONNECT method).
        This only works for HTTP (not HTTPS) since HTTPS requires tunneling.
        s
shost:tgettpostt iiiisHost: %ss%s http://%s%s %siN(NN(	Rtsplittlowert
startswithtremoveRtinsertt_socksocket__getauthheadertjoin(Rtheaderthosttendptthdrsthdr((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyt__rewriteproxy™s"
	*


&/cCs-|jdd|jd}dtj|ƒS(Nit:isProxy-Authorization: Basic (Rtbase64t	b64encode(Rtauth((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyt__getauthheader°scCs||||||f|_dS(s­setproxy(proxytype, addr[, port[, rdns[, username[, password]]]])
        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.
        rdns -        Should DNS queries be preformed on the remote side
                (rather than the local side). The default is True.
                Note: This has no effect with SOCKS4 servers.
        username -    Username to authenticate with to the server.
                The default is no authentication.
        password -    Password to authenticate with to the server.
                Only relevant when username is also provided.
        N(R(RRR
RRRR((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pytsetproxy´sc
Cs$|jdd
krK|jdd
krK|jtjdddddƒƒn|jtjddddƒƒ|jdƒ}|dd!tdƒjƒkr»|jƒt	dt
dfƒ‚n|dd!tdƒjƒkrÝng|dd!tdƒjƒkrï|jtdƒjƒtt|jdƒƒ|jdtt|jdƒƒ|jdƒ|jdƒ}|dd!tdƒjƒkrª|jƒt	dt
dfƒ‚n|dd!tdƒjƒkrD|jƒtdt
dfƒ‚qDnU|jƒ|dtd	ƒjƒkr.tdt
dfƒ‚nt	dt
dfƒ‚tjddddƒ}y-tj|ƒ}|tdƒjƒ|}WnŒtjk
r|jdrâd
}|tdƒjƒtt|ƒƒjƒ|}qtjtj|ƒƒ}|tdƒjƒ|}nX|tjd
|ƒ}|j|ƒ|jdƒ}|dd!tdƒjƒkrŒ|jƒt	dt
dfƒ‚n0|dd!tdƒjƒkr|jƒt|dd!ƒdkrtt|dd!ƒtt|dd!ƒfƒ‚q¼tdtdfƒ‚n¢|dd!tdƒjƒkrK|jdƒ}nq|dd!tdƒjƒkrœ||jdƒ}|jt|dd!ƒƒ}n |jƒt	dt
dfƒ‚tjd
|jdƒƒd}	||	f|_|d
krtj|ƒ|f|_n||f|_d
S(sk__negotiatesocks5(self,destaddr,destport)
        Negotiates a connection through a SOCKS5 server.
        iitBBBBiitBBBiiiÿs>Hii	N(RRR+tstructtpackt_socksocket__recvalltchrtencodetcloseRt_generalerrorsR$Rt_socks5autherrorsRt	inet_atonterrort
gethostbynametordRt
_socks5errorsR#tunpackRt	inet_ntoaR(
Rtdestaddrtdestportt
chosenauthtauthstattreqtipaddrtrespt	boundaddrt	boundport((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyt__negotiatesocks5Çsn&%
]



3


3
cCs|jS(sigetsockname() -> address info
        Returns the bound IP address and port number at the proxy.
        (R(R((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pytgetproxysockname#scCs
tj|ƒS(s`getproxypeername() -> address info
        Returns the IP and port number of the proxy.
        (Rtgetpeername(R((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pytgetproxypeername)scCs|jS(s£getpeername() -> address info
        Returns the IP address and port number of the destination
        machine (note: getproxypeername returns the proxy)
        (R(R((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyR`/scCs\t}ytj|ƒ}Wn]tjk
rx|jdr]tjdddddƒ}t}qytjtj|ƒƒ}nXtjddd|ƒ|}|jddkr¼||jd}n|t
dƒjƒ}|rõ||t
dƒjƒ}n|j|ƒ|j
dƒ}|dd!t
dƒjƒkrS|jƒtdtdfƒ‚n|dd!t
d	ƒjƒkrï|jƒt|dd!ƒdkrÖ|jƒtt|dd!ƒtt|dd!ƒd	fƒ‚qïtd
tdfƒ‚ntj|dƒtjd|dd!ƒdf|_|dkrItj|ƒ|f|_n||f|_dS(sk__negotiatesocks4(self,destaddr,destport)
        Negotiates a connection through a SOCKS4 server.
        iRDiis>BBHiiiiZi[i\i]i^s>HN(i[i\i](tFalseRRNRORRFRGRRPRRIRJR+RHRKRRLRQRt
_socks4errorsRTRSRR(RRURVtrmtrslvRZRYR[((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyt__negotiatesocks46s:
	



73cCsù|jdstj|ƒ}n|}d|dt|ƒdg}|d|dg7}|jddkr’|jddkr’||jƒdg7}n|jdƒ|jd	j|ƒj	ƒƒ|j
d
ƒ}x2|jdj	ƒƒdkrþ||j
d
ƒ}qÍW|jƒd
j
dj	ƒdƒ}|d
dj	ƒdj	ƒfkrf|jƒtd
td
fƒ‚nyt|d
ƒ}Wn1tk
r­|jƒtd
td
fƒ‚nX|dkrÝ|jƒt||dfƒ‚nd|_||f|_dS(sh__negotiatehttp(self,destaddr,destport)
        Negotiates a connection through an HTTP server.
        isCONNECT R>s HTTP/1.1
sHost: s
iitis

iÿÿÿÿiR0isHTTP/1.0sHTTP/1.1iÈs0.0.0.0N(s0.0.0.0i(RRRPtstrRR6tappendR+R7RJR#tfindt
splitlinesR1RKRRLtintt
ValueErrorRRR(RRURVR
theadersR[t
statuslinet
statuscode((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyt__negotiatehttpfs4
&
""



	cCs¯t|ƒttfks\t|ƒdks\t|dƒtdƒks\t|dƒtkrutdtdfƒ‚n|jdtkré|jdd
kr«|jd}nd}t
j||jd|fƒ|j|d|dƒnÂ|jdt
kr]|jdd
kr|jd}nd}t
j||jd|fƒ|j|d|dƒnN|jdtkrÑ|jdd
kr“|jd}nd}t
j||jd|fƒ|j|d|dƒnÚ|jdtkra|jdd
kr|jd}nd}t
j||jd|fƒ|ddkrU|j|d|dƒq«t|_nJ|jdd
kr•t
j||d|dfƒntd	td	fƒ‚d
S(sÿconnect(self, despair)
        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().
        iiRfiii8ii»iN(R tlistttupleR$RkRRLRtPROXY_TYPE_SOCKS5RRtconnectt_socksocket__negotiatesocks5tPROXY_TYPE_SOCKS4t_socksocket__negotiatesocks4tPROXY_TYPE_HTTPt_socksocket__negotiatehttptPROXY_TYPE_HTTP_NO_TUNNELRbR(Rtdestpairtportnum((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyRtŠs>\!N(RRt__doc__RtAF_INETtSOCK_STREAMRRRHR+R)R6RRCRuR_RaR`RwRyRt(((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyRts
					\				0	$(ssuccesssinvalid datas
not connecteds
not availablesbad proxy types	bad input(
R
sgeneral SOCKS server failures!connection not allowed by rulesetsNetwork unreachablesHost unreachablesConnection refusedsTTL expiredsCommand not supportedsAddress type not supporteds
Unknown error(R
sauthentication is requireds0all offered authentication methods were rejecteds$unknown username or invalid passwords
unknown error(srequest grantedsrequest rejected or failedsLrequest rejected because SOCKS server cannot connect to identd on the clientsPrequest rejected because the client program and identd report different user-idss
unknown error(R}R?RRFtsystgetattrRtImportErrorRvRsRxRzRRt	ExceptionRRRRRRRLRRRMRcRRRR(((s2/usr/lib/python2.7/dist-packages/httplib2/socks.pyt<module>s^		

Youez - 2016 - github.com/yon3zu
LinuXploit