HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberPanel/lib64/python3.10/site-packages/paramiko/__pycache__/message.cpython-310.pyc
o

�h�$�@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"|durt|�|_dSt�|_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�F/usr/local/CyberPanel/lib/python3.10/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__<�zMessage.__repr__cCs
|j��S)zO
        Return the byte stream content of this Message, as a `bytes`.
        )r	rrrrr
rCs
zMessage.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_farcCsF|j�|�}d}t|�|kr|kr!n|S|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�b�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�}|tkrt�|���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_intcC�t�d|�d��dS)z/
        Fetch an int from the stream.
        r*�r�r-r.r$rrrr
�get_int�rzMessage.get_intcCr1)zj
        Fetch a 64-bit int from the stream.

        :return: a 64-bit unsigned integer (`int`).
        �>Q�rr3rr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��zMessage.get_mpintcC�|�|���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$r4rrrr
�
get_string�r9zMessage.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``.
        )rr<rrrr
�get_text�szMessage.get_textcCr:)z@
        Alias for `get_string` (obtains a bytestring).
        r;rr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.
        �,)r=�splitrrrr
�get_list�r9zMessage.get_listcC�|j�|�|S)zj
        Write bytes to the stream, without any formatting.

        :param bytes b: bytes to add
        �r	�writer'rrr
�	add_bytes��zMessage.add_bytescCrA)zq
        Write a single byte to the stream, without any formatting.

        :param bytes b: byte to add
        rBr'rrr
�add_byte�rEzMessage.add_bytecCs$|r
|j�t�|S|j�t�|S)za
        Add a boolean value to the stream.

        :param bool b: boolean value to add
        )r	rCrrr'rrr
�add_boolean�s
�zMessage.add_booleancC�|j�t�d|��|S�zU
        Add an integer to the stream.

        :param int n: integer to add
        r*�r	rCr-�pack�r
r!rrr
�add_int��zMessage.add_intcCsB|tjkr|j�t�|�t�|��|S|j�t�	d|��|SrI)
r�big_intr	rCr�
add_stringr�deflate_longr-rKrLrrr
�add_adaptive_int�s
�zMessage.add_adaptive_intcCrH)zX
        Add a 64-bit int to the stream.

        :param int n: long int to add
        r5rJrLrrr
�	add_int64�rNzMessage.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
        )rPrrQ)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
        )rrrMr r	rC)r
�srrr
rPs
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
        r>)rP�join)r
�lrrr
�add_listszMessage.add_listcCsJt|�tur|�|�St|t�r|�|�St|�tur |�|�S|�|�Sr)	�type�boolrG�
isinstance�intrR�listrYrP)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)r`)r
�seq�itemrrr
�add3s
�zMessage.addr)"�__name__�
__module__�__qualname__�__doc__rOrrrrrrrr$r&r(r0r4r7r8r<r=r,r@rDrFrGrMrRrSrUrPrYr`rcrrrr
rs@







				
	r)
rgr-�ior�paramikor�paramiko.commonrrr�
paramiko.utilrrrrrr
�<module>s