%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/paramiko/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/paramiko/__pycache__/message.cpython-312.pyc

�

�ecD#��b�dZddlZddlmZddlmZmZmZmZddl	m
Z
mZmZm
Z
Gd�de�Zy)z&
Implementation of an SSH2 "message".
�N)�util)�	zero_byte�max_byte�one_byte�asbytes)�long�BytesIO�u�
integer_typesc���eZdZdZed�Zd!d�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d �Z"y)"�Messagea�
    An SSH2 message is a stream of bytes that encodes some combination of
    strings, integers, bools, and infinite-precision integers (known in Python
    as longs).  This class builds or breaks down such a byte stream.

    Normally you don't need to deal with anything this low-level, but it's
    exposed for people implementing custom extensions, or features that
    paramiko doesn't support yet.
    l~Nc�H�|�t|�|_yt�|_y)z�
        Create a new SSH2 message.

        :param str content:
            the byte stream to use as the message content (passed in only when
            decomposing a message).
        N)r	�packet)�self�contents  �2/usr/lib/python3/dist-packages/paramiko/message.py�__init__zMessage.__init__+s����!�'�*�D�K�!�)�D�K�c�"�|j�S)zX
        Return the byte stream content of this message, as a string/bytes obj.
        )r�rs r�__str__zMessage.__str__8s���|�|�~�rc�T�dt|jj��zdzS)zP
        Returns a string representation of this object, for debugging.
        zparamiko.Message(�))�reprr�getvaluers r�__repr__zMessage.__repr__>s&��#�T�$�+�+�*>�*>�*@�%A�A�C�G�Grc�6�|jj�S)zK
        Return the byte stream content of this Message, as bytes.
        )rrrs rrzMessage.asbytesDs���{�{�#�#�%�%rc�:�|jjd�y)zk
        Rewind the message to the beginning as if no items had been parsed
        out of it yet.
        rN)r�seekrs r�rewindzMessage.rewindJs��
	
������rc��|jj�}|jj�}|jj|�|S)zv
        Return the bytes (as a `str`) of this message that haven't already been
        parsed and returned.
        )r�tell�readr)r�position�	remainders   r�
get_remainderzMessage.get_remainderQs@��
�;�;�#�#�%���K�K�$�$�&�	�������"��rc��|jj�}|j�|jj|�S)z�
        Returns the `str` bytes of this message that have been parsed and
        returned. The string passed into a message's constructor can be
        regenerated by concatenating ``get_so_far`` and `get_remainder`.
        )rr"r r#)rr$s  r�
get_so_farzMessage.get_so_far[s4���;�;�#�#�%�����
��{�{����)�)rc��|jj|�}d}t|�|cxkr|krn|S|t|t|�z
zzS|S)a
        Return the next ``n`` bytes of the message (as a `str`), without
        decomposing into an int, decoded string, etc.  Just the raw bytes are
        returned. Returns a string of ``n`` zero bytes if there weren't ``n``
        bytes remaining in the message.
        i)rr#�lenr)r�n�b�max_pad_sizes    r�	get_byteszMessage.get_bytesesR��
�K�K���Q������q�6�A�$��$����y�A��A��J�/�/�/��rc�$�|jd�S)a	
        Return the next byte of the message, without decomposing it.  This
        is equivalent to `get_bytes(1) <get_bytes>`.

        :return:
            the next (`str`) byte of the message, or ``''`` if there aren't
            any bytes remaining.
        �)r.rs r�get_bytezMessage.get_byters���~�~�a� � rc�6�|jd�}|tk7S)z2
        Fetch a boolean from the stream.
        r0)r.r�rr,s  r�get_booleanzMessage.get_boolean}s��
�N�N�1����I�~�rc���|jd�}|tk(r#tj|j	��S||jd�z
}tjd|�dS)zZ
        Fetch an int from the stream.

        :return: a 32-bit unsigned `int`.
        r0��>Ir)r.rr�inflate_long�
get_binary�struct�unpack)r�bytes  r�get_adaptive_intzMessage.get_adaptive_int�s[���~�~�a� ���8���$�$�T�_�_�%6�7�7�����q�!�!���}�}�T�4�(��+�+rc�R�tjd|jd��dS)z/
        Fetch an int from the stream.
        r7�r�r:r;r.rs r�get_intzMessage.get_int�s#���}�}�T�4�>�>�!�#4�5�a�8�8rc�R�tjd|jd��dS)zk
        Fetch a 64-bit int from the stream.

        :return: a 64-bit unsigned integer (`long`).
        �>Q�rr@rs r�	get_int64zMessage.get_int64�s#���}�}�T�4�>�>�!�#4�5�a�8�8rc�H�tj|j��S)zs
        Fetch a long int (mpint) from the stream.

        :return: an arbitrary-length integer (`long`).
        )rr8r9rs r�	get_mpintzMessage.get_mpint�s��� � ����!2�3�3rc�@�|j|j��S)z�
        Fetch a `str` from the stream.  This could be a byte string and may
        contain unprintable characters.  (It's not unheard of for a string to
        contain another byte-stream message.)
        �r.rArs r�
get_stringzMessage.get_string�����~�~�d�l�l�n�-�-rc�4�t|j��S)z9
        Fetch a Unicode string from the stream.
        )r
rJrs r�get_textzMessage.get_text�s������"�#�#rc�@�|j|j��S)z�
        Fetch a string from the stream.  This could be a byte string and may
        contain unprintable characters.  (It's not unheard of for a string to
        contain another byte-stream Message.)
        rIrs rr9zMessage.get_binary�rKrc�@�|j�jd�S)z�
        Fetch a list of `strings <str>` from the stream.

        These are trivially encoded as comma-separated values in a string.
        �,)rM�splitrs r�get_listzMessage.get_list�s���}�}��$�$�S�)�)rc�<�|jj|�|S)zh
        Write bytes to the stream, without any formatting.

        :param str b: bytes to add
        �r�writer3s  r�	add_byteszMessage.add_bytes����	
�����!���rc�<�|jj|�|S)zo
        Write a single byte to the stream, without any formatting.

        :param str b: byte to add
        rTr3s  r�add_bytezMessage.add_byte�rWrc��|r!|jjt�|S|jjt�|S)za
        Add a boolean value to the stream.

        :param bool b: boolean value to add
        )rrUrrr3s  r�add_booleanzMessage.add_boolean�s9��
��K�K���h�'���
�K�K���i�(��rc�d�|jjtjd|��|S�zU
        Add an integer to the stream.

        :param int n: integer to add
        r7�rrUr:�pack�rr+s  r�add_intzMessage.add_int��&��	
�����&�+�+�d�A�.�/��rc��|tjk\rE|jjt�|jt
j|��|S|jjtjd|��|Sr])
r
�big_intrrUr�
add_stringr�deflate_longr:r_r`s  r�add_adaptive_intzMessage.add_adaptive_int�sd��
������K�K���h�'��O�O�D�-�-�a�0�1���
�K�K���f�k�k�$��2�3��rc�d�|jjtjd|��|S)zY
        Add a 64-bit int to the stream.

        :param long n: long int to add
        rCr^r`s  r�	add_int64zMessage.add_int64�rbrc�N�|jtj|��|S)z�
        Add a long int to the stream, encoded as an infinite-precision
        integer.  This method only works on positive numbers.

        :param long z: long int to add
        )rerrf)r�zs  r�	add_mpintzMessage.add_mpints ��	
����)�)�!�,�-��rc��t|�}|jt|��|jj	|�|S)zR
        Add a string to the stream.

        :param str s: string to add
        )rrar*rrU)r�ss  rrezMessage.add_strings4��
�A�J�����S��V�������!���rc�F�|jdj|��|S)z�
        Add a list of strings to the stream.  They are encoded identically to
        a single string of values separated by commas.  (Yes, really, that's
        how SSH2 does it.)

        :param l: list of strings to add
        rP)re�join)r�ls  r�add_listzMessage.add_lists��	
��������$��rc���t|�tur|j|�St|t�r|j|�St|�tur|j|�S|j|�S�N)	�type�boolr[�
isinstancerrg�listrrre)r�is  r�_addzMessage._add!sb����7�d�?��#�#�A�&�&�
��=�
)��(�(��+�+�
�!�W��_��=�=��#�#��?�?�1�%�%rc�4�|D]}|j|��y)a
        Add a sequence of items to the stream.  The values are encoded based
        on their type: str, int, bool, list, or long.

        .. warning::
            Longs are encoded non-deterministically.  Don't use this method.

        :param seq: the sequence of items
        N)rz)r�seq�items   r�addzMessage.add+s���	�D��I�I�d�O�	rrt)#�__name__�
__module__�__qualname__�__doc__rrdrrrrr r&r(r.r1r4r=rArErGrJrMr9rRrVrYr[rargrirlrerrrzr~�rrr
r
s�����:��G�$��H�&���*��	!��
,�9�9�4�.�$�.�*���
�����	�	�&�rr
)r�r:�paramikor�paramiko.commonrrrr�paramiko.py3compatrr	r
r�objectr
r�rr�<module>r�s,��&���B�B�>�>�X�f�Xr

Zerion Mini Shell 1.0