Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/site-packages/paramiko/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/site-packages/paramiko/__pycache__/message.cpython-38.pyc
U

P��g�$�@sVdZddlZddlmZddlmZddlmZmZm	Z	ddl
mZGdd�d�ZdS)	z&
Implementation of an SSH2 "message".
�N)�BytesIO)�util)�	zero_byte�max_byte�one_byte)�uc@s�eZdZdZdZd>dd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zd4d5�Zd6d7�Zd8d9�Zd:d;�Z d<d=�Z!dS)?�Messagea~
    An SSH2 message is a stream of bytes that encodes some combination of
    strings, integers, bools, and infinite-precision integers.  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~NcCs |dk	rt|�|_nt�|_dS)z�
        Create a new SSH2 message.

        :param bytes content:
            the byte stream to use as the message content (passed in only when
            decomposing a message).
        N)r�packet)�self�content�r�=/opt/cppython/lib/python3.8/site-packages/paramiko/message.py�__init__,szMessage.__init__cCs|��S�N)�asbytes�r
rrr
�	__bytes__9szMessage.__bytes__cCsdt|j���dS)zP
        Returns a string representation of this object, for debugging.
        zparamiko.Message(�))�reprr	�getvaluerrrr
�__repr__<szMessage.__repr__cCs
|j��S)zO
        Return the byte stream content of this Message, as a `bytes`.
        )r	rrrrr
rCszMessage.asbytescCs|j�d�dS)zk
        Rewind the message to the beginning as if no items had been parsed
        out of it yet.
        rN)r	�seekrrrr
�rewindIszMessage.rewindcCs$|j��}|j��}|j�|�|S)zk
        Return the `bytes` of this message that haven't already been parsed and
        returned.
        )r	�tell�readr)r
�position�	remainderrrr
�
get_remainderPs

zMessage.get_remaindercCs|j��}|��|j�|�S)z�
        Returns the `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`.
        )r	rrr)r
rrrr
�
get_so_farZs
zMessage.get_so_farcCsD|j�|�}d}t|�|kr(|kr@nn|t|t|�S|S)a	
        Return the next ``n`` bytes of the message, 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)r	r�lenr)r
�n�bZmax_pad_sizerrr
�	get_bytesds
zMessage.get_bytescCs
|�d�S)a
        Return the next byte of the message, without decomposing it.  This
        is equivalent to `get_bytes(1) <get_bytes>`.

        :return:
            the next (`bytes`) byte of the message, or ``b''`` if there
            aren't any bytes remaining.
        �)r"rrrr
�get_byteqs	zMessage.get_bytecCs|�d�}|tkS)z2
        Fetch a boolean from the stream.
        r#)r"r�r
r!rrr
�get_boolean|s
zMessage.get_booleancCs>|�d�}|tkr t�|���S||�d�7}t�d|�dS)zZ
        Fetch an int from the stream.

        :return: a 32-bit unsigned `int`.
        r#��>Ir)r"rr�inflate_long�
get_binary�struct�unpack)r
�byterrr
�get_adaptive_int�s

zMessage.get_adaptive_intcCst�d|�d��dS)z/
        Fetch an int from the stream.
        r(�r�r+r,r"rrrr
�get_int�szMessage.get_intcCst�d|�d��dS)zj
        Fetch a 64-bit int from the stream.

        :return: a 64-bit unsigned integer (`int`).
        �>Q�rr0rrrr
�	get_int64�szMessage.get_int64cCst�|���S)zr
        Fetch a long int (mpint) from the stream.

        :return: an arbitrary-length integer (`int`).
        )rr)r*rrrr
�	get_mpint�szMessage.get_mpintcCs|�|���S)z�
        Fetch a "string" from the stream.  This will actually be a `bytes`
        object, and may contain unprintable characters.  (It's not unheard of
        for a string to contain another byte-stream message.)
        �r"r1rrrr
�
get_string�szMessage.get_stringcCst|���S)z�
        Fetch a Unicode string from the stream.

        This currently operates by attempting to encode the next "string" as
        ``utf-8``.
        )rr7rrrr
�get_text�szMessage.get_textcCs|�|���S)z@
        Alias for `get_string` (obtains a bytestring).
        r6rrrr
r*�szMessage.get_binarycCs|���d�S)z�
        Fetch a list of `strings <str>` from the stream.

        These are trivially encoded as comma-separated values in a string.
        �,)r8�splitrrrr
�get_list�szMessage.get_listcCs|j�|�|S)zj
        Write bytes to the stream, without any formatting.

        :param bytes b: bytes to add
        �r	�writer%rrr
�	add_bytes�szMessage.add_bytescCs|j�|�|S)zq
        Write a single byte to the stream, without any formatting.

        :param bytes b: byte to add
        r<r%rrr
�add_byte�szMessage.add_bytecCs"|r|j�t�n|j�t�|S)za
        Add a boolean value to the stream.

        :param bool b: boolean value to add
        )r	r=rrr%rrr
�add_boolean�szMessage.add_booleancCs|j�t�d|��|S�zU
        Add an integer to the stream.

        :param int n: integer to add
        r(�r	r=r+�pack�r
r rrr
�add_int�szMessage.add_intcCs@|tjkr(|j�t�|�t�|��n|j�t�	d|��|SrA)
r�big_intr	r=r�
add_stringr�deflate_longr+rCrDrrr
�add_adaptive_int�s

zMessage.add_adaptive_intcCs|j�t�d|��|S)zX
        Add a 64-bit int to the stream.

        :param int n: long int to add
        r2rBrDrrr
�	add_int64�szMessage.add_int64cCs|�t�|��|S)z�
        Add a long int to the stream, encoded as an infinite-precision
        integer.  This method only works on positive numbers.

        :param int z: long int to add
        )rGrrH)r
�zrrr
�	add_mpintszMessage.add_mpintcCs(t�|�}|�t|��|j�|�|S)z[
        Add a bytestring to the stream.

        :param byte s: bytestring to add
        )rrrErr	r=)r
�srrr
rGs
zMessage.add_stringcCs|�d�|��|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
        r9)rG�join)r
�lrrr
�add_listszMessage.add_listcCsNt|�tkr|�|�St|t�r*|�|�St|�tkr@|�|�S|�|�SdSr)	�type�boolr@�
isinstance�intrI�listrPrG)r
�irrr
�_add's



zMessage._addcGs|D]}|�|�qdS)a
        Add a sequence of items to the stream.  The values are encoded based
        on their type: bytes, str, int, bool, or list.

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

        :param seq: the sequence of items
        N)rW)r
�seq�itemrrr
�add3s
zMessage.add)N)"�__name__�
__module__�__qualname__�__doc__rFrrrrrrrr"r$r&r.r1r4r5r7r8r*r;r>r?r@rErIrJrLrGrPrWrZrrrr
rs>







				
	r)
r^r+�iorZparamikorZparamiko.commonrrrZ
paramiko.utilrrrrrr
�<module>s

F1le Man4ger