Viewing File: /usr/lib/python2.7/site-packages/paramiko/proxy.pyo

ó
=OXc@sšddlmZddlZddlmZddlZddlmZddlZddlZddl	m
Z
ddlmZdefd„ƒYZ
dS(	i’’’’(tdatetimeN(tsplit(tselect(tProxyCommandFailure(tClosingContextManagertProxyCommandcBsYeZdZd„Zd„Zd„Zd„Zed„ƒZed„ƒZ	d„Z
RS(sŖ
    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.
    c
Cs\ddlm}m}t|ƒ|_||jd|d|d|ddƒ|_d|_dS(	s
        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.
        i’’’’(tPopentPIPEtstdintstdouttstderrtbufsizeiN(t
subprocessRRtshlsplittcmdtprocesstNonettimeout(tselftcommand_lineRR((s2/usr/lib/python2.7/site-packages/paramiko/proxy.pyt__init__+s

cCsUy|jjj|ƒWn1tk
rJ}tdj|jƒ|jƒ‚nXt|ƒS(sŗ
        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
        t (	RRtwritetIOErrorRtjoinRtstrerrortlen(Rtcontentte((s2/usr/lib/python2.7/site-packages/paramiko/proxy.pytsend;s
"c
CsPyųd}tjƒ}xŪt|ƒ|krņd}|jdk	r}tjƒ|}||jkrmtjƒ‚n|j|}nt|jjggg|ƒ\}}}|r|d|jjkr|tj	|jjj
ƒ|t|ƒƒ7}qqW|SWnQtjk
r|r|S‚n1tk
rK}	tdj
|jƒ|	jƒ‚nXdS(sĪ
        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
        tiRN(ttimeRRRtsocketRRR	tostreadtfilenoRRRRR(
Rtsizetbuffertstarttselect_timeouttelapsedtrtwtxR((s2/usr/lib/python2.7/site-packages/paramiko/proxy.pytrecvLs,$	*cCstj|jjtjƒdS(N(R!tkillRtpidtsignaltSIGTERM(R((s2/usr/lib/python2.7/site-packages/paramiko/proxy.pytclosemscCs|jjdk	S(N(Rt
returncodeR(R((s2/usr/lib/python2.7/site-packages/paramiko/proxy.pytclosedpscCs|jS(N(R3(R((s2/usr/lib/python2.7/site-packages/paramiko/proxy.pyt_closedtscCs
||_dS(N(R(RR((s2/usr/lib/python2.7/site-packages/paramiko/proxy.pyt
settimeoutys(t__name__t
__module__t__doc__RRR,R1tpropertyR3R4R5(((s2/usr/lib/python2.7/site-packages/paramiko/proxy.pyR s
			!	(RR!tshlexRR
R/RR Rtparamiko.ssh_exceptionRt
paramiko.utilRR(((s2/usr/lib/python2.7/site-packages/paramiko/proxy.pyt<module>s
Back to Directory File Manager