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__/proxy.cpython-310.pyc
o

�h(�
@s�ddlZddlZddlZddlmZddlZddlZd\ZZzddlZWney8Z	ze	ZWYdZ	[	ndZ	[	wwddl
mZddlm
Z
Gdd�de
�ZdS)�N)�select)NN)�ProxyCommandFailure)�ClosingContextManagerc@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zed
d��Z	edd
��Z
dd�ZdS)�ProxyCommanda�
    Wraps a subprocess running ProxyCommand-driven programs.

    This class implements a the socket-like interface needed by the
    `.Transport` and `.Packetizer` classes. Using this class instead of a
    regular socket makes it possible to talk with a Popen'd command that will
    proxy traffic between the client and a server hosted in another machine.

    Instances of this class may be used as context managers.
    cCs@tdurt�t�|�|_tj|jtjtjtjdd�|_d|_dS)a
        Create a new CommandProxy instance. The instance created by this
        class can be passed as an argument to the `.Transport` class.

        :param str command_line:
            the command that should be executed and used as the proxy.
        Nr)�stdin�stdout�stderr�bufsize)	�
subprocess�subprocess_import_error�shlex�split�cmd�Popen�PIPE�process�timeout)�self�command_line�r�D/usr/local/CyberPanel/lib/python3.10/site-packages/paramiko/proxy.py�__init__3s�
zProxyCommand.__init__c
CsFz|jj�|�Wt|�Sty"}z
td�|j�|j��d}~ww)z�
        Write the content received from the SSH client to the standard
        input of the forked command.

        :param str content: string to be sent to the forked command
        � N)	rr�write�IOErrorr�joinr�strerror�len)r�content�errr�sendGs���zProxyCommand.sendc

Cs�zWd}t��}t|�|krUd}|jdur(t��|}||jkr#t���|j|}t|jjggg|�\}}}|rO|d|jjkrO|t�|jj�	�|t|��7}t|�|ks
|WStjyf|re|YS�t
y{}	z
td�|j
�|	j��d}	~	ww)z�
        Read from the standard output of the forked program.

        :param int size: how many chars should be read

        :return: the string of bytes read, which may be shorter than requested
        �Nrr)�timerr�socketrrr�os�read�filenorrrrr)
r�size�buffer�start�select_timeout�elapsed�r�w�xrrrr�recvXs2


��
��zProxyCommand.recvcCst�|jjtj�dS�N)r$�killr�pid�signal�SIGTERM�rrrr�closeyszProxyCommand.closecCs|jjduSr0)r�
returncoder5rrr�closed|szProxyCommand.closedcCs|jSr0)r8r5rrr�_closed�szProxyCommand._closedcCs
||_dSr0)r)rrrrr�
settimeout�s
zProxyCommand.settimeoutN)�__name__�
__module__�__qualname__�__doc__rr r/r6�propertyr8r9r:rrrrr's!

r)r$rr3rr#r"r
r�ImportErrorr�paramiko.ssh_exceptionr�
paramiko.utilrrrrrr�<module>s ��