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/asyncssh/__pycache__/logging.cpython-310.pyc
o

�h+�@s�dZddlZddlmZmZmZmZmZeZ	ee
efZGdd�dej�Z
deee
fddfdd	�Zdeee
fddfd
d�Zdeddfdd
�Ze
�Ze�d�ZdS)zLogging functions�N)�MutableMapping�Optional�Tuple�Union�castcseZdZdZdZe�ep
d�Zeddfdej	de
de
f�fdd	�
Zde
d
e
fdd�Zd"de
de
d
dfd
d�Z
deded
df�fdd�Zde
ded
ee
effdd�Zeded
dfdd��Zde
deded
dfdd�Zde
deded
dfdd�Zdeedede
deded
dfd d!�Z�ZS)#�	SSHLoggerz/Adapter to add context to AsyncSSH log messages��asyncssh��parent�child�contextcs.||_|r
|�|�n||_t��|ji�dS�N)�_context�getChild�_logger�super�__init__)�selfrrr
��	__class__��F/usr/local/CyberPanel/lib/python3.10/site-packages/asyncssh/logging.pyr&szSSHLogger.__init__�returncCs&|r|jr|jd|}|S|j}|S)z&Extend context provided by this loggerz, )r)rr
rrr�_extend_context-s�zSSHLogger._extend_contextcCst|�|j||�|��S)z/Return child logger with optional added context)�typerr)rrr
rrr�	get_child8szSSHLogger.get_child�level�msgNcsZdtdtfdd��dtdtf�fdd���fdd	�|D�}t�j||g|�Ri|��d
S)z&Log a message to the underlying logger�itemrcSsRt|t�r|jddd�}|��st|�dd�}|St|t�s%t|�}|S|}|S)zConvert a list item to textzutf-8�backslashreplace)�errorsr���)�
isinstance�bytes�decode�isprintable�repr�str)r�resultrrr�
_item_text@s

��z!SSHLogger.log.<locals>._item_text�argcs�t|t�rd��fdd�|D��}|St|t�r6|\}}|r+|r'|�d|��n|}|S|r2d|��nd}|St|t�rA�|�}|S|}|S)zConvert a log argument to text�,c3s�|]}�|�VqdSrr)�.0r�r*rr�	<genexpr>Us�z/SSHLogger.log.<locals>._text.<locals>.<genexpr>z, port zport zdynamic port)r#�list�join�tupler$)r+r)�host�portr.rr�_textOs

��
��zSSHLogger.log.<locals>._textcsg|]}�|��qSrr)r-r+)r5rr�
<listcomp>dsz!SSHLogger.log.<locals>.<listcomp>N)�_LogArgr(r�log)rrr�args�kwargs�log_argsr)r*r5rr8=s z
SSHLogger.logr:cCstt|�di��}|�tt|�d���}|rd|dnd}tt|�d��}d}d}|r�d|d	�d
�}|dd�D]
}	|d
|	d��7}q9|dt|�d
7}|dd�D]}	|	dks^|	dkrad}
n
|	td�krjd}
nt|	�}
||
7}qT||7}|dd�}|d7}|s,||||fS)zAdd context to log message�extrar
�[z] r
�packetrz
  �08x�:N�� �02x�>� ��.�%z%%)	r�_ObjDict�getrr(r$�len�ord�chr)rrr:r<r
r>�pktdata�offset�line�b�crrr�processhs.
�zSSHLogger.processcCs"|dks|dkrtd��||_dS)zSet AsyncSSH debug log levelr�z'Debug log level must be between 1 and 3N)�
ValueError�_debug_level)�clsrrrr�set_debug_level�s
zSSHLogger.set_debug_levelr9cOs |jtj|g|�Ri|��dS)z!Write a level 1 debug log messageN)r8�logging�DEBUG�rrr9r:rrr�debug1�s zSSHLogger.debug1cOs.|jdkr|jtj|g|�Ri|��dSdS)z!Write a level 2 debug log message�N)rVr8rYrZr[rrr�debug2�s
 �zSSHLogger.debug2�pktidr>cOsp|jdkr6|�di�tt|�d��}|dur |jd|��d�|j|d�|jtj|g|�Ri|��dSdS)z(Write a control packet debug log messagerTr<Nzpktid=)r
)r>)	rV�
setdefaultrrIrJ�updater8rYrZ)rr_r>rr9r:r<rrrr>�s
 �zSSHLogger.packet)r
r
)�__name__�
__module__�__qualname__�__doc__rVrY�	getLogger�__package__�_pkg_logger�Loggerr(rrr�int�objectr8rIrrS�classmethodrXr7r\r^rr$r>�
__classcell__rrrrr s4
���+%���rrrcC�t�|�dS)a�Set the AsyncSSH log level

       This function sets the log level of the AsyncSSH logger. It
       defaults to `'NOTSET`', meaning that it will track the debug
       level set on the root Python logger.

       For additional control over the level of debug logging, see the
       function :func:`set_debug_level` for additional information.

       :param level:
           The log level to set, as defined by the `logging` module
       :type level: `int` or `str`

    N)�logger�setLevel�rrrr�
set_log_level��rrcCrn)a�Set the AsyncSSH SFTP/SCP log level

       This function sets the log level of the AsyncSSH SFTP/SCP logger.
       It defaults to `'NOTSET`', meaning that it will track the debug
       level set on the main AsyncSSH logger.

       For additional control over the level of debug logging, see the
       function :func:`set_debug_level` for additional information.

       :param level:
           The log level to set, as defined by the `logging` module
       :type level: `int` or `str`

    N)�sftp_loggerrprqrrr�set_sftp_log_level�rsrucCrn)aWSet the AsyncSSH debug log level

       This function sets the level of debugging logging done by the
       AsyncSSH logger, from the following options:

           ===== ====================================
           Level Description
           ===== ====================================
           1     Minimal debug logging
           2     Full debug logging
           3     Full debug logging with packet dumps
           ===== ====================================

       The debug level defaults to level 1 (minimal debug logging).

       .. note:: For this setting to have any effect, the effective log
                 level of the AsyncSSH logger must be set to DEBUG.

       .. warning:: Extreme caution should be used when setting debug
                    level to 3, as this can expose user passwords in
                    clear text. This level should generally only be
                    needed when tracking down issues with malformed
                    or incomplete packets.

       :param level:
           The debug level to set, as defined above.
       :type level: `int`

    N)rorXrqrrrrX�srX�sftp)rerY�typingrrrrrrkr7r(rI�
LoggerAdapterrrjrrrurXrorrtrrrr�<module>s"