Repository URL to install this package:
Version:
3.4.37 ▾
|
ó °EYc @ s d d l Z d d l m Z d d l Z d d l m Z d d l Z d d l Z d d l m Z d d l m Z d e f d YZ d S( iÿÿÿÿN( t split( t select( t ProxyCommandFailure( t ClosingContextManagert ProxyCommandc B sY e Z d Z d Z d Z d Z d Z e d Z e d 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 C s\ d d l m } m } t | | _ | | j d | d | d | d d | _ d | _ d S( 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ÿÿÿÿ( t Popent PIPEt stdint stdoutt stderrt bufsizei N( t subprocessR R t shlsplitt cmdt processt Nonet timeout( t selft command_lineR R ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/proxy.pyt __init__* s c C sU y | j j j | Wn1 t k rJ } t d j | j | j n Xt | 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 ( R R t writet IOErrorR t joinR t strerrort len( R t contentt e( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/proxy.pyt send: s "c C sP yø d } t j } xÛ t | | k rò d } | j d k r} t j | } | | j k rm t j n | j | } n t | j j g g g | \ } } } | r | d | j j k r | t j | j j j | t | 7} q q W| SWnQ t j k r| r| S n1 t k rK} t d j | j | j n Xd S( 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 t i R N( t timeR R R t socketR R R t ost readt filenoR R R R R ( R t sizet buffert startt select_timeoutt elapsedt rt wt xR ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/proxy.pyt recvK s, $ *c C s t j | j j t j d S( N( R t killR t pidt signalt SIGTERM( R ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/proxy.pyt closel s c C s | j j d k S( N( R t returncodeR ( R ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/proxy.pyt closedo s c C s | j S( N( R2 ( R ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/proxy.pyt _closeds s c C s | | _ d S( N( R ( R R ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/proxy.pyt settimeoutx s ( t __name__t __module__t __doc__R R R+ R0 t propertyR2 R3 R4 ( ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/proxy.pyR s ! ( R t shlexR R R. R R R t paramiko.ssh_exceptionR t paramiko.utilR R ( ( ( sC /home/tvault/.virtenv/lib/python2.7/site-packages/paramiko/proxy.pyt <module> s