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__/proxy.cpython-38.pyc
U

P��g(�
@s�ddlZddlZddlZddlmZddlZddlZd\ZZzddlZWn&ek
rnZ	ze	ZW5dZ	[	XYnXddl
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@tdkrt�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)�selfZcommand_line�r�;/opt/cppython/lib/python3.8/site-packages/paramiko/proxy.py�__init__3s�zProxyCommand.__init__c
CsRz|jj�|�Wn6tk
rH}ztd�|j�|j��W5d}~XYnXt|�S)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

Csz�d}t��}t|�|kr�d}|jdk	rPt��|}||jkrFt���|j|}t|jjggg|�\}}}|r|d|jjkr|t�|jj�	�|t|��7}q|WStjk
r�|r�|YS�Yn8t
k
�r�}	ztd�|j
�|	j��W5d}	~	XYnXdS)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�startZselect_timeout�elapsed�r�w�xrrrr�recvXs.




�zProxyCommand.recvcCst�|jjtj�dS�N)r#�killr�pid�signal�SIGTERM�rrrr�closeyszProxyCommand.closecCs|jjdk	Sr.)r�
returncoder3rrr�closed|szProxyCommand.closedcCs|jSr.)r6r3rrr�_closed�szProxyCommand._closedcCs
||_dSr.)r)rrrrr�
settimeout�szProxyCommand.settimeoutN)�__name__�
__module__�__qualname__�__doc__rrr-r4�propertyr6r7r8rrrrr's!

r)r#rr1rr"r!r
r�ImportErrorrZparamiko.ssh_exceptionrZ
paramiko.utilrrrrrr�<module>s

F1le Man4ger