403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/websockets/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/websockets/__pycache__/client.cpython-311.pyc
�

�=Xcm.��$�ddlmZddlmZmZmZmZddlmZm	Z	m
Z
mZmZddl
mZmZddlmZmZmZmZmZmZddlmZmZddlmZmZmZmZmZm Z m!Z!m"Z"dd	l#m$Z$m%Z%dd
lm&Z&m'Z'm(Z(m)Z)m*Z*m+Z+ddl,m-Z-ddl.m/Z/m0Z0dd
l1TdgZ2Gd�de��Z3dS)�)�annotations)�	Generator�List�Optional�Sequence�)�CLIENT�
CONNECTING�OPEN�
Connection�State)�Headers�MultipleValuesError)�InvalidHandshake�
InvalidHeader�InvalidHeaderValue�
InvalidStatus�InvalidUpgrade�NegotiationError)�ClientExtensionFactory�	Extension)�build_authorization_basic�build_extension�
build_host�build_subprotocol�parse_connection�parse_extension�parse_subprotocol�
parse_upgrade)�Request�Response)�ConnectionOption�ExtensionHeader�
LoggerLike�Origin�Subprotocol�UpgradeProtocol)�WebSocketURI)�
accept_key�generate_key)�*�ClientConnectionc�f��eZdZdZdddeddfd$�fd�
Zd%d�Zd&d�Zd'd�Zd(d�Z	d)d!�Z
d*�fd#�Z�xZS)+r,a�
    Sans-I/O implementation of a WebSocket client connection.

    Args:
        wsuri: URI of the WebSocket server, parsed
            with :func:`~websockets.uri.parse_uri`.
        origin: value of the ``Origin`` header. This is useful when connecting
            to a server that validates the ``Origin`` header to defend against
            Cross-Site WebSocket Hijacking attacks.
        extensions: list of supported extensions, in order in which they
            should be tried.
        subprotocols: list of supported subprotocols, in order of decreasing
            preference.
        state: initial state of the WebSocket connection.
        max_size: maximum size of incoming messages in bytes;
            :obj:`None` to disable the limit.
        logger: logger for this connection;
            defaults to ``logging.getLogger("websockets.client")``;
            see the :doc:`logging guide <../topics/logging>` for details.

    Ni�wsurir(�origin�Optional[Origin]�
extensions�*Optional[Sequence[ClientExtensionFactory]]�subprotocols�Optional[Sequence[Subprotocol]]�stater
�max_size�
Optional[int]�logger�Optional[LoggerLike]c���t���t|||���||_||_||_||_t��|_dS)N)�sider5r6r8)	�super�__init__r	r.r/�available_extensions�available_subprotocolsr*�key)	�selfr.r/r1r3r5r6r8�	__class__s	        ��3/usr/lib/python3/dist-packages/websockets/client.pyr=zClientConnection.__init__Esa���	���������		�	
�	
�	
���
����$.��!�&2��#��>�>������returnr c���t��}t|jj|jj|jj��|d<|jjrt|jj�|d<|j�
|j|d<d|d<d|d<|j	|d<d	|d
<|j
�#td�|j
D����}||d<|j�t|j��}||d
<t|jj|��S)a:
        Create a handshake request to open a connection.

        You must send the handshake request with :meth:`send_request`.

        You can modify it before sending it, for example to add HTTP headers.

        Returns:
            Request: WebSocket handshake request event to send to the server.

        �Host�
AuthorizationNr%�	websocket�UpgraderzSec-WebSocket-Key�13zSec-WebSocket-Versionc�D�g|]}|j|���f��S�)�name�get_request_params)�.0�extension_factorys  rC�
<listcomp>z,ClientConnection.connect.<locals>.<listcomp>zs=�����)�'�+�->�-Q�-Q�-S�-S�T���rD�Sec-WebSocket-Extensions�Sec-WebSocket-Protocol)rrr.�host�port�secure�	user_inforr/r@r>rr?rr �
resource_name)rA�headers�extensions_header�protocol_headers    rC�connectzClientConnection.connect[s���)�)��$��J�O�T�Z�_�d�j�.?�
�
�����:��	X�'@�$�*�BV�'W�G�O�$��;�"� $��G�H��(��	�� )����'+�x��#�$�+/��'�(��$�0� /���-1�-F����!�!��3D�G�.�/��&�2�/��0K�L�L�O�0?�G�,�-��t�z�/��9�9�9rD�responser!�Nonec�x�|jdkrt|���|j}td�|�d��D��g��}td�|D����s't
d|rd�|��nd���td�|�d��D��g��}t|��d	kr|d
�	��dks't
d|rd�|��nd���	|d}n@#t$r}td��|�d}~wt$r}tdd
��|�d}~wwxYw|t|j��krtd|���|�|��|_|�|��|_dS)z�
        Check a handshake response.

        Args:
            request: WebSocket handshake response received from the server.

        Raises:
            InvalidHandshake: if the handshake response is invalid.

        �ec�,�g|]}t|����SrM)r�rP�values  rCrRz5ClientConnection.process_response.<locals>.<listcomp>�s!��P�P�P��
�e�
$�
$�P�P�PrDrc3�FK�|]}|���dkV��dS)�upgradeN)�lowerrcs  rC�	<genexpr>z4ClientConnection.process_response.<locals>.<genexpr>�s/����F�F�%�5�;�;�=�=�I�-�F�F�F�F�F�FrD�, Nc�,�g|]}t|����SrM)rrcs  rCrRz5ClientConnection.process_response.<locals>.<listcomp>�s ��J�J�J�e�]�5�
!�
!�J�J�JrDrJrrrIzSec-WebSocket-Acceptz/more than one Sec-WebSocket-Accept header found)�status_coderrZ�sum�get_all�anyr�join�lenrg�KeyErrorrrr)r@r�process_extensionsr1�process_subprotocol�subprotocol)rAr^rZ�
connectionrf�
s_w_accept�excs       rC�process_responsez!ClientConnection.process_response�s�����3�&�&���)�)�)��"��-0�P�P�'�/�/�,�2O�2O�P�P�P�RT�.
�.
�
��F�F�:�F�F�F�F�F�	� ��z�K�d�i�i�
�3�3�3�t���
�*-�J�J�w���y�/I�/I�J�J�J�B�*
�*
���G����!�!�g�a�j�&6�&6�&8�&8�K�&G�&G� ��'�,S�D�I�I�g�,>�,>�,>�t�T�T�T�	� �!7�8�J�J���	A�	A�	A�� 6�7�7�S�@�����"�	�	�	��&�A����
�����	������D�H�-�-�-�-�$�%;�Z�H�H�H��1�1�'�:�:����3�3�G�<�<����s$�D�
E�(D8�8
E�E�ErZr�List[Extension]c�z�g}|�d��}|r�|j�td���td�|D��g��}|D]n\}}|jD]L}|j|kr�	|�||��}n#t$rY�2wxYw|�|��nt
d|�d|������o|S)a{
        Handle the Sec-WebSocket-Extensions HTTP response header.

        Check that each extension is supported, as well as its parameters.

        :rfc:`6455` leaves the rules up to the specification of each
        extension.

        To provide this level of flexibility, for each extension accepted by
        the server, we check for a match with each extension available in the
        client configuration. If no match is found, an exception is raised.

        If several variants of the same extension are accepted by the server,
        it may be configured several times, which won't make sense in general.
        Extensions must implement their own requirements. For this purpose,
        the list of previously accepted extensions is provided.

        Other requirements, for example related to mandatory extensions or the
        order of extensions, may be implemented by overriding this method.

        Args:
            headers: WebSocket handshake response headers.

        Returns:
            List[Extension]: List of accepted extensions.

        Raises:
            InvalidHandshake: to abort the handshake.

        rSNzno extensions supportedc�,�g|]}t|����SrM)r�rP�header_values  rCrRz7ClientConnection.process_extensions.<locals>.<listcomp>�s ��N�N�N�<���.�.�N�N�NrDzUnsupported extension: name = z, params = )rmr>rrlrN�process_response_paramsr�append)	rArZ�accepted_extensionsr1�parsed_extensionsrN�response_paramsrQ�	extensions	         rCrrz#ClientConnection.process_extensions�sB��>02���_�_�%?�@�@�
��%	��(�0�&�'@�A�A�A�7:�N�N�:�N�N�N�PR�8�8��*;�
�
�%��o�)-�)B���%�)�-��5�5� �!�$5�$M�$M�+�-@�%�%�	�	��,�!�!�!� ��!����(�.�.�y�9�9�9��E�
+�E�"&�E�E�3B�E�E�����#�"s�'A>�>
B�
B�Optional[Subprotocol]c�R�d}|�d��}|r�|j�td���td�|D��g��}t	|��dkr'd�|��}td|�����|d}||jvrt
d	|�����|S)
a:
        Handle the Sec-WebSocket-Protocol HTTP response header.

        If provided, check that it contains exactly one supported subprotocol.

        Args:
            headers: WebSocket handshake response headers.

        Returns:
           Optional[Subprotocol]: Subprotocol, if one was selected.

        NrTzno subprotocols supportedc�,�g|]}t|����SrM)rr|s  rCrRz8ClientConnection.process_subprotocol.<locals>.<listcomp>s!��R�R�R�\�"�<�0�0�R�R�RrDrrizmultiple subprotocols: rzunsupported subprotocol: )rmr?rrlrpror)rArZrtr3�parsed_subprotocols�subprotocols_displays      rCrsz$ClientConnection.process_subprotocols���.2�����'?�@�@���	R��*�2�&�'B�C�C�C�9<�R�R�\�R�R�R�TV�:�:���&�'�'�!�+�+�'+�y�y�1D�'E�'E�$�&�'W�AU�'W�'W�X�X�X�-�a�0�K��$�"=�=�=�&�'P�;�'P�'P�Q�Q�Q��rD�requestc�"�|jr[|j�d|j��|j���D]!\}}|j�d||���"|j�|�����dS)z�
        Send a handshake request to the server.

        Args:
            request: WebSocket handshake request event.

        z> GET %s HTTP/1.1z> %s: %sN)�debugr8�pathrZ�	raw_items�writesr�	serialize)rAr�r@rds    rC�send_requestzClientConnection.send_request,s����:�	:��K���1�7�<�@�@�@�%�o�7�7�9�9�
:�
:�
��U���!�!�*�c�5�9�9�9�9�����7�,�,�.�.�/�/�/�/�/rD�Generator[None, None, None]c#��K�|jtu�r�tj|jj|jj|jj��Ed{V��}|jr�|j	|j
}}|j�d||��|j�
��D]!\}}|j�d||���"|j�-|j�dt|j����	|�|��|jtusJ�t"|_nR#t$$rE}||_||_|���|_t/|j��Yd}~nd}~wwxYw|j�|��n#|j�|��wxYwt5�����Ed{V��dS)Nz< HTTP/1.1 %d %sz< %s: %sz< [body] (%d bytes))r5r
r!�parse�reader�	read_line�
read_exact�read_to_eofr�rk�
reason_phraser8rZr��bodyrprxrr�
_exception�
handshake_exc�discard�parser�next�eventsrr<)rAr^�code�phraser@rdrwrBs       �rCr�zClientConnection.parse;s�������:��#�#�"*�.���%���&���'�#�#�������H��z�
Q�'�3�X�5K�f����!�!�"4�d�F�C�C�C�"*�"2�"<�"<�">�">�>�>�J�C���K�%�%�j�#�u�=�=�=�=��=�,��K�%�%�&;�S���=O�=O�P�P�P�
-��%�%�h�/�/�/��z�Z�/�/�/�/�!��
�
��$�
"�
"�
"�&)��#�%(��"�"�l�l�n�n����T�[�!�!�!�!�!�!�!�!�����	
"������"�"�8�,�,�,�,����"�"�8�,�,�,�,�����7�7�=�=�?�?�"�"�"�"�"�"�"�"�"s0�.D �F
� 
E/�*;E*�%F
�*E/�/F
�
F))r.r(r/r0r1r2r3r4r5r
r6r7r8r9)rEr )r^r!rEr_)rZrrEry)rZrrEr�)r�r rEr_)rEr�)
�__name__�
__module__�__qualname__�__doc__r
r=r]rxrrrsr�r��
__classcell__)rBs@rCr,r,.s����������2$(�AE�8<�!�"'�'+�"�"�"�"�"�"�"�,*:�*:�*:�*:�X2=�2=�2=�2=�hJ#�J#�J#�J#�X#�#�#�#�J
0�
0�
0�
0�#�#�#�#�#�#�#�#�#�#rDN)4�
__future__r�typingrrrrrur	r
rrr
�datastructuresrr�
exceptionsrrrrrrr1rrrZrrrrrrrr�http11r r!r"r#r$r%r&r'�urir(�utilsr)r*�
legacy.client�__all__r,rMrDrC�<module>r�s7��"�"�"�"�"�"�6�6�6�6�6�6�6�6�6�6�6�6�C�C�C�C�C�C�C�C�C�C�C�C�C�C�8�8�8�8�8�8�8�8�����������������:�9�9�9�9�9�9�9�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�	�&�%�%�%�%�%�%�%�����������������������+�+�+�+�+�+�+�+������
��j#�j#�j#�j#�j#�z�j#�j#�j#�j#�j#rD

Youez - 2016 - github.com/yon3zu
LinuXploit