403Webshell
Server IP : 39.108.156.168  /  Your IP : 216.73.216.104
Web Server : nginx/1.24.0
System : Linux e2.ksyuki.com 6.11.0-25-generic #25~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 15 17:20:50 UTC 2 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/cockpit/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/cockpit/__pycache__/channel.cpython-312.pyc
�

��f�H��J�ddlZddlZddlZddlmZmZmZmZmZm	Z	m
Z
mZmZm
Z
ddlmZmZmZmZmZmZddlmZddlmZmZmZej6e�ZGd�de�ZGd	�d
e�ZGd�de�Z Gd
�de ejB�Z"Gd�de �Z#Gd�de �Z$y)�N)
�BinaryIO�ClassVar�Dict�	Generator�List�Optional�Sequence�Set�Tuple�Type�)�	JsonError�
JsonObject�	JsonValue�
create_object�get_bool�get_str)�CockpitProblem)�Endpoint�Router�RoutingRulec���eZdZUeeeedfed<dedeedf�fd�Z	de
eeefde
defd	�Zde
dedfd
�Zd�Z�xZS)�ChannelRoutingRule�Channel�table�router�
channel_typesc���t�|�|�i|_|D]9}|jj|jg�}|j|��;|jj
�D]}|jd�d���y)Nc�,�t|j�S�N)�len�restrictions)�clss �1/usr/lib/python3/dist-packages/cockpit/channel.py�<lambda>z-ChannelRoutingRule.__init__.<locals>.<lambda>-s��s�3�+;�+;�'<��T)�key�reverse)�super�__init__r�
setdefault�payload�append�values�sort)�selfrrr#�entry�	__class__s     �r$r*zChannelRoutingRule.__init__!s���
���� ���
�!�	�C��J�J�)�)�#�+�+�r�:�E��L�L���	��Z�Z�&�&�(�	L�E��J�J�<�d�J�K�	Lr&r"�options�returnc�V�|D]$\}}|j|�}|�y|��||k7s�$yy)NFT)�get)r0r"r3r'�expected_value�	our_values      r$�check_restrictionsz%ChannelRoutingRule.check_restrictions/sF��#/�	��C�����C�(�I�� ���)�i�>�.I��	�r&c��|j�J�|jd�}t|t�sy|jj|g�D]2}|j|j|�s� ||j�cSy)Nr,)rr6�
isinstance�strrr9r")r0r3r,r#s    r$�
apply_rulezChannelRoutingRule.apply_rule@su���{�{�&�&�&��+�+�i�(���'�3�'���:�:�>�>�'�2�.�	�C��&�&�s�'7�'7��A��4�;�;�'�'�	�r&c��yr ��r0s r$�shutdownzChannelRoutingRule.shutdownM���r&)�__name__�
__module__�__qualname__rr<rr�__annotations__rr*r	r�objectr�boolr9rr=rA�
__classcell__)r2s@r$rrs������T�$�y�/�*�*�+�+�L�v�L�d�4�	�?�6K�L��x��c�6�k�8J�/K��V`��ei��"�*���)�1D��
r&rc��eZdZy)�ChannelErrorN)rCrDrEr?r&r$rKrKQs��r&rKc�<�eZdZUdZdZdZeed<dZe	ed<eZ
e	ed<eejed<d	Zeeed
<eeed<dZeeeeefed
<dZdZd�Zdedededd	fd�Zdddddedd	fd�Zdedd	fd�Zd8d�Zd8d�Zd8d�Zdedd	fd�Z dedd	fd �Z!ded!e"dd	fd"�Z#d#e"dd	fd$�Z$d%e%dd	fd&�Z&d8d'�Z'defd(�Z(d8d)�Z)d*�Z*d9d+�Z+d9d:d-�Z,d!e"defd.�Z-d/�Z.d8d0�Z/e0jbd1�2�Z2ee0jbed3<d9d4d,d%e%defd5�Z3ded%e%dd	fd6�Z4dedd	fd7�Z5y	);ri@i F�_send_pingsr�
_out_sequence�_out_window�_tasksN�_close_argsr,r?r"�c���|dk(rbt�|_|d|_t|dd��rd|_t|dd�|_|j�|j|�y|d	k(r|j�y|d
k(r|j�y|dk(r|j�y|dk(r|j|�y|d
k(r|j|�y|dk(r|j|�yy)N�open�channelzflow-controlF)�defaultT�grouprV�ready�done�close�ping�pongr3)�setrPrUrrMrrW�freeze_endpoint�do_open�do_ready�do_done�do_close�do_ping�do_pong�
do_options)r0�command�messages   r$�
do_controlzChannel.do_controlls����f���%�D�K�"�9�-�D�L�����?�#'�� � ��'�9�=�D�J�� � �"��L�L��!�
��
��M�M�O�
��
��L�L�N�
��
��M�M�O�
��
��L�L��!�
��
��L�L��!�
�	�
!��O�O�G�$�"r&rUrfrgr4c��|j�y		|j||�y#t$r}tdt	|���|�d}~wwxYw#t$r%}|j|j�Yd}~yd}~wwxYw)Nzprotocol-error�rg)rQrhrrKr<rZ�attrs)r0rUrfrg�excs     r$�do_channel_controlzChannel.do_channel_control�sr�����'��	"�
P������1���
P�"�#3�S��X�F�C�O��
P���	"��J�J�s�y�y�!�!��	"�s,�#�	A�A�A�A�	A9�A4�4A9�hostz
str | NonerW�_messagec�h�|j�y|�y|�|j|k7ry|j�yr )rQrWrb)r0rnrWros    r$�do_killzChannel.do_kill�s7�����'����������u�!4���
�
�r&r3c��t�r ��NotImplementedError�r0r3s  r$r_zChannel.do_open����!�!r&c��yr r?r@s r$r`zChannel.do_ready�rBr&c��yr r?r@s r$razChannel.do_done�rBr&c�$�|j�yr �rZr@s r$rbzChannel.do_close�s���
�
�r&c��tdd���)Nz
not-supportedz)This channel does not implement "options"rj)rK�r0rgs  r$rezChannel.do_options�s���?�4_�`�`r&c�&�|j|�yr )�	send_pongr|s  r$rczChannel.do_ping�s�����w�r&�datac��|j�y	|j|�y#t$r%}|j|j�Yd}~yd}~wwxYwr )rQ�do_datarKrZrk)r0rUrrls    r$�do_channel_datazChannel.do_channel_data�sE�����'��	"��L�L�����	"��J�J�s�y�y�!�!��	"�s�!�	A�A
�
A�_datac�$�|j�yr rz)r0r�s  r$r�zChannel.do_data�s���
�
�r&�kwargsc�L�|j�|jdddi|��y)NrfrXr?)�
thaw_endpoint�send_control)r0r�s  r$rXz
Channel.ready�s&����������4�'�4�V�4r&c�(�|jd��y)NrY)rf)r�r@s r$rYzChannel.done�s�����&��)r&c��|jduSr )rQr@s r$�
is_closingzChannel.is_closing�s�����t�+�+r&c�:�|j|j�yr )�shutdown_endpointrQr@s r$�
_close_nowzChannel._close_now�s�����t�/�/�0r&c��|jj|�|j�|js|j�yyyr )rP�removerQr�)r0�tasks  r$�
_task_donezChannel._task_done�s:��
	
�����4� ����'�����O�O��1<�'r&c��|j�J�tj|�}|jj	|�|j|j�|S)z�Create a task associated with the channel.

        All tasks must exit before the channel can close.  You may not create
        new tasks after calling .close().
        )rQ�asyncio�create_taskrP�add�add_done_callbackr�)r0�	coroutine�namer�s    r$r�zChannel.create_task�sM�����'�'�'��"�"�9�-������������t���/��r&�JsonObject | Nonec�n�|j�y|xsi|_|js|j�yy)z�Requests the channel to be closed.

        After you call this method, you won't get anymore `.do_*()` calls.

        This will wait for any running tasks to complete before sending the
        close message.
        N)rQrPr�)r0�
close_argss  r$rZz
Channel.close�s6�����'��%�+�����{�{��O�O��r&c�J�|j|j|�|jrc|jt	|�z}|jt
jz|t
jzk7r|jd|��||_|j|jkS)a�Send data and handle book-keeping for flow control.

        The flow control is "advisory".  The data is sent immediately, even if
        it's larger than the window.  In general you should try to send packets
        which are approximately Channel.BLOCK_SIZE in size.

        Returns True if there is still room in the window, or False if you
        should stop writing for now.  In that case, `.do_resume_send()` will be
        called later when there is more room.
        r[)rf�sequence)	�send_channel_datarUrMrNr!r�
BLOCK_SIZEr�rO)r0r�out_sequences   r$�	send_datazChannel.send_data�s���	
���t�|�|�T�2�����-�-��D�	�9�L��!�!�W�%7�%7�7�<�7�K]�K]�;]�]��!�!�&�<�!�H�!-�D���!�!�D�$4�$4�4�4r&c���|js!tjd|j�y|dtj
z|_|j|jkr|j�yy)NzGot wild pong on channel %sr�)	rM�logger�warningrUr�SEND_WINDOWrOrN�do_resume_sendr|s  r$rdzChannel.do_pong
s^������N�N�8�$�,�,�G��"�:�.��1D�1D�D������� 0� 0�0����!�1r&c��y)z<Called to indicate that the channel may start sending again.Nr?r@s r$r�zChannel.do_resume_sends�r&�)�indent�json_encoder�_msgc��|jjt||��dz}|j|j��S)N�
)r��encoderr�)r0r�r��prettys    r$�	send_jsonzChannel.send_jsons9���"�"�)�)�-��f�*E�F��M���~�~�f�m�m�o�.�.r&c�B�|j|j|dfi|��yr ��send_channel_controlrU)r0rfr�s   r$r�zChannel.send_controls��!��!�!�$�,�,���H��Hr&c�>�|j|jd|�y)Nr\r�r|s  r$r~zChannel.send_pong s���!�!�$�,�,���@r&�r4Nr )r�r�r4N)6rCrDrEr�r�rMrHrFrN�intrOr
r��TaskrQrrrr<r"r	rrGrUrWrhrmrqr_r`rarbrerc�bytesr�r�rrXrYr�r�r�r�rZr�rdr��json�JSONEncoderr�r�r�r~r?r&r$rrUs
���J�!�K��K����M�3��"�K��"�
������(,�K��*�%�,��c�]��;=�L�(�8�E�#�v�+�$6�7�8�=��G��E�%�2"�#�"��"�j�"�UY�"�	�L�	��	��	�X\�	�"�z�"�d�"�
�
��a�*�a��a� �z� �d� �	"�s�	"�%�	"�D�	"��U��t��
5�i�5�D�5�*�,�D�,�1��
�
�5�e�5��5�*"�K�0@�t�/?�/?�q�/I�L�(�4�+�+�,�I�/�1�/�I�/�RV�/�I�C�I�9�I��I�A��A��Ar&rc��eZdZUdZeejed<eejed<dZ	e
ed<dZeeed<dZ
dZe
ed	<dZe
ed
<dejded
ejfd�Zded
dfd�Zd!d�Zdej&d
dfd�Zd
efd�Zdeed
dfd�Zded
dfd�Zd"d�Zd"d�Zded
dfd�Zd"d�Zd"d�Zd
e
fd�Zd�Z d"d�Z!d"d �Z"y)#�ProtocolChannela;A channel subclass that implements the asyncio Protocol interface.

    In effect, data sent to this channel will be written to the connected
    transport, and vice-versa.  Flow control is supported.

    The default implementation of the .do_open() method calls the
    .create_transport() abstract method.  This method should return a transport
    which will be used for communication on the channel.

    Otherwise, if the subclass implements .do_open() itself, it is responsible
    for setting up the connection and ensuring that .connection_made() is called.
    �
_transport�_loopT�_send_pongsN�
_last_pingF�
_close_on_eof�_eof�loopr3r4c��K�t��w)aCreates the transport for this channel, according to options.

        The event loop for the transport is passed to the function.  The
        protocol for the transport is the channel object, itself (self).

        This needs to be implemented by the subclass.
        rs)r0r�r3s   r$�create_transportz ProtocolChannel.create_transport;s����"�!���	c���tj�}tj|j||��|_|jj|j�yr )r��get_running_loopr�r��_create_transport_taskr��create_transport_done)r0r3r�s   r$r_zProtocolChannel.do_openEsL���'�'�)��&-�&9�&9�$�:O�:O�PT�V]�:^�&_��#��#�#�5�5�d�6P�6P�Qr&c��||jusJ�d|_	|j�}|j|�|j
�y#t$r%}|j|j�Yd}~yd}~wwxYwr )r��resultrKrZrk�connection_maderX)r0r��	transportrls    r$r�z%ProtocolChannel.create_transport_doneJsl���t�2�2�2�2�2�&*��#�	����
�I�
	
���Y�'��
�
����	��J�J�s�y�y�!���	�s�A�	A9�A4�4A9r�c�J�t|tj�sJ�||_yr )r;r��	Transportr�)r0r�s  r$r�zProtocolChannel.connection_madeVs���)�W�%6�%6�7�7�7�#��r&c��iSr r?r@s r$�_get_close_argszProtocolChannel._get_close_argsZs���	r&rlc�B�|j|j��yr )rZr�)r0rls  r$�connection_lostzProtocolChannel.connection_lost]s���
�
�4�'�'�)�*r&rc�V�|j�J�|jj|�yr )r��write�r0rs  r$r�zProtocolChannel.do_data`s$�����*�*�*������d�#r&c��|j�J�|jj�r|jj�yyr )r��
can_write_eof�	write_eofr@s r$razProtocolChannel.do_doneds7�����*�*�*��?�?�(�(�*��O�O�%�%�'�+r&c�R�|j�|jj�yyr )r�rZr@s r$rbzProtocolChannel.do_closeis!���?�?�&��O�O�!�!�#�'r&c�x�|j�J�|j|�s|jj�yyr )r�r��
pause_readingr�s  r$�
data_receivedzProtocolChannel.data_receivedms3�����*�*�*��~�~�d�#��O�O�)�)�+�$r&c�T�|j�J�|jj�yr )r��resume_readingr@s r$r�zProtocolChannel.do_resume_sendrs"�����*�*�*����&�&�(r&c�|�d|_|jr)|j�J�|jj�yy)a�Mark the channel to be closed on EOF.

        Normally, ProtocolChannel tries to keep the channel half-open after
        receiving EOF from the transport.  This instructs that the channel
        should be closed on EOF.

        If EOF was already received, then calling this function will close the
        channel immediately.

        If you don't call this function, you are responsible for closing the
        channel yourself.
        TN)r�r�r�rZr@s r$�close_on_eofzProtocolChannel.close_on_eofvs8��"����9�9��?�?�.�.�.��O�O�!�!�#�r&c�J�d|_|j�|jS�NT)r�rYr�r@s r$�eof_receivedzProtocolChannel.eof_received�s!����	��	�	���%�%�%�%r&c�N�|jr|j|�y||_yr )r�r~r�r|s  r$rczProtocolChannel.do_ping�s ������N�N�7�#�&�D�Or&c��d|_y)NF)r�r@s r$�
pause_writingzProtocolChannel.pause_writing�s
�� ��r&c�p�d|_|j�#|j|j�d|_yyr�)r�r�r~r@s r$�resume_writingzProtocolChannel.resume_writing�s0������?�?�&��N�N�4�?�?�+�"�D�O�'r&)r�zasyncio.Task[asyncio.Transport]r4Nr�)#rCrDrE�__doc__rr�r�rF�AbstractEventLoopr�rHr�rr�r�r�r�r_r��
BaseTransportr�r��	Exceptionr�r�r�rarbr�r�r�r�rcr�r�r?r&r$r�r�$s4�����*�*�+�+��G�-�-�.�.��K���'+�J���$�+�!�� �M�4���D�$��"�7�+D�+D�"�z�"�^e�^o�^o�"�R�z�R�d�R�

�$��)>�)>�$�4�$����+�8�I�#6�+�4�+�$�E�$�d�$�(�
$�,�%�,�D�,�
)�$�$&�d�&�&�!�#r&r�c�f�eZdZdZdZdZd�Zd�Zd�Zd�Z	de
ddfd	�Zdd
�Zd�Z
d�Zd
�Zd�Zd�Zy)�AsyncChannelaA subclass for async/await-style implementation of channels, with flow control

    This subclass provides asynchronous `read()` and `write()` calls for
    subclasses, with familiar semantics.  `write()` doesn't buffer, so the
    `done()` method on the base channel class can be used in a way similar to
    `shutdown()`.  A high-level `sendfile()` method is available to send the
    entire contents of a binary-mode file-like object.

    The subclass must provide an async `run()` function, which will be spawned
    as a task.

    On the receiving side, the channel will respond to flow control pings to
    indicate that it has received the data, but only after it has been consumed
    by `read()`.

    On the sending side, write() will block if the channel backs up.
    Nc��K�t��wr rsrus  r$�runzAsyncChannel.run�s����!�!�r�c���K�	|j|��d{���|j�y7�#t$r%}|j|j�Yd}~yd}~wwxYw�wr )r�rZrKrk)r0r3rls   r$�run_wrapperzAsyncChannel.run_wrapper�sM����	"��(�(�7�#�#�#��J�J�L�
$���	"��J�J�s�y�y�!�!��	"�s6�A!�0�.�0�A!�0�	A�A�A!�A�A!c��K�	|jj��d{���}t|t�r|S|j	|��F7�(�wr )�
receive_queuer6r;r�r~)r0�items  r$�readzAsyncChannel.read�sC������+�+�/�/�1�1�D��$��&����N�N�4� �	�1�s�A�A
�)Ac��K�|j|�s<tj�j�|_|j�d{���yy7��wr )r�r�r��
create_future�write_waiterr�s  r$r�zAsyncChannel.write�sC�����~�~�d�#� '� 8� 8� :� H� H� J�D���#�#�#�#�$�#�s�AA�
A�A�streamr4c��2K�tj�}|5	|jd|jtj
��d{���}|dk(rn|j
|��d{����S|j�ddd�y7�=7� #1swYyxYw�w�Nr&)r�r��run_in_executorr�rr�r�rY)r0r�r�rs    r$�sendfilezAsyncChannel.sendfile�s������'�'�)��
�	��!�1�1�$����W�EW�EW�X�X���3�;���j�j��&�&�&�	�
�I�I�K�	�	�X��'��	�	�s@�B�0B�	B�
B�(B	�)B�>	B�B�	B�B�Bc�b�|j�#|jjd�d|_yyr )r��
set_resultr@s r$r�zAsyncChannel.do_resume_send�s/�����(����(�(��.� $�D��)r&c��tj�|_|j|j	|�|j
j�d|�d���y)Nz
.run_wrapper(�))r�)r��Queuer�r�r�r2rCrus  r$r_zAsyncChannel.do_open�sJ��$�]�]�_�������)�)�'�2�D�N�N�<S�<S�;T�Ta�bi�aj�jk�9l��mr&c�:�|jjd�yr��r��
put_nowaitr@s r$razAsyncChannel.do_done�s�����%�%�c�*r&c�:�|jjd�yr�rr@s r$rbzAsyncChannel.do_close�s�����%�%�c�*r&c�:�|jj|�yr rr|s  r$rczAsyncChannel.do_ping�s�����%�%�g�.r&c�p�t|t�st|�}|jj|�yr )r;r�r�r	r�s  r$r�zAsyncChannel.do_data�s+���$��&���;�D����%�%�d�+r&r�)rCrDrEr�r�r�r�r�r�r�rrr�r_rarbrcr�r?r&r$r�r��s[���*�M��L�"�"�!�$�
	�X�	�$�	�%�
n�+�+�/�,r&r�c�Z�eZdZUdZeedeefZee	d<deddfd�Z
deddfd�Zd
d	�Zy)�GeneratorChannelaA trivial Channel subclass for sending data from a generator with flow control.

    Calls the .do_yield_data() generator with the options from the open message
    and sends the data which it yields.  If the generator returns a value it
    will be used for the close message.
    N�_GeneratorChannel__generatorr3r4�
DataGeneratorc��t�r rsrus  r$�
do_yield_datazGeneratorChannel.do_yield_datarvr&c�P�|j|�|_|j�yr )rrr�rus  r$r_zGeneratorChannel.do_opens!���-�-�g�6������r&c��	|jt|j��r'	|jt|j��r�&yy#t$r5}|j	�|j|j�Yd}~yd}~wwxYwr )r��nextr�
StopIterationrYrZ�value)r0�stops  r$r�zGeneratorChannel.do_resume_send	sf��	#��.�.��d�&6�&6�!7�8���.�.��d�&6�&6�!7�8���	#��I�I�K��J�J�t�z�z�"�"��	#�s�A	A�	B�+B�Br�)
rCrDrEr�rr�rrrrFrr_r�r?r&r$rr�sP����e�T�8�J�+?�?�@�M���"�Z�"�O�"��z��d��#r&r)%r�r��logging�typingrrrrrrr	r
rr�jsonutilrrrrrr�protocolrrrrr�	getLoggerrCr�rrKr�Protocolr�r�rr?r&r$�<module>rs���$���b�b�b�X�X�$�1�1�	��	�	�8�	$��0
��0
�f	�>�	�LA�h�LA�^y#�g�w�/�/�y#�xU,�7�U,�p#�w�#r&

Youez - 2016 - github.com/yon3zu
LinuXploit