403Webshell
Server IP : 104.21.64.206  /  Your IP : 216.73.216.114
Web Server : LiteSpeed
System : Linux premium234.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : pawazvgw ( 969)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/hc_python/lib64/python3.12/site-packages/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/hc_python/lib64/python3.12/site-packages/__pycache__/socks.cpython-312.pyc
�

���gny�	��ddlmZ	ddlmZddlmZmZm	Z	ddl
Z
ddlmZddl
Z
ddlZddlmZddlZddlZddlZdZej(dk(rej*d	kr	ddlZe
j.e�ZdxZZdxZZd
xZZeeed�Z e!e"e jG�e jI���Z%ej xZ&Z'd�Z(Gd�de)�Z*Gd�de*�Z+Gd�de*�Z,Gd�de*�Z-Gd�de*�Z.Gd�de*�Z/Gd�de*�Z0ddd d!�Z1d"d#d$d%d&d'd(d)d*�Z2ed+ed+ed,iZ3		d8d-�Z4d.�Z5d/�Z6e6Z7d0�Z8e8Z9					d9d1�Z:Gd2�d3ej �Z;d4�Z<d5D]AZe=e;ed�Z>e?e>e�r�e;j�j�e�eBe;ee<e���CGd6�d7e;�ZCy#e$r
ddlmZY���wxYw#e$r	ed
��wxYw):�)�	b64encode)�Callable)�
EOPNOTSUPP�EINVAL�EAGAINN)�BytesIO)�SEEK_CURz1.7.1�nt)�rz8To run PySocks on Windows you must install win_inet_pton��r)�SOCKS4�SOCKS5�HTTPc�B��tj���fd��}|S)Nc���|d}	|j�}|dk(r|jd��|i|��|dk(r|jd�SS#t$r}�d}~wwxYw#dk(r|jd�wwxYw)NrTF)�
gettimeout�setblocking�	Exception)�args�kwargs�self�_is_blocking�e�functions     ��4/opt/hc_python/lib/python3.12/site-packages/socks.py�wrapperz"set_self_blocking.<locals>.wrapper(s�����A�w��
	(��?�?�,�L��q� �� � ��&��T�,�V�,�
�q� �� � ��'�!��	�	���	���q� �� � ��'�!�s#�-A
�
	A�A�A�A�A8)�	functools�wraps)rrs` r�set_self_blockingr &s%����_�_�X��(��(��N�c��eZdZdZdd�Zd�Zy)�
ProxyErrorz4Socket_err contains original socket.error exception.Nc�n�||_||_|r%|xjdj|�z
c_yy)Nz: {})�msg�
socket_err�format)rr%r&s   r�__init__zProxyError.__init__;s/�����$�����H�H��
�
�j�1�1�H�r!c��|jS�N)r%�rs r�__str__zProxyError.__str__Bs���x�x�r!r*)�__name__�
__module__�__qualname__�__doc__r(r,�r!rr#r#9s��>�2�r!r#c��eZdZy)�GeneralProxyErrorN�r-r.r/r1r!rr3r3F���r!r3c��eZdZy)�ProxyConnectionErrorNr4r1r!rr7r7Jr5r!r7c��eZdZy)�SOCKS5AuthErrorNr4r1r!rr9r9Nr5r!r9c��eZdZy)�SOCKS5ErrorNr4r1r!rr;r;Rr5r!r;c��eZdZy)�SOCKS4ErrorNr4r1r!rr=r=Vr5r!r=c��eZdZy)�	HTTPErrorNr4r1r!rr?r?Zr5r!r?zRequest 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)�[�\�]zGeneral SOCKS server failurez!Connection not allowed by rulesetzNetwork unreachablezHost unreachablezConnection refusedzTTL expiredz(Command not supported, or protocol errorzAddress type not supported)rr
r�����i8i�c��|||||r|j�nd|r|j�ft_ydft_y)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�passwords      r�set_default_proxyrRss@��!+�D�$��5=���� 1�4�5=���� 1� I�J��CG� I�J�r!c�H�d|vr|jd�|d<t|i|��S�N�	proxytyperL)�poprR)rrs  r�setdefaultproxyrW~s-���f��%�z�z�+�6��|���d�-�f�-�-r!c�"�tjS)z4Returns the default proxy, set by set_default_proxy.)rJrKr1r!r�get_default_proxyrY�s���#�#�#r!c�d�tjrt|j_ytd��)aAttempts 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.zNo default proxy specifiedN)rJrK�socketr3)�modules r�wrap_moduler]�s%�����)��
�
��� <�=�=r!c
	���|\}
}|
jd�r|
jd�}
|r"|jd�r|jd�}d}tj||dtj�D]�}
|
\}}}}}d}	t|||�}|	r|	D]}|j|��t|ttf�r|j|�|r|j||||||�|r|j|�|j|
|f�|cS|r|�tjd��#tjtf$r }|}|r|j!�d}Yd}~��d}~wwxYw)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[]Nrzgai returned empty list.)�
startswith�stripr[�getaddrinfo�SOCK_STREAMrJ�
setsockopt�
isinstance�int�float�
settimeout�	set_proxy�bind�connect�errorr#�close)�	dest_pair�timeout�source_addressrL�
proxy_addr�
proxy_port�
proxy_rdns�proxy_username�proxy_password�socket_options�remote_host�remote_port�err�r�family�socket_type�proto�	canonname�sa�sock�optrs                      r�create_connectionr��sa��$ )��K�����c�"�!�'�'��-���j�+�+�C�0��%�%�d�+�
�
�C��
�
�
�J��6�;M�;M�
N��45�1���U�I�r���	��f�k�5�9�D��)�C�#�D�O�O�S�)�*��'�C��<�0�����(�����z�:�z�:�-�~�?���	�	�.�)��L�L�+�{�3�4��K�)O�8��	�
�,�,�1�
2�2�����j�)�	��C���
�
������		�s�BD*�*E#�E�E#c�$�eZdZdZd�Ze�Zy)�_BaseSocketzBAllows Python 2 delegated methods such as send() to be overridden.c��tj|g|��i|��t�|_|jD]'}t||�|j|<t
||��)yr*)�_orig_socketr(�dict�
_savedmethods�
_savenames�getattr�delattr�r�pos�kw�names    rr(z_BaseSocket.__init__�sS�����d�/�S�/�B�/�!�V����O�O�D�'.�t�T�':�D���t�$��D�$��$r!N)r-r.r/r0r(�listr�r1r!rr�r��s��L� ���Jr!r�c����fd�S)Nc�.��|j�|i|��Sr*)r�r�s   �r�<lambda>z_makemethod.<locals>.<lambda>�s���$<�D�$6�$6�t�$<�c�$H�R�$Hr!r1)r�s`r�_makemethodr��s	���H�Hr!)�sendto�send�recvfrom�recvc�B��eZdZdZdZejejdf�fd�	Zd�Z	�fd�Z
d�Zd�Z		dd	�Z
d
�Z�fd�Z�fd�Zd�fd
�	Zd�fd�	Zd�Z�fd�Zd�ZeZd�ZeZd�ZeZd�Z�fd�Zd�Zd�Zd�Zd�Z e!ee"ee#e iZ$e%d�fd�	�Z&e%d��Z'd�Z(�xZ)S) rJa2socksocket([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.
    Nrc�6��|tjtjfvrd}t|j	|���tt|�|||g|��i|��d|_|jr|j|_
nd|_
d|_d|_d|_
y)Nz0Socket type must be stream or datagram, not {!r})NNNNNN)r[rc�
SOCK_DGRAM�
ValueErrorr'�superrJr(�
_proxyconnrK�proxy�proxy_sockname�proxy_peername�_timeout)rr{�typer}rrr%�	__class__s       �rr(zsocksocket.__init__�s������*�*�F�,=�,=�>�>�D�C��S�Z�Z��-�.�.�
�j�$�(���u�N�t�N�v�N��������+�+�D�J�=�D�J�"���"�����
r!c��d}t|�|kr>|j|t|�z
�}|std��||z
}t|�|kr�>|S)z�Receive EXACTLY the number of bytes requested from the file object.

        Blocks until the required number of bytes have been received.r!�Connection closed unexpectedly)�len�readr3)r�file�count�data�ds     r�_readallzsocksocket._readallsY�����$�i�%���	�	�%�#�d�)�+�,�A��'�(H�I�I��A�I�D�	�$�i�%��
�r!c���||_	|j�}tt|�|j�y#t
j$rYywxYwr*)r��get_proxy_peernamer�rJrhr[rl)rro�peerr�s   �rrhzsocksocket.settimeoutsF�����
�	��*�*�,�D��*�d�.�t�}�}�=���|�|�	��	�s�-8�A�
Ac��|jSr*)r�r+s rrzsocksocket.gettimeout#s���}�}�r!c�N�|r|jd�y|jd�y)Ng)rh)r�vs  rrzsocksocket.setblocking&s����O�O�D�!��O�O�C� r!c�t�|||||r|j�nd|r|j�f|_ydf|_y)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)rIr�)rrLrMrNrOrPrQs       rrizsocksocket.set_proxy,s<��"!�$��d�+3�h�o�o�'��+3�h�o�o�'�?��
�9=�?��
r!c�V�d|vr|jd�|d<|j|i|��SrT)rVri)rrrs   r�setproxyzsocksocket.setproxyAs3���&� �#)�:�:�k�#:�F�<� ��t�~�~�t�.�v�.�.r!c����|j\}}}}}}|r|jtjk7rt	j
|g|��i|��S|jrtjtd��|tk7rd}	tjt|	��tt|�|i|��|j�\}
}d|f}t	�|_|j�}
|jj|
�d}|j!|j||�\}
}|
\}}
|\}
}tt|�?||f�tt|�G|j$�d|_y)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�)�0.0.0.0rN)r�r�r[r�r�rjr�rlrrrr�rJ�getsockname�_proxy_addrrk�_SOCKS5_requestrhr�r�)rr�r�rLrqrrrOrPrQr%�_rN�dstr��
UDP_ASSOCIATE�relay�hostr�s                 �rrjzsocksocket.bindFsA���
�Z�Z�	��Z��T�8�	��T�Y�Y�&�*;�*;�;��$�$�T�6�C�6�2�6�6��?�?��,�,�v�'K�L�L����;�C��,�,�z�3�/�/�
�j�$�$�c�0�R�0�
�"�"�$���4��D�k��&�.���� � �"��������&��
��'�'������L���5����a����4�
�j�$�'��t��5�
�j�$�*�4�=�=�9�,��r!c���|jtjk7rtt|�|g|��i|��S|js|jd�|d}|dd}t�}d}|j|�d}|j|�|j||�tt|�.|j�|zg|��i|��}	|	|j�z
S)N��r���s�)r�r[r�r�rJr�r�rjr�write�_write_SOCKS5_addressr��getvalue�tell)r�bytesrr�address�flags�header�RSV�
STANDALONE�sentr�s          �rr�zsocksocket.sendtoks�����9�9��)�)�)���T�1�%�I�$�I�&�I�I�����I�I�g���r�(���S�b�	����������S���
����Z� ��"�"�7�F�3��Z��+�F�O�O�,=��,E�6��6�.4�6���f�k�k�m�#�#r!c���|jtjk(r|j|||jfi|��Stt|�||fi|��Sr*)r�r[r�r�r�r�rJr�)rr�r�rr�s    �rr�zsocksocket.sendsN����9�9��)�)�)��4�;�;�u�e�T�-@�-@�K�F�K�K���T�/��u�G��G�Gr!c�,��|jtjk7rtt|�||�S|js|jd�ttt|�'|dz|��}|jdt�|jd�}t|�rtd��|j|�\}}|j r4|j \}}||k7s|d|fvrtj"t$d��|j|�||ffS)Nr�ir
rzReceived UDP packet fragmentrzPacket filtered)r�r[r�r�rJr�r�rjrr��seekr	r��ord�NotImplementedError�_read_SOCKS5_addressr�rlr)
r�bufsizer��buf�frag�fromhost�fromport�peerhost�peerportr�s
         �rr�zsocksocket.recvfrom�s�����9�9��)�)�)���T�3�G�U�C�C�����I�I�g���e�J��2�7�T�>�5�I�J������H���x�x��{���t�9�%�&D�E�E�!�6�6�s�;���(����!%�!4�!4��H�h��8�#�x��8�}�'D��l�l�6�+<�=�=�����!�H�h�#7�8�8r!c�0�|j|i|��\}}|Sr*)r�)rr�r�r�r�s     rr�zsocksocket.recv�s �� �4�=�=�#�,��,���q��r!c�t��|jr|jj�tt|��Sr*)r�rmr�rJ)rr�s �rrmzsocksocket.close�s*����?�?��O�O�!�!�#��Z��,�.�.r!c��|jS)z:Returns the bound IP address and port number at the proxy.)r�r+s r�get_proxy_socknamezsocksocket.get_proxy_sockname�s���"�"�"r!c�"�|j�S)z>
        Returns the IP and port number of the proxy.
        )�getpeernamer+s rr�zsocksocket.get_proxy_peername�s�����!�!r!c��|jS)zwReturns the IP address and port number of the destination machine.

        Note: get_proxy_peername returns the proxy.)r�r+s r�get_peernamezsocksocket.get_peername�s���"�"�"r!c�H�d}|j|||�\|_|_y)z7Negotiates a stream connection through a SOCKS5 server.�N)r�r�r�)r�	dest_addr�CONNECTs   r�_negotiate_SOCKS5zsocksocket._negotiate_SOCKS5�s)����37�3G�3G��'�9�4&�0���T�0r!c� ��|j\}}}}}}	|jd�}
|jdd�}	|r|	r|
jd�n|
jd�|
j�|j	|d�}|dddk7rtd	��|ddd
k(r�|r|	st
d��|
jdtt|��j�z|ztt|	��j�z|	z�|
j�|j	|d�}
|
dddk7rtd	��|
ddd
k7r1t
d��|ddd
k7r|dddk(rt
d��td	��|
jd|zd
z�|j||
�}|
j�|j	|d�}|dddk7rtd	��t|dd�}|dk7r1tj|d�}tdj||���|j!|�}t"t$|�O|j(�||f|j+�|
j+�S#|j+�|
j+�wxYw)z�
        Send SOCKS5 request with given command (CMD field) and
        address (DST field). Returns resolved DST address that was used.
        �wb�rbrssr
r��%SOCKS5 proxy server sent invalid data�zPNo username/password supplied. Server requested username/password authenticationr�r�zSOCKS5 authentication failed��z7All offered SOCKS5 authentication methods were rejectedr�
Unknown error�{:#04x}: {})r��makefiler��flushr�r3r9�chrr�rIr�r��
SOCKS5_ERRORS�getr;r'r�r�rJrhr�rm)r�conn�cmdr�rLrMrNrOrPrQ�writer�reader�chosen_auth�auth_status�resolved�resp�statusrl�bndr�s                   �rr�zsocksocket._SOCKS5_request�s����
<@�:�:�8�
�D�$��h�����t�$�����t�Q�'��W	��H����0�1����_�-�
�L�L�N��-�-���2�K��1�Q��7�*�(�;�=�=�
�1�Q��7�*�!�X�*�+<�=�=����W�s�3�x�=�'9�'@�'@�'B�B�'�(�"�3�x�=�1�8�8�:�;� (�(�)�����"�m�m�F�A�6���q��#�w�.�+�?�A�A��q��#�w�.�)�*H�I�I�
�Q�q�!�W�,��q��#�w�.�)�$�%�%�,�?�A�A�
�L�L��3���0�1��1�1�#�v�>�H��L�L�N��=�=���+�D��A�a�y�G�#�'�;�=�=���a���^�F���~�%�)�)�&�/�B��!�-�"6�"6�v�u�"E�F�F��+�+�F�3�C��*�d�.�t�}�}�=��c�?��L�L�N��L�L�N��
�L�L�N��L�L�N�s�HI+�+"J
c��|\}}|j\}}}}}}	tjdtjdi}
tjtjfD]p}	tj||�}|j|
||z�tj||�}|jtjd|��||fcS|rI|jd�}
|jdtt|
��j�z|
z�n�tj||tjtjtj tj"�}|d}|d}|dd}tj||�}|j|
||z�tj||�}|jtjd|��||fS#tj$rY���wxYw)z~
        Return the host and port packed for the SOCKS5 protocol,
        and the resolved address as a tuple object.
        r���>H�idnar�rrC)r�r[�AF_INET�AF_INET6�	inet_ptonr��	inet_ntop�struct�packrlrIr�r�rb�	AF_UNSPECrc�IPPROTO_TCP�
AI_ADDRCONFIG)rrMr�r�rNrLr�rOrPrQ�family_to_byter{�
addr_bytes�
host_bytes�	addresses�target_addrs                rr�z socksocket._write_SOCKS5_address s���
�
��d�59�Z�Z�2�
�A�q�$��(� �.�.�'�6�?�?�G�L��
�~�~�v���7�F�
�#�-�-�f�d�;�
��
�
�>�&�1�J�>�?��'�'��
�;���
�
�6�;�;�t�T�2�3��T�z�!�
8�����V�,�J��J�J�w��S��_�!5�!<�!<�!>�>��K�L��*�*�4��v�7G�7G�+1�+=�+=�+1�+=�+=�+1�+?�+?�A�I�$�A�,�K� ��^�F��q�>�!�$�D��)�)�&�$�7�J��J�J�~�f�-�
�:�;��#�#�F�J�7�D��
�
�6�;�;�t�T�*�+��T�z���1�<�<�
��
�s�A+G)�)H�?Hc���|j|d�}|dk(r&tj|j|d��}nx|dk(r.|j|d�}|j|t|��}nE|dk(r5tjtj
|j|d��}nt
d��tjd|j|d	��d
}||fS)Nrr�rCr�r�r�rr
r)	r�r[�	inet_ntoar�rr
r3r
�unpack)rr��atyprM�lengthrNs      rr�zsocksocket._read_SOCKS5_addressMs����}�}�T�1�%���7�?��#�#�D�M�M�$��$:�;�D�
�W�_��]�]�4��+�F��=�=��s�6�{�3�D�
�W�_��#�#�F�O�O�T�]�]�4��5L�M�D�#�$K�L�L��}�}�T�4�=�=��q�#9�:�1�=���T�z�r!c�t�|j\}}}}}}|jd�}	|jdd�}
	d}	tj|�}|	j
tjddd	|��|	j
|�|r|	j
|�|	j
d
�|r#|	j
|jd�d
z�|	j�|j|
d�}
|
dd	d
k7rtd
��t|
d	d�}|dk7r1tj|d�}t!dj#||���tj$|
dd�tj&d|
dd�df|_|rtj$|�|f|_n	||f|_|
j-�|	j-�y#tj$r3|rd}d}n(tjtj
|��}Y���wxYw#|
j-�|	j-�wxYw)z0Negotiates a connection through a SOCKS4 server.r�r�rFsTz>BBHrCrr�rrGz%SOCKS4 proxy server sent invalid datar
�Zr�r�Nr)r�r�r[�	inet_atonrl�
gethostbynamer�r
rrIr�r�r3r��
SOCKS4_ERRORSr�r=r'rrr�r�rm)rr��	dest_portrLrMrNrOrPrQr�r��remote_resolverrrrls                r�_negotiate_SOCKS4zsocksocket._negotiate_SOCKS4\s��;?�:�:�8�
�D�$��h�����t�$�����t�Q�'��4	�"�N�	
9�#�-�-�i�8�
�
�L�L����V�T�4��C�D��L�L��$�����X�&��L�L��!�
����Y�-�-�f�5��?�@��L�L�N��=�=���+�D��A�a�y�G�#�'�;�=�=���a���^�F���~�%�)�)�&�/�B��!�-�"6�"6�v�u�"E�F�F�$*�#3�#3�D���H�#=�#)�=�=��t�A�a�y�#A�!�#D�#F�D���&,�&6�&6�z�&B�I�&M��#�&/��&:��#��L�L�N��L�L�N��_�<�<�
9��!4�J�%)�N�!'�!1�!1��,�,�Y�7�"9�J��

9��\
�L�L�N��L�L�N�s0�H�G�EH�AH�H�H�H�"H7c�j�|j\}}}}}}|r|ntj|�}d|jd�zdzt	|�j�zdzd|jd�zg}	|r%|r#|	jdt
|dz|z�z�|	jd�|jdj|	��|j�}
|
j�}|
j�|std��	|jd	d
�\}}
}|jd�std
��	t!|
�}
|
dk7r&dj%|
|�}|
dvr|dz
}t#|��d|_||f|_y#t$rtd��wxYw#t$rt#d��wxYw)zwNegotiates a connection through an HTTP server.

        NOTE: This currently only supports HTTP CONNECT-style proxies.sCONNECT r�:s	 HTTP/1.1sHost: sProxy-Authorization: basic s
r�� r
z'HTTP proxy server sent invalid responsezHTTP/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))s0.0.0.0rN)r�r[r rI�str�appendr�sendall�joinr��readlinermr3�splitr�r`rfr?r'r�r�)rr�r"rLrMrNrOrPrQ�http_headers�fobj�status_liner}�status_code�
status_msgrls                r�_negotiate_HTTPzsocksocket._negotiate_HTTP�s���<@�:�:�8�
�D�$��h��!�y�f�&:�&:�9�&E���4�;�;�v�.�
.��
5��9�~�$�$�&�'�)5�6��	�(�(��0�0�
������� >�"+�H�t�O�h�,F�"G�!H�
I�	���G�$����W�\�\�,�/�0��}�}����m�m�o���
�
���#�$D�E�E�	O�-8�->�->�s�A�-F�*�E�;�
�����(�#�B�D�
D�	H��k�*�K�
�#���O�O�K��<�E��o�-��$�%���E�"�"�-���"�I�o����1�	O�#�$M�N�N�	O���	H��F�H�
H�	H�s�F�>F�F�F2c����t|�dk7s|djd�r!tjdt	|�z��|\}}|j
tjk(rK|js|jd�tj|�}|dk(r
|sd|_
y||f|_
y|j\}}}}}	}
t|ttf�r t|�dk7s|rt|t�st!d��t"t$|�O|j(�|�:||_
t"t$|�O|j(�t"t$|�W||f�y|j-�}	t"t$|�W|�	|j.|}||||�y#tj$r%}|s|j1�t!d	|��|�d}~wt2$r|j1��wxYw#tj$rn}|j1�|sU|\}}d
j5||�}
t6|}dj5||
�}t8j;d||�t=||��|�d}~wwxYw)
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
rr_z PySocks doesn't support IPv6: %sr�r�Nz0Invalid destination-connection (host, port) pairzSocket errorz{}:{}zError connecting to {} proxy {}z
%s due to: %s)r�r`r[rlr)r�r�r�rjr r�r�rer��tuplerfr3r�rJrhr�rkr��_proxy_negotiatorsrmr#r'�PRINTABLE_PROXY_TYPES�log�debugr7)rrn�catch_errorsr�r"rLrqrrrOrPrQ�	negotiaterl�proxy_server�printable_typer%r�s                �rrkzsocksocket.connect�sY����y�>�Q��)�A�,�"9�"9�#�">��,�,�A�!$�Y�� 0�1�
1� )��	�9��9�9��)�)�)��?�?��	�	�'�"��,�,�Y�7�I��I�%�i�&*��#�
�(1�)�&<��#���Z�Z�	��Z��T�8�	��9�t�U�m�4��y�>�Q�&� �!�)�S�1�#�B�D�
D�
	�j�$�*�4�=�=�9���"+�D���*�d�.�t�}�}�=��*�d�+�Y�	�,B�C���%�%�'�
�#	��*�d�+�J�7�&
� �3�3�J�?�	��$�	�9�5���<�<�
 �#��J�J�L�+�N�E�B�B��K���
��
�
���
��9�|�|�
	��J�J�L��)3�&�
�J�&�~�~�j�*�E��!6�z�!B��7�>�>�~�DP�R���	�	�/�3��6�*�3��6�6����
	�s1�0G2�F�G/�1 G�G/�2I3�A)I.�.I3c��	|j|d��y#t$r#}|jr|jcYd}~S�d}~wwxYw)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;rN)rk�OSError�errno)rrnrs   r�
connect_exzsocksocket.connect_ex6s?��
		��L�L���L�6����	��w�w��w�w����
	�s��	A�=�A�=�Ac�|�|j\}}}}}}|xstj|�}|std��||fS)zD
        Return proxy address to connect to as tuple object
        zInvalid proxy type)r��
DEFAULT_PORTSr�r3)rrLrqrrrOrPrQs       rr�zsocksocket._proxy_addrFsL��
�Z�Z�	��Z��T�8�	��@�=�#4�#4�Z�#@�
��#�$8�9�9��:�%�%r!�NNNTNN)rr*)*r-r.r/r0rKr[r	rcr(r�rhrrrir�rjr�r�r�r�rmr��getproxysocknamer��getproxypeernamer�r�r�r�r�r�r$r4rrrr7r rkrBr��
__classcell__)r�s@rrJrJ�s�����M�$�n�n�6�3E�3E���$
���!�EI�*.�?�*/�
#-�J$�(H�9�(�/�
#�*��"�*��#��K�&�`�D+�Z
�:�x9.�x"�#4�!�#4������Z��Z�x�
��
�	&r!rJrE)	NNNNNTNNN)D�base64r�collections.abcr�ImportError�collectionsrArrrr�ior�logging�osr	r[r
�sys�__version__r��version_info�
win_inet_pton�	getLoggerr-r9�PROXY_TYPE_SOCKS4r�PROXY_TYPE_SOCKS5r�PROXY_TYPE_HTTPr�PROXY_TYPESr��zip�values�keysr8�
_orgsocketr�r �IOErrorr#r3r7r9r;r=r?r!r�rDrRrWrY�getdefaultproxyr]�
wrapmoduler�r�r�r��methodrer�r*�setattrrJr1r!r�<module>rbs[���%�(�-�,����	��
�
�
����7�7�d�?�s�'�'�&�0�H��
�g����!�����F����F����$��6�4�@���S��!3�!3�!5�{�7G�7G�7I�J�K��"�M�M�)�
�\��&
��
�	�
�	�	�:�	�	�j�	�	�*�	�	�*�	�	�
�	�'��!�	�
�)�
-�
�
�
�
�
4�
&�	�
���v�t�T�4�8�
�CG�.2�I�.�$�$��	>��
�48�26�26�:>�%)�:3�z
�&�-�-�
�I�2�D�
�[�$��
-�F��f�h�'����%�%�d�+���T�;�t�#4�5�
3�^	&��^	&��[�%�$�$�%��$�H��F�H�	H�H�s�F-�F?�-F<�;F<�?G


Youez - 2016 - github.com/yon3zu
LinuXploit