B
    ¨ô/bny  ã            	   @   sz  d dl mZ yd dlmZ W n  ek
r<   d dlmZ Y nX d dlmZmZm	Z	 d dl
Z
d dlmZ d dlZd dlZd dlmZ d dlZd dlZd dlZdZejdkrÜejd	k rÜyd dlZW n ek
rÚ   ed
ƒ‚Y nX e e¡Zd ZZd ZZd ZZeeedœZ e!e"e  #¡ e  $¡ ƒƒZ%ej Z&Z'dd„ Z(G dd„ de)ƒZ*G dd„ de*ƒZ+G dd„ de*ƒZ,G dd„ de*ƒZ-G dd„ de*ƒZ.G dd„ de*ƒZ/G dd„ de*ƒZ0dd d!d"œZ1d#d$d%d&d'd(d)d*d+œZ2ed,ed,ed-iZ3d@d/d0„Z4d1d2„ Z5d3d4„ Z6e6Z7d5d6„ Z8e8Z9dAd7d8„Z:G d9d:„ d:ejƒZ;d;d<„ Z<xBd=D ]:Ze=e;edƒZ>e?e>eƒs(e;j@ Ae¡ eBe;ee<eƒƒ q(W G d>d?„ d?e;ƒZCdS )Bé    )Ú	b64encode)ÚCallable)Ú
EOPNOTSUPPÚEINVALÚEAGAINN)ÚBytesIO)ÚSEEK_CURz1.7.1Únt)é   r   z8To run PySocks on Windows you must install win_inet_ptoné   é   r
   )ÚSOCKS4ÚSOCKS5ÚHTTPc                s   t  ˆ ¡‡ fdd„ƒ}|S )Nc           
      sp   | d }zNy$|  ¡ }|dkr&| d¡ ˆ | |ŽS  tk
rR } z‚ W d d }~X Y nX W d |dkrj| d¡ X d S )Nr   TF)Ú
gettimeoutÚsetblockingÚ	Exception)ÚargsÚkwargsÚselfZ_is_blockingÚe)Úfunction© ú)/usr/lib/python3.7/site-packages/socks.pyÚwrapper(   s    

z"set_self_blocking.<locals>.wrapper)Ú	functoolsÚwraps)r   r   r   )r   r   Úset_self_blocking&   s    r   c               @   s"   e Zd ZdZddd„Zdd„ ZdS )Ú
ProxyErrorz4Socket_err contains original socket.error exception.Nc             C   s(   || _ || _|r$|  j d |¡7  _ d S )Nz: {})ÚmsgÚ
socket_errÚformat)r   r   r    r   r   r   Ú__init__;   s    zProxyError.__init__c             C   s   | j S )N)r   )r   r   r   r   Ú__str__B   s    zProxyError.__str__)N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r"   r#   r   r   r   r   r   9   s   
r   c               @   s   e Zd ZdS )ÚGeneralProxyErrorN)r$   r%   r&   r   r   r   r   r(   F   s   r(   c               @   s   e Zd ZdS )ÚProxyConnectionErrorN)r$   r%   r&   r   r   r   r   r)   J   s   r)   c               @   s   e Zd ZdS )ÚSOCKS5AuthErrorN)r$   r%   r&   r   r   r   r   r*   N   s   r*   c               @   s   e Zd ZdS )ÚSOCKS5ErrorN)r$   r%   r&   r   r   r   r   r+   R   s   r+   c               @   s   e Zd ZdS )ÚSOCKS4ErrorN)r$   r%   r&   r   r   r   r   r,   V   s   r,   c               @   s   e Zd ZdS )Ú	HTTPErrorN)r$   r%   r&   r   r   r   r   r-   Z   s   r-   zRequest rejected or failedzLRequest rejected because SOCKS server cannot connect to identd on the clientzPRequest rejected because the client program and identd report different user-ids)é[   é\   é]   zGeneral SOCKS server failurez!Connection not allowed by rulesetzNetwork unreachablezHost unreachablezConnection refusedzTTL expiredz(Command not supported, or protocol errorzAddress type not supported)r   r   r
   é   é   é   é   é   i8  i  Tc             C   s.   | ||||r|  ¡ nd|r"|  ¡ ndft_dS )z›Sets a default proxy.

    All further socksocket objects will use the default unless explicitly
    changed. All parameters are as for socket.set_proxy().N)ÚencodeÚ
socksocketÚdefault_proxy)Ú
proxy_typeÚaddrÚportÚrdnsÚusernameÚpasswordr   r   r   Úset_default_proxys   s    r?   c              O   s    d|kr|  d¡|d< t| |ŽS )NÚ	proxytyper9   )Úpopr?   )r   r   r   r   r   Úsetdefaultproxy~   s    rB   c               C   s   t jS )z4Returns the default proxy, set by set_default_proxy.)r7   r8   r   r   r   r   Úget_default_proxy„   s    rC   c             C   s   t jrt | j_ntdƒ‚dS )a  Attempts to replace a module's socket library with a SOCKS socket.

    Must set a default proxy using set_default_proxy(...) first. This will
    only work on modules that import socket directly into the namespace;
    most of the Python Standard Library falls into this category.zNo default proxy specifiedN)r7   r8   Úsocketr(   )Úmoduler   r   r   Úwrap_module‹   s    
rF   c
             C   s8  | \}
}|
  d¡r|
 d¡}
|r4|  d¡r4| d¡}d}xæt ||dtj¡D ]Ð}|\}}}}}d}yxt|||ƒ}|	rŒx|	D ]}|j|Ž  qzW t|tt	fƒr¤| 
|¡ |r¼| ||||||¡ |rÊ| |¡ | |
|f¡ |S  tjtfk
r } z|}|r
| ¡  d}W dd}~X Y qLX qLW |r*|‚t d¡‚dS )aí  create_connection(dest_pair, *[, timeout], **proxy_args) -> socket object

    Like socket.create_connection(), but connects to proxy
    before returning the socket object.

    dest_pair - 2-tuple of (IP/hostname, port).
    **proxy_args - Same args passed to socksocket.set_proxy() if present.
    timeout - Optional socket timeout value, in seconds.
    source_address - tuple (host, port) for the socket to bind to as its source
    address before connecting (only for compatibility)
    ú[z[]Nr   zgai returned empty list.)Ú
startswithÚstriprD   ÚgetaddrinfoÚSOCK_STREAMr7   Ú
setsockoptÚ
isinstanceÚintÚfloatÚ
settimeoutÚ	set_proxyÚbindÚconnectÚerrorr   Úclose)Ú	dest_pairÚtimeoutÚsource_addressr9   Ú
proxy_addrÚ
proxy_portZ
proxy_rdnsZproxy_usernameZproxy_passwordÚsocket_optionsZremote_hostZremote_portÚerrÚrÚfamilyÚsocket_typeÚprotoÚ	canonnameÚsaÚsockÚoptr   r   r   r   Úcreate_connection™   s>    





re   c               @   s   e Zd ZdZdd„ Zeƒ ZdS )Ú_BaseSocketzBAllows Python 2 delegated methods such as send() to be overridden.c             O   sH   t j| f|ž|Ž tƒ | _x(| jD ]}t| |ƒ| j|< t| |ƒ q"W d S )N)Ú_orig_socketr"   ÚdictÚ_savedmethodsÚ
_savenamesÚgetattrÚdelattr)r   ÚposÚkwÚnamer   r   r   r"   Ø   s
    z_BaseSocket.__init__N)r$   r%   r&   r'   r"   Úlistrj   r   r   r   r   rf   Ö   s   rf   c                s   ‡ fdd„S )Nc                s   | j ˆ  ||ŽS )N)ri   )r   rm   rn   )ro   r   r   Ú<lambda>ä   ó    z_makemethod.<locals>.<lambda>r   )ro   r   )ro   r   Ú_makemethodã   s    rs   )ÚsendtoÚsendÚrecvfromÚrecvc                   s<  e Zd ZdZdZejejdf‡ fdd„	Zdd„ Z	‡ fdd	„Z
d
d„ Zdd„ Zd7dd„Zdd„ Z‡ fdd„Z‡ fdd„Zd8‡ fdd„	Zd9‡ fdd„	Zdd„ Z‡ fdd„Zdd „ ZeZd!d"„ ZeZd#d$„ ZeZd%d&„ Z‡ fd'd(„Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Z e!ee"ee#e iZ$e%d:‡ fd1d2„	ƒZ&e%d3d4„ ƒZ'd5d6„ Z(‡  Z)S );r7   a2  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 and proto=0.
    The "type" argument must be either SOCK_STREAM or SOCK_DGRAM.
    Nr   c                sp   |t jt jfkr"d}t| |¡ƒ‚tt| ƒj|||f|ž|Ž d | _| j	rT| j	| _
nd| _
d | _d | _d | _d S )Nz0Socket type must be stream or datagram, not {!r})NNNNNN)rD   rK   Ú
SOCK_DGRAMÚ
ValueErrorr!   Úsuperr7   r"   Ú
_proxyconnr8   ÚproxyÚproxy_socknameÚproxy_peernameÚ_timeout)r   r^   Útyper`   r   r   r   )Ú	__class__r   r   r"   ü   s    
zsocksocket.__init__c             C   s@   d}x6t |ƒ|k r:| |t |ƒ ¡}|s0tdƒ‚||7 }qW |S )zŠReceive EXACTLY the number of bytes requested from the file object.

        Blocks until the required number of bytes have been received.rr   zConnection closed unexpectedly)ÚlenÚreadr(   )r   ÚfileÚcountÚdataÚdr   r   r   Ú_readall  s    zsocksocket._readallc                s@   || _ y|  ¡ }tt| ƒ | j ¡ W n tjk
r:   Y nX d S )N)r   Úget_proxy_peernamerz   r7   rP   rD   rT   )r   rW   Zpeer)r   r   r   rP     s    zsocksocket.settimeoutc             C   s   | j S )N)r   )r   r   r   r   r   #  s    zsocksocket.gettimeoutc             C   s   |r|   d ¡ n
|   d¡ d S )Ng        )rP   )r   Úvr   r   r   r   &  s    zsocksocket.setblockingTc             C   s.   |||||r|  ¡ nd|r"|  ¡ ndf| _dS )a   Sets the proxy to be used.

        proxy_type -  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 performed 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)r6   r|   )r   r9   r:   r;   r<   r=   r>   r   r   r   rQ   ,  s    zsocksocket.set_proxyc             O   s"   d|kr|  d¡|d< | j||ŽS )Nr@   r9   )rA   rQ   )r   r   r   r   r   r   ÚsetproxyA  s    zsocksocket.setproxyc                sø   | j \}}}}}}|r"| jtjkr4tj| f|ž|ŽS | jrFt td¡‚|t	kr^d}	t t
|	¡‚tt| ƒj||Ž |  ¡ \}
}d|f}tƒ | _|  ¡ }| j |¡ d}|  | j||¡\}
}|\}}
|\}
}tt| ƒ ||f¡ tt| ƒ | j¡ d| _dS )zVImplements proxy connection for UDP sockets.

        Happens during the bind() phase.z"Socket already bound to an addressz'UDP only supported by SOCKS5 proxy typeÚ0ó   )z0.0.0.0r   N)r|   r€   rD   rx   rg   rR   r{   rT   r   r   r   rz   r7   ÚgetsocknameÚ_proxy_addrrS   Ú_SOCKS5_requestrP   r   r}   )r   rm   rn   r9   rY   rZ   r<   r=   r>   r   Ú_r;   Údstr|   ZUDP_ASSOCIATEZrelayÚhost)r   r   r   rR   F  s*    zsocksocket.bindc       
         s¢   | j tjkr$tt| ƒj|f|ž|ŽS | js4|  d¡ |d }|d d… }tƒ }d}| 	|¡ d}| 	|¡ |  
||¡ tt| ƒj| ¡ | f|ž|Ž}	|	| ¡  S )N)Ú r   éÿÿÿÿs     ó    )r€   rD   rx   rz   r7   rt   r{   rR   r   ÚwriteÚ_write_SOCKS5_addressru   ÚgetvalueÚtell)
r   Úbytesr   r   ÚaddressÚflagsÚheaderZRSVZ
STANDALONEÚsent)r   r   r   rt   k  s    


zsocksocket.sendtoc                s:   | j tjkr | j||| jf|ŽS tt| ƒj||f|ŽS d S )N)r€   rD   rx   rt   r~   rz   r7   ru   )r   r›   r   r   )r   r   r   ru     s    zsocksocket.sendc       	         s¾   | j tjkrtt| ƒ ||¡S | js.|  d¡ ttt| ƒ 	|d |¡ƒ}| 
dt¡ | d¡}t|ƒrntdƒ‚|  |¡\}}| jr¬| j\}}||ks |d|fkr¬t td¡‚| |¡||ffS )N)r”   r   i   r   r   zReceived UDP packet fragmentr   zPacket filtered)r€   rD   rx   rz   r7   rv   r{   rR   r   rw   Úseekr   rƒ   ÚordÚNotImplementedErrorÚ_read_SOCKS5_addressr~   rT   r   )	r   Úbufsizer   ÚbufÚfragZfromhostZfromportZpeerhostZpeerport)r   r   r   rv   …  s    


zsocksocket.recvfromc             O   s   | j ||Ž\}}|S )N)rv   )r   rm   rn   r›   r‘   r   r   r   rw   ™  s    zsocksocket.recvc                s   | j r| j  ¡  tt| ƒ ¡ S )N)r{   rU   rz   r7   )r   )r   r   r   rU     s    
zsocksocket.closec             C   s   | j S )z:Returns the bound IP address and port number at the proxy.)r}   )r   r   r   r   Úget_proxy_sockname¢  s    zsocksocket.get_proxy_socknamec             C   s   |   ¡ S )z>
        Returns the IP and port number of the proxy.
        )Úgetpeername)r   r   r   r   r‰   ¨  s    zsocksocket.get_proxy_peernamec             C   s   | j S )zwReturns the IP address and port number of the destination machine.

        Note: get_proxy_peername returns the proxy.)r~   )r   r   r   r   Úget_peername°  s    zsocksocket.get_peernamec             G   s   d}|   | ||¡\| _| _dS )z7Negotiates a stream connection through a SOCKS5 server.ó   N)r   r~   r}   )r   Ú	dest_addrZCONNECTr   r   r   Ú_negotiate_SOCKS5¸  s    zsocksocket._negotiate_SOCKS5c                s  | j \}}}}}}	| d¡}
| dd¡}zÂ|r@|	r@|
 d¡ n
|
 d¡ |
 ¡  |  |d¡}|dd… dkrvtd	ƒ‚|dd… d
kr|r|	s˜tdƒ‚|
 dtt|ƒƒ 	¡  | tt|	ƒƒ 	¡  |	 ¡ |
 ¡  |  |d¡}|dd… dkrötd	ƒ‚|dd… dkrHtdƒ‚n6|dd… dkrH|dd… dkr@tdƒ‚ntd	ƒ‚|
 d| d ¡ |  
||
¡}|
 ¡  |  |d¡}|dd… dkr”td	ƒ‚t|dd… ƒ}|dkrÊt |d¡}td ||¡ƒ‚|  |¡}tt| ƒ | j¡ ||fS | ¡  |
 ¡  X dS )z‘
        Send SOCKS5 request with given command (CMD field) and
        address (DST field). Returns resolved DST address that was used.
        ÚwbÚrbr   s    s    r   r   ó   z%SOCKS5 proxy server sent invalid dataó   zPNo username/password supplied. Server requested username/password authenticationrª   r–   zSOCKS5 authentication failedó   ÿz7All offered SOCKS5 authentication methods were rejectedr
   zUnknown errorz{:#04x}: {}N)r|   Úmakefiler—   Úflushrˆ   r(   r*   Úchrr‚   r6   r˜   r¡   ÚSOCKS5_ERRORSÚgetr+   r!   r£   rz   r7   rP   r   rU   )r   ÚconnÚcmdr’   r9   r:   r;   r<   r=   r>   ÚwriterÚreaderZchosen_authZauth_statusÚresolvedÚrespÚstatusrT   Zbnd)r   r   r   r   ¾  s\    

.


zsocksocket._SOCKS5_requestc          	   C   sH  |\}}| j \}}}}}}	tjdtjdi}
xrtjtjfD ]b}yDt ||¡}| |
| | ¡ t ||¡}| t d|¡¡ ||fS  tj	k
r˜   w8Y q8X q8W |rÌ| 
d¡}| dtt|ƒƒ 
¡  | ¡ nbt ||tjtjtjtj¡}|d }|d }|d d }t ||¡}| |
| | ¡ t ||¡}| t d|¡¡ ||fS )z~
        Return the host and port packed for the SOCKS5 protocol,
        and the resolved address as a tuple object.
        rª   ó   z>HÚidnar   r   r1   )r|   rD   ÚAF_INETÚAF_INET6Ú	inet_ptonr—   Ú	inet_ntopÚstructÚpackrT   r6   r´   r‚   rJ   Ú	AF_UNSPECrK   ÚIPPROTO_TCPÚAI_ADDRCONFIG)r   r:   r„   r“   r;   r9   r‘   r<   r=   r>   Zfamily_to_byter^   Ú
addr_bytesZ
host_bytesÚ	addressesZtarget_addrr   r   r   r˜      s6    
 z socksocket._write_SOCKS5_addressc             C   s–   |   |d¡}|dkr(t |   |d¡¡}nN|dkrN|   |d¡}|   |t|ƒ¡}n(|dkrnt tj|   |d¡¡}ntdƒ‚t d|   |d	¡¡d
 }||fS )Nr   rª   r1   r   r¾   é   z%SOCKS5 proxy server sent invalid dataz>Hr   r   )	rˆ   rD   Ú	inet_ntoar¡   rÃ   rÁ   r(   rÄ   Úunpack)r   r„   Zatypr:   Úlengthr;   r   r   r   r£   M  s    zsocksocket._read_SOCKS5_addressc             C   sŽ  | j \}}}}}}|  d¡}	|  dd¡}
zLd}yt |¡}W n4 tjk
rr   |r^d}d}nt t |¡¡}Y nX |	 t ddd	|¡¡ |	 |¡ |r¢|	 |¡ |	 d
¡ |rÄ|	 | 	d¡d
 ¡ |	 
¡  |  |
d¡}|dd	… d
krðtdƒ‚t|d	d… ƒ}|dkr&t |d¡}td ||¡ƒ‚t |dd… ¡t d|dd… ¡d f| _|rjt |¡|f| _n
||f| _W d|
 ¡  |	 ¡  X dS )z0Negotiates a connection through a SOCKS4 server.r­   r®   r   Fs      Tz>BBHr1   r   r–   r¿   r5   z%SOCKS4 proxy server sent invalid datar   éZ   zUnknown errorz{:#04x}: {}Nz>H)r|   r²   rD   Ú	inet_atonrT   Úgethostbynamer—   rÄ   rÅ   r6   r³   rˆ   r(   r¡   ÚSOCKS4_ERRORSr¶   r,   r!   rÌ   rÍ   r}   r~   rU   )r   r«   Ú	dest_portr9   r:   r;   r<   r=   r>   r¹   rº   Zremote_resolverÉ   r¼   r½   rT   r   r   r   Ú_negotiate_SOCKS4\  sH    




zsocksocket._negotiate_SOCKS4c             C   sj  | j \}}}}}}|r|nt |¡}d| d¡ d t|ƒ ¡  d d| d¡ g}	|rv|rv|	 dt|d | ƒ ¡ |	 d¡ |  d |	¡¡ |  	¡ }
|
 
¡ }|
 ¡  |s´tdƒ‚y| d	d
¡\}}}W n tk
ræ   tdƒ‚Y nX | d¡sútdƒ‚yt|ƒ}W n tk
r$   tdƒ‚Y nX |dkrVd ||¡}|dkrN|d7 }t|ƒ‚d| _||f| _dS )zwNegotiates a connection through an HTTP server.

        NOTE: This currently only supports HTTP CONNECT-style proxies.s   CONNECT r¿   ó   :s	    HTTP/1.1s   Host: s   Proxy-Authorization: basic s   
zConnection closed unexpectedlyú r   z'HTTP proxy server sent invalid responsezHTTP/z0Proxy server does not appear to be an HTTP proxyz4HTTP proxy server did not return a valid HTTP statuséÈ   z{}: {})i  i“  i•  za
[*] Note: The HTTP proxy server may not be supported by PySocks (must be a CONNECT tunnel proxy))s   0.0.0.0r   N)r|   rD   rÑ   r6   ÚstrÚappendr   ÚsendallÚjoinr²   ÚreadlinerU   r(   Úsplitry   rH   rN   r-   r!   r}   r~   )r   r«   rÓ   r9   r:   r;   r<   r=   r>   Zhttp_headersZfobjZstatus_liner`   Ústatus_codeZ
status_msgrT   r   r   r   Ú_negotiate_HTTP˜  sB     



zsocksocket._negotiate_HTTPc          
      s$  t |ƒdks|d  d¡r,t dt|ƒ ¡‚|\}}| jtjkr|| jsP|  d¡ t 	|¡}|dkrn|snd| _
n
||f| _
dS | j\}}}}}	}
t|ttfƒr¶t |ƒdks¶|r¶t|tƒs¾tdƒ‚tt| ƒ | j¡ |dkr
|| _
tt| ƒ | j¡ tt| ƒ ||f¡ dS |  ¡ }ytt| ƒ |¡ W nz tjk
r  } zX|  ¡  |sŒ|\}}d	 ||¡}t| }d
 ||¡}t d||¡ t||ƒ‚n|‚W dd}~X Y n€X y| j| }|| ||ƒ W nb tjk
r  } z"|sì|  ¡  td|ƒ‚n|‚W dd}~X Y n  tk
r   |  ¡  ‚ Y nX dS )zã
        Connects to the specified destination through a proxy.
        Uses the same API as socket's connect().
        To select the proxy server, use set_proxy().

        dest_pair - 2-tuple of (IP/hostname, port).
        r   r   rG   z PySocks doesn't support IPv6: %s)r”   r   z0.0.0.0Nz0Invalid destination-connection (host, port) pairz{}:{}zError connecting to {} proxy {}z%s due to: %szSocket error)r‚   rH   rD   rT   rØ   r€   rx   r{   rR   rÑ   r~   r|   rM   rp   ÚtuplerN   r(   rz   r7   rP   r   rS   r   rU   r!   ÚPRINTABLE_PROXY_TYPESÚlogÚdebugr)   Ú_proxy_negotiatorsr   )r   rV   Úcatch_errorsr«   rÓ   r9   rY   rZ   r<   r=   r>   rT   Zproxy_serverZprintable_typer   Z	negotiate)r   r   r   rS   Ù  sd    	





zsocksocket.connectc          
   C   sH   y| j |dd dS  tk
rB } z|jr0|jS ‚ W dd}~X Y nX dS )a&   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).
        T)rå   r   N)rS   ÚOSErrorÚerrno)r   rV   r   r   r   r   Ú
connect_ex6  s    zsocksocket.connect_exc             C   s4   | j \}}}}}}|pt |¡}|s,tdƒ‚||fS )zD
        Return proxy address to connect to as tuple object
        zInvalid proxy type)r|   ÚDEFAULT_PORTSr¶   r(   )r   r9   rY   rZ   r<   r=   r>   r   r   r   r   F  s
    zsocksocket._proxy_addr)NNNTNN)r   )r   )N)*r$   r%   r&   r'   r8   rD   rÀ   rK   r"   rˆ   rP   r   r   rQ   r‹   rR   rt   ru   rv   rw   rU   r§   Zgetproxysocknamer‰   Zgetproxypeernamer©   r¨   r¬   r   r˜   r£   rÔ   rß   r   r   r   rä   r   rS   rè   r   Ú__classcell__r   r   )r   r   r7   ñ   sH   	 
%b-<<\r7   )NNNTNN)	NNNNNTNNN)DÚbase64r   Úcollections.abcr   ÚImportErrorÚcollectionsrç   r   r   r   r   Úior   ÚloggingÚosr   rD   rÄ   ÚsysÚ__version__ro   Úversion_infoZwin_inet_ptonÚ	getLoggerr$   râ   ZPROXY_TYPE_SOCKS4r   ZPROXY_TYPE_SOCKS5r   ZPROXY_TYPE_HTTPr   ZPROXY_TYPESrh   ÚzipÚvaluesÚkeysrá   Z
_orgsocketrg   r   ÚIOErrorr   r(   r)   r*   r+   r,   r-   rÒ   rµ   ré   r?   rB   rC   ZgetdefaultproxyrF   Z
wrapmodulere   rf   rs   rk   ÚmethodrM   rj   rÙ   Úsetattrr7   r   r   r   r   Ú<module>   s†   

 

    
8
