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/CyberCP/lib/python3.10/site-packages/asyncssh/__pycache__/packet.cpython-310.pyc
o

�hk�@sPdZddlmZmZmZmZmZmZddlmZm	Z	ddl
mZddlm
Z
mZe	edfZeeeedge
dfZGd	d
�d
e�Zdedefd
d�Zdedefdd�Zdedefdd�Zdedefdd�Zdedefdd�Zde	eefdefdd�Zdedefdd�Zdeedefdd�ZGdd�d�ZGdd�d�Z Gd d!�d!e �Z!dS)"z*SSH packet encoding and decoding functions�)�Any�	Awaitable�Callable�Iterable�Mapping�Optional)�Sequence�Union�)�	SSHLogger)�
MaybeAwait�plural�	SSHPacketNc@seZdZdZdS)�PacketDecodeErrorzPacket decoding errorN)�__name__�
__module__�__qualname__�__doc__�rr�B/usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/packet.pyr"sr�value�returncCs
t|f�S)zEncode a single byte)�bytes�rrrr�Byte&s
rcCstt|��S)zEncode a boolean value)r�boolrrrr�Boolean,�rcC�|�dd�S)zEncode a 16-bit integer value��big��to_bytesrrrr�UInt162rr#cCr)zEncode a 32-bit integer value�r r!rrrr�UInt328rr%cCr)zEncode a 64-bit integer value�r r!rrrr�UInt64>rr'cCs,t|t�r|jddd�}t|��dd�|S)z*Encode a byte string or UTF-8 string valuezutf-8�strict)�errorsr$r )�
isinstance�str�encode�lenr"rrrr�StringDs
r.cCsX|��}||ddko|dko|d|d>k7}|dd}|�dd�|j|ddd	�S)
z)Encode a multiple precision integer valuer&r���r
�r$r T��signed)�
bit_lengthr")r�lrrr�MPIntMs(r5cCstd�|��S)z-Encode a comma-separated list of byte strings�,)r.�joinrrrr�NameListW�r8c@s�eZdZdZdefdd�Zdefdd�Zd$d	d
�Zdefdd�Z	defd
d�Z
defdd�Zdedefdd�Z
defdd�Zdefdd�Zdefdd�Zdefdd�Zdefdd�Zdefdd�Zdefd d!�Zdeefd"d#�ZdS)%rzDecoder class for SSH packets�packetcCs||_d|_t|�|_dS)Nr)�_packet�_idxr-�_len)�selfr:rrr�__init__`szSSHPacket.__init__rcCs|j|jkS)N)r<r=�r>rrr�__bool__eszSSHPacket.__bool__NcCs|rtd��dS)z<Confirm that all of the data in the packet has been consumedz Unexpected data at end of packetN)rr@rrr�	check_endhs�zSSHPacket.check_endcCs|jd|j�S)z0Return the portion of the packet consumed so farN�r;r<r@rrr�get_consumed_payloadn�zSSHPacket.get_consumed_payloadcCs|j|jd�S)z1Return the portion of the packet not yet consumedNrCr@rrr�get_remaining_payloadsrEzSSHPacket.get_remaining_payloadcCs|jS)zReturn the full packet)r;r@rrr�get_full_payloadxszSSHPacket.get_full_payload�sizecCs@|j||jkrtd��|j|j|j|�}|j|7_|S)z5Extract the requested number of bytes from the packetzIncomplete packet)r<r=rr;)r>rHrrrr�	get_bytes}s
zSSHPacket.get_bytescCs|�d�dS)z%Extract a single byte from the packetr
r)rIr@rrr�get_byte�r9zSSHPacket.get_bytecCst|���S)z!Extract a boolean from the packet)rrJr@rrr�get_boolean�rzSSHPacket.get_booleancC�t�|�d�d�S)z(Extract a 16-bit integer from the packetrr ��int�
from_bytesrIr@rrr�
get_uint16��zSSHPacket.get_uint16cCrL)z(Extract a 32-bit integer from the packetr$r rMr@rrr�
get_uint32�rQzSSHPacket.get_uint32cCrL)z(Extract a 64-bit integer from the packetr&r rMr@rrr�
get_uint64�rQzSSHPacket.get_uint64cCs|�|���S)z&Extract a UTF-8 string from the packet)rIrRr@rrr�
get_string�r9zSSHPacket.get_stringcCstj|��ddd�S)z4Extract a multiple precision integer from the packetr Tr1)rNrOrTr@rrr�	get_mpint�szSSHPacket.get_mpintcCs|��}|r|�d�SgS)z>Extract a comma-separated list of byte strings from the packetr6)rT�split)r>�namelistrrr�get_namelist�szSSHPacket.get_namelist)rN)rrrrrr?rrArBrDrFrGrNrIrJrKrPrRrSrTrUrrXrrrrr]s"

c@s�eZdZUdZiZeeefed<e	de
fdd��Zdededeed	e
d
eddfdd
�Z	ddedeed	e
d
eddf
dd�Z	ddedeed	e
d
eddf
dd�ZdS)�SSHPacketLoggerz#Parent class for SSH packet loggers�_handler_namesrcC�t�)z$The logger to use for packet logging��NotImplementedErrorr@rrr�logger��zSSHPacketLogger.logger�msg�pkttype�pktidr:�noteNc	Cs�t|t�r	|��}z
|j|�d|�d�}Wnty$d|��}Ynwtt|�d�}|r4d|�d�}|j�||d||||�dS)zLog a sent/received packetz (�)zpacket type �bytez%s %s, %s%sN)	r*rrGrZ�KeyErrorr
r-r^r:)r>r`rarbr:rc�name�countrrr�_log_packet�s
��zSSHPacketLogger._log_packet�cC�|�d||||�dS)zLog a sent packet�SentN�ri�r>rarbr:rcrrr�log_sent_packet��zSSHPacketLogger.log_sent_packetcCrk)zLog a received packet�ReceivedNrmrnrrr�log_received_packet�rpz#SSHPacketLogger.log_received_packet)rj)rrrrrZrrNr+�__annotations__�propertyrr^r�
_LoggedPacketrirorrrrrrrY�s8
��
����
�����rYc@s^eZdZUdZiZeeefed<e	de
fdd��Zdededede
eed	ffd
d�Zd	S)�SSHPacketHandlerz$Parent class for SSH packet handlers�_packet_handlersrcCr[)z.The logger associated with this packet handlerr\r@rrrr^�r_zSSHPacketHandler.loggerrarbr:NcCs&||jvr|j|||||�pdSdS)z!Log and process a received packetTF)rw)r>rarbr:rrr�process_packet�s
��zSSHPacketHandler.process_packet)rrrrrwrrN�_PacketHandlerrsrtrr^rr	rrrxrrrrrv�s

��rv)"r�typingrrrrrrrr	�loggingr�miscrr
rrurNry�
ValueErrorrrrrr#r%r'r+r.r5r8rrYrvrrrr�<module>s& 	
T-