ó
    &ÝNj(  ã                   ó¤   • S SK r S SKrS SKrS SKJr  S SKrS SKrSu  rr S SKrS SK
Jr  S SKJr   " S S\5      rg! \ a  r	\	r Sr	C	N%Sr	C	ff = f)é    N)Úselect)NN)ÚProxyCommandFailure)ÚClosingContextManagerc                   óV   • \ rS rSrSrS rS rS rS r\	S 5       r
\	S 5       rS	 rS
rg)ÚProxyCommandé'   aŽ  
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  [        e[        R                  " U5      U l        [         R
                  " U R                  [         R                  [         R                  [         R                  SS9U l        SU l        g)zÙ
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_lines     ÚK/home/mande/repo/quber/.venv/lib/python3.13/site-packages/paramiko/proxy.pyÚ__init__ÚProxyCommand.__init__3   sZ   € ô ÑÜ)Ð)Ü—;’;˜|Ó,ˆŒÜ!×'Ò'Ø�H‰HÜ—/‘/Ü—?‘?Ü—?‘?Øñ
ˆŒð ˆ�ó    c                 óæ   •  U R                   R                  R                  U5        [        U5      $ ! [         a4  n[	        SR                  U R                  5      UR                  5      eSnAff = f)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)	r   r
   ÚwriteÚIOErrorr   Újoinr   ÚstrerrorÚlen)r   ÚcontentÚes      r   ÚsendÚProxyCommand.sendG   s`   € ð	FØ�L‰L×Ñ×$Ñ$ WÔ-ô �7‹|Ðøô ó 	Fô
 & c§h¡h¨t¯x©xÓ&8¸!¿*¹*ÓEÐEûð	Fús   ‚%2 ²
A0¼/A+Á+A0c                 ó  •  Sn[         R                   " 5       n[        U5      U:  aý  SnU R                  bK  [         R                   " 5       U-
  nXPR                  :¼  a  [        R                  " 5       eU R                  U-
  n[	        U R
                  R                  // / U5      u  pgnU(       ae  US   U R
                  R                  :X  aH  U[        R                  " U R
                  R                  R                  5       U[        U5      -
  5      -  n[        U5      U:  a  Mý  U$ ! [        R                   a    W(       a  Us $ e [         a4  n	[        SR                  U R                  5      U	R                  5      eSn	A	ff = f)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
r   Nr   r   )Útimer#   r   Úsocketr   r   r   ÚosÚreadÚfilenor    r   r!   r   r"   )
r   ÚsizeÚbufferÚstartÚselect_timeoutÚelapsedÚrÚwÚxr%   s
             r   ÚrecvÚProxyCommand.recvX   s3  € ð	FØˆFÜ—I’I“KˆEÜ�f“+ Ó$Ø!%�Ø—<‘<Ñ+Ü"Ÿiši›k¨EÑ1�GØ§,¡,Ó.Ü$ŸnšnÓ.Ð.Ø%)§\¡\°GÑ%;�Nä  $§,¡,×"5Ñ"5Ð!6¸¸BÀÓO‘��aÞ˜˜1™ §¡×!4Ñ!4Ó4ØœbŸgšgØŸ™×+Ñ+×2Ñ2Ó4°d¼SÀ»[Ñ6Hóñ �Fô �f“+ Õ$ð ˆMøÜ�~‰~ó 	Þà’ØÜó 	FÜ% c§h¡h¨t¯x©xÓ&8¸!¿*¹*ÓEÐEûð	Fús$   ‚D!D' Ä%D' Ä'FÅ
FÅ/E?Å?Fc                 óv   • [         R                  " U R                  R                  [        R
                  5        g ©N)r+   Úkillr   ÚpidÚsignalÚSIGTERM©r   s    r   ÚcloseÚProxyCommand.closey   s   € Ü
�Š�—‘× Ñ ¤&§.¡.Õ1r   c                 ó2   • U R                   R                  S L$ r9   )r   Ú
returncoder>   s    r   ÚclosedÚProxyCommand.closed|   s   € à�|‰|×&Ñ&¨dÐ2Ð2r   c                 ó   • U R                   $ r9   )rC   r>   s    r   Ú_closedÚProxyCommand._closed€   s   € ð �{‰{Ðr   c                 ó   • Xl         g r9   )r   )r   r   s     r   Ú
settimeoutÚProxyCommand.settimeout…   s   € Ø�r   )r   r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r&   r6   r?   ÚpropertyrC   rF   rI   Ú__static_attributes__© r   r   r   r   '   sJ   † ñ	òò(ò"FòB2ð ñ3ó ð3ð ñó ðõr   r   )r+   r   r<   r   r*   r)   r   r   ÚImportErrorr%   Úparamiko.ssh_exceptionr   Úparamiko.utilr   r   rR   r   r   Ú<module>rV      s]   ðó( 
Û Û Ý Û Û ð '1Ñ #€
Ð#ð Ûõ 7Ý /ô_Ð(õ _øð ó  ØÕûð ús   ¡= ½AÁA
Á
A