+
    üÐj3„  ã                   ól  € R t ^ RIt^ RIHt ^ RIHtHtHt ^ RIH	t	H
t
HtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHtHt ^ R	IHt ^ R
IHtHt ^ RIHt ^ RIHt ]! R4      t ] '       d   ^ RI!H"t"H#t# ^ RI$H%t%H&t&H't'H(t( M
 ! R R4      t" ! R R4      t) ! R R]"PT                  4      t+ ! R R4      t,^ RIH-t- ] '       d   ]-P\                  ! ],]+](P^                  4        ! R R]P`                  4      t1 ! R R4      t2 ! R R4      t3 ! R R 4      t4 ! R! R"4      t5] eÃ   ^ R#I!H6t6 ^ R$I$H7t7H8t8H9t9H:t:H;t;H<t<  ! R% R&4      t= ! R' R(]6P|                  4      t? ! R) R*]9P€                  4      tA ! R+ R,4      tB ! R- R.]B];P†                  4      tD ! R/ R0]B];PŠ                  4      tF ! R1 R2]<PŽ                  4      tH ! R3 R4]8P’                  4      tJ ! R5 R6]7P–                  4      tLR7 tM ! R8 R9]Pœ                  4      tO ! R: R;]Pœ                  4      tP ! R< R=]Pœ                  4      tQ ! R> R?]Pœ                  4      tRR# )@z!
Tests for L{twisted.conch.ssh}.
N)Úchain)ÚDictÚListÚTuple)ÚprivateDSA_opensshÚprivateRSA_opensshÚpublicDSA_opensshÚpublicRSA_openssh)ÚLoopbackRelay)Úportal)ÚUnauthorizedLogin)ÚdeferÚprotocolÚreactor)ÚProcessTerminated)ÚfailureÚlog)ÚrequireModule)ÚunittestÚcryptography)ÚavatarÚerror)Ú_kexÚcommonÚ
forwardingÚsessionc                   ó*   € ] tR t^#t ! R R4      tRtR# )r   c                   ó   € ] tR t^$tRtR# )Úavatar.ConchUser© N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   ó    Ú=/usr/lib/python3/dist-packages/twisted/conch/test/test_ssh.pyÚ	ConchUserr   $   s   † Ûr%   r'   r   N)r    r!   r"   r#   r'   r$   r   r%   r&   r   r   #   s   † ÷	õ 	r%   r   c                   ó4   a € ] tR t^(t o RtRtR tR tRtV t	R# )ÚConchTestRealma
  
A realm which expects a particular avatarId to log in once and creates a
L{ConchTestAvatar} for that request.

@ivar expectedAvatarID: The only avatarID that this realm will produce an
    avatar for.

@ivar avatar: A reference to the avatar after it is requested.
Nc                ó   € Wn         R # ©N)ÚexpectedAvatarID)Úselfr,   s   &&r&   Ú__init__ÚConchTestRealm.__init__5   s   € Ø 0Ör%   c                ó   € WP                   8X  dS   V P                  e   \        R4      h\        4       V n        V^ ,          V P                  V P                  P                  3# \        RV P                   : RV: 24      h)zp
Return a new L{ConchTestAvatar} if the avatarID matches the expected one
and this is the first avatar request.
zOnly one login allowedzOnly z may log in, not )r,   r   r   ÚConchTestAvatarÚlogout)r-   ÚavatarIDÚmindÚ
interfacess   &&&*r&   ÚrequestAvatarÚConchTestRealm.requestAvatar8   st   € ð
 ×,Ñ,Ô,Ø�{‰{Ò&Ü'Ð(@ÓAÐAÜ)Ó+ˆDŒKØ˜a•= $§+¡+¨t¯{©{×/AÑ/AÐAÐAÜØ�D×)Ñ)Ñ,Ð,=¸h¹\ÐJó
ð 	
r%   )r   r,   )
r    r!   r"   r#   Ú__doc__r   r.   r6   r$   Ú__classdictcell__©Ú__classdict__s   @r&   r)   r)   (   s    ø‡ € ñð €Fò1÷
ð 
r%   r)   c                   ó`   a € ] tR t^Gt o Rt]'       g   RtRtR tR t	R t
R tR tR	 tR
tV tR# )r1   z—
An avatar against which various SSH features can be tested.

@ivar loggedOut: A flag indicating whether the avatar logout method has been
    called.
úcannot run without cryptographyFc                ó  € \         P                  P                  V 4       / V n        / V n        V P
                  P                  R \        P                  R\        P                  /4       V P                  P                  R\        /4       R# )ó   sessions   direct-tcpipó   crazyN)r   r'   r.   Ú	listenersÚglobalRequestsÚchannelLookupÚupdater   Ú
SSHSessionr   ÚopenConnectForwardingClientÚsubsystemLookupÚCrazySubsystem©r-   s   &r&   r.   ÚConchTestAvatar.__init__T   so   € Ü×Ñ×!Ñ! $Ô'ØˆŒØ ˆÔØ×Ñ×!Ñ!àœG×.Ñ.Ø¤×!GÑ!Gðô	
ð 	×Ñ×#Ñ# X¬~Ð$>Ö?r%   c                ó"   € WP                   R &   ^# )Úfoo©rB   ©r-   Údatas   &&r&   Ú
global_fooÚConchTestAvatar.global_foo`   s   € Ø%)×Ñ˜EÑ"Ùr%   c                ó"   € WP                   R &   R# )Úfoo_2)é   ó   datarM   rN   s   &&r&   Úglobal_foo_2ÚConchTestAvatar.global_foo_2d   s   € Ø'+×Ñ˜GÑ$ØÐr%   c                ó8  € \         P                  ! V4      w  r# \        P                  ! V\         P                  ! V P
                  W#3\         P                  4      VR 7      pW@P                  W#3&   ^#   \         d    \        P                  ! RR4        ^ # i ; i))Ú	interfaceNz2something went wrong with remote->local forwarding)r   ÚunpackGlobal_tcpip_forwardr   Ú	listenTCPÚSSHListenForwardingFactoryÚconnÚ SSHListenServerForwardingChannelrA   ÚBaseExceptionr   Úerr©r-   rO   ÚhostÚportÚlisteners   &&   r&   Úglobal_tcpip_forwardÚ$ConchTestAvatar.global_tcpip_forwardh   sˆ   € Ü×:Ò:¸4Ó@‰
ˆð	Ü×(Ò(ØÜ×5Ò5Ø—I‘I ˜|¬Z×-XÑ-Xóð ôˆHð ,4�N‰N˜D˜<Ñ(Ùøô ô 	Ü�GŠG�DÐNÔOÚð	ús   šAA3 Á3"BÂBc                óÀ   € \         P                  ! V4      w  r#V P                  P                  W#3R 4      pV'       g   ^ # V P                  W#3 VP	                  4        ^# r+   )r   rZ   rA   ÚgetÚstopListeningra   s   &&   r&   Úglobal_cancel_tcpip_forwardÚ+ConchTestAvatar.global_cancel_tcpip_forwardy   sO   € Ü×:Ò:¸4Ó@‰
ˆØ—>‘>×%Ñ% t l°DÓ9ˆßÙØ�N‰N˜D˜<Ð(Ø×ÑÔ Ùr%   c                ó°   € R V n         V P                  P                  4        F0  p\        P                  ! RV,          4       VP                  4        K2  	  R# )TzstopListening %sN)Ú	loggedOutrA   Úvaluesr   Úmsgri   )r-   rd   s   & r&   r2   ÚConchTestAvatar.logout‚   s>   € ØˆŒØŸ™×-Ñ-Ö/ˆHÜ�GŠGÐ&¨Õ1Ô2Ø×"Ñ"Ö$ó 0r%   )rB   rA   rm   N)r    r!   r"   r#   r8   r   Úskiprm   r.   rP   rV   re   rj   r2   r$   r9   r:   s   @r&   r1   r1   G   s=   ø‡ € ñ÷ Ø0ˆà€Iò
@òòòò"÷%ð %r%   r1   c                   óH   a € ] tR t^‰t o RtR tR tR tR tR t	R t
RtV tR	# )
ÚConchSessionForTestAvatarz*
An ISession adapter for ConchTestAvatar.
c                óž   € Wn         W P                   n        RV n        RV n        RV n        ^ V n        \        P                  ! 4       V n        R# )zY
Initialize the session and create a reference to it on the avatar for
later inspection.
NF)	r   Ú_testSessionÚcmdÚprotoÚptyReqÚeofr   ÚDeferredÚonClose)r-   r   s   &&r&   r.   Ú"ConchSessionForTestAvatar.__init__Ž   s=   € ð
 ŒØ#'�‰Ô ØˆŒØˆŒ
ØˆŒØˆŒÜ—~’~Ó'ˆŽr%   c                óX   € \         P                  ! R 4       Wn        W n        RV n        R# )zpty reqTN)r   ro   Ú_terminalTypeÚ_windowSizerx   )r-   ÚtermÚ
windowSizeÚattrss   &&&&r&   ÚgetPtyÚ ConchSessionForTestAvatar.getPty›   s!   € Ü�Š�	ÔØ!ÔØ%ÔØˆŽr%   c                ób   € \         P                  ! R 4       Wn        \        V4       RV n        R# )zopening shelló   shellN)r   ro   rw   ÚEchoTransportrv   )r-   rw   s   &&r&   Ú	openShellÚ#ConchSessionForTestAvatar.openShell¡   s"   € Ü�Š�Ô ØŒ
Ü�eÔØˆŽr%   c                óŒ  € W n         Wn        VP                  4       ^ ,          pVR8X  d.   \        V4      p\        P
                  ! ^ VP                  4       MÇVR8X  d5   \        V4      pVP                  VR,          4       VP                  4        MŒVR8X  d5   \        V4      pVP                  VR,          4       VP                  4        MQVR8X  d5   \        V4      pVP                  VR,          4       VP                  4        M\        P                  ! R4      h^V P                  P                  P                  n        R# )	é    ó   falses   echo:é   NNs   secho:é   NNs   eechoúbad execN)rv   rw   ÚsplitÚFalseTransportr   Ú	callLaterÚloseConnectionr‡   ÚwriteÚSuperEchoTransportÚErrEchoTransportr   Ú
ConchErrorr   r]   Ú	transportÚexpectedLoseConnection)r-   rw   rv   ÚfÚts   &&&  r&   ÚexecCommandÚ%ConchSessionForTestAvatar.execCommand§   sô   € ØŒØŒ
Ø�I‰I‹K˜�NˆØ�Œ=Ü˜uÓ%ˆAô ×Ò˜a ×!1Ñ!1Õ2Ø�'Œ\Ü˜eÓ$ˆAØ�G‰G�C˜•GÔØ×ÑÕØ�(Œ]Ü" 5Ó)ˆAØ�G‰G�C˜•GÔØ×ÑÕØ�(Œ]Ü  Ó'ˆAØ�G‰G�C˜•GÔØ×ÑÕä×"Ò" :Ó.Ð.Ø<=ˆ�‰×Ñ×"Ñ"Ö9r%   c                ó   € ^V n         R# )rT   N)ry   rI   s   &r&   ÚeofReceivedÚ%ConchSessionForTestAvatar.eofReceivedÀ   s	   € ØˆŽr%   c                óÔ   € \         P                  ! R V P                  ,          4       V P                  P                  P
                  V n        V P                  P                  R4       R# )zclosed cmd "%s"N)	r   ro   rv   rw   r   ÚremoteWindowLeftÚremoteWindowLeftAtCloser{   ÚcallbackrI   s   &r&   ÚclosedÚ ConchSessionForTestAvatar.closedÃ   sB   € Ü�ŠÐ! D§H¡HÕ,Ô-Ø'+§z¡z×'9Ñ'9×'JÑ'JˆÔ$Ø�‰×Ñ˜dÖ#r%   )	r~   r   r   rv   ry   r{   rw   rx   r£   N)r    r!   r"   r#   r8   r.   rƒ   rˆ   rœ   rŸ   r¥   r$   r9   r:   s   @r&   rs   rs   ‰   s-   ø‡ € ñò(òòò>ò2÷$ð $r%   rs   )Ú
componentsc                   ó,   a € ] tR t^Ñt o R tR tRtV tR# )rH   c                ó   € R # r+   r   )r-   ÚargsÚkws   &*,r&   r.   ÚCrazySubsystem.__init__Ò   s   € Ùr%   c                ó   € R# )z
good ... good
Nr   rI   s   &r&   ÚconnectionMadeÚCrazySubsystem.connectionMadeÕ   s   ‚ r%   r   N)r    r!   r"   r#   r.   r®   r$   r9   r:   s   @r&   rH   rH   Ñ   s   ø‡ € ò÷ð r%   rH   c                   ó0   a € ] tR t^Ût o RtR tR tRtV tR# )r‘   a  
False transport should act like a /bin/false execution, i.e. just exit with
nonzero status, writing nothing to the terminal.

@ivar proto: The protocol associated with this transport.
@ivar closed: A flag tracking whether C{loseConnection} has been called yet.
c                óB   € Wn         VP                  V 4       ^ V n        R# )zI
@type p L{twisted.conch.ssh.session.SSHSessionProcessProtocol} instance
N©rw   ÚmakeConnectionr¥   ©r-   Úps   &&r&   r.   ÚFalseTransport.__init__ä   s   € ð Œ
Ø	×Ñ˜ÔØˆŽr%   c           	     óL  € V P                   '       d   R# ^V n         V P                  P                  4        V P                  P                  4        V P                  P	                  4        V P                  P                  \        P                  ! \        ^ÿRR4      4      4       R# )z9
Disconnect the protocol associated with this transport.
N©	r¥   rw   ÚinConnectionLostÚoutConnectionLostÚerrConnectionLostÚprocessEndedr   ÚFailurer   rI   s   &r&   r“   ÚFalseTransport.loseConnectionì   sl   € ð �;�;ˆ;ÙØˆŒØ�
‰
×#Ñ#Ô%Ø�
‰
×$Ñ$Ô&Ø�
‰
×$Ñ$Ô&Ø�
‰
×Ñ¤§¢Ô0AÀ#ÀtÈTÓ0RÓ SÖTr%   ©r¥   rw   N)	r    r!   r"   r#   r8   r.   r“   r$   r9   r:   s   @r&   r‘   r‘   Û   s   ø‡ € ñò÷
Uð 
Ur%   r‘   c                   ó2   a € ] tR t^ùt o R tR tR tRtV tR# )r‡   c                óB   € Wn         VP                  V 4       ^ V n        R# ©r‹   Nr²   r´   s   &&r&   r.   ÚEchoTransport.__init__ú   ó   € ØŒ
Ø	×Ñ˜ÔØˆŽr%   c                óâ   € \         P                  ! \        V4      4       V P                  P	                  V4       V P                  P	                  R 4       RV9   d   V P                  4        R# R# )ó   
ó    N)r   ro   Úreprrw   ÚoutReceivedr“   rN   s   &&r&   r”   ÚEchoTransport.writeÿ   sN   € Ü�Š”�T“
ÔØ�
‰
×Ñ˜tÔ$Ø�
‰
×Ñ˜wÔ'Ø�dŒ?Ø×ÑÖ!ñ r%   c           	     óL  € V P                   '       d   R # ^V n         V P                  P                  4        V P                  P                  4        V P                  P	                  4        V P                  P                  \        P                  ! \        ^ R R 4      4      4       R # r+   r¸   rI   s   &r&   r“   ÚEchoTransport.loseConnection  ój   € Ø�;�;ˆ;ÙØˆŒØ�
‰
×#Ñ#Ô%Ø�
‰
×$Ñ$Ô&Ø�
‰
×$Ñ$Ô&Ø�
‰
×Ñ¤§¢Ô0AÀ!ÀTÈ4Ó0PÓ QÖRr%   r¿   N©	r    r!   r"   r#   r.   r”   r“   r$   r9   r:   s   @r&   r‡   r‡   ù   s   ø‡ € òò
"÷Sð Sr%   r‡   c                   ó2   a € ] tR tRt o R tR tR tRtV tR# )r–   i  c                óB   € Wn         VP                  V 4       ^ V n        R# rÂ   r²   r´   s   &&r&   r.   ÚErrEchoTransport.__init__  rÄ   r%   c                ór   € V P                   P                  V4       V P                   P                  R 4       R# ©rÆ   N)rw   ÚerrReceivedrN   s   &&r&   r”   ÚErrEchoTransport.write  s&   € Ø�
‰
×Ñ˜tÔ$Ø�
‰
×Ñ˜wÖ'r%   c           	     óL  € V P                   '       d   R # ^V n         V P                  P                  4        V P                  P                  4        V P                  P	                  4        V P                  P                  \        P                  ! \        ^ R R 4      4      4       R # r+   r¸   rI   s   &r&   r“   ÚErrEchoTransport.loseConnection  rÍ   r%   r¿   NrÎ   r:   s   @r&   r–   r–     s   ø‡ € òò
(÷Sð Sr%   r–   c                   ó2   a € ] tR tRt o R tR tR tRtV tR# )r•   i$  c                óB   € Wn         VP                  V 4       ^ V n        R# rÂ   r²   r´   s   &&r&   r.   ÚSuperEchoTransport.__init__%  rÄ   r%   c                óÞ   € V P                   P                  V4       V P                   P                  R 4       V P                   P                  V4       V P                   P                  R 4       R# rÓ   )rw   rÉ   rÔ   rN   s   &&r&   r”   ÚSuperEchoTransport.write*  sJ   € Ø�
‰
×Ñ˜tÔ$Ø�
‰
×Ñ˜wÔ'Ø�
‰
×Ñ˜tÔ$Ø�
‰
×Ñ˜wÖ'r%   c           	     óL  € V P                   '       d   R # ^V n         V P                  P                  4        V P                  P                  4        V P                  P	                  4        V P                  P                  \        P                  ! \        ^ R R 4      4      4       R # r+   r¸   rI   s   &r&   r“   Ú!SuperEchoTransport.loseConnection0  rÍ   r%   r¿   NrÎ   r:   s   @r&   r•   r•   $  s   ø‡ € òò
(÷Sð Sr%   r•   )Úcheckers)ÚchannelÚ
connectionÚfactoryÚkeysr˜   Úuserauthc                   ó@   a € ] tR tRt o ]P
                  3tR tRtV t	R# )ÚConchTestPasswordCheckeriE  c                óÄ   € VP                   R 8X  d2   VP                  R8X  d!   \        P                  ! VP                   4      # \        P                  ! \        R4      4      # )ó   testuseró   testpasszBad credentials)ÚusernameÚpasswordr   ÚsucceedÚfailÚ	Exception)r-   Úcredentialss   &&r&   ÚrequestAvatarIdÚ(ConchTestPasswordChecker.requestAvatarIdH  sH   € à×$Ñ$¨Ô3Ø×(Ñ(¨KÔ7ä—}’} [×%9Ñ%9Ó:Ð:Ü—:’:œiÐ(9Ó:Ó;Ð;r%   r   N)
r    r!   r"   r#   rß   ÚIUsernamePasswordÚcredentialInterfacesrð   r$   r9   r:   s   @r&   ræ   ræ   E  s   ø‡ € Ø (× :Ñ :Ð<Ð÷	<ð 	<r%   ræ   c                   ó&   a € ] tR tRt o R tRtV tR# )ÚConchTestSSHCheckeriP  c                óZ   € VR 8w  g"   \        V P                  V,          4      ^8  d   R# R# )rè   FT)ÚlenÚsuccessfulCredentials)r-   ÚavatarIds   &&r&   ÚareDoneÚConchTestSSHChecker.areDoneQ  s(   € Ø˜;Ô&¬#¨d×.HÑ.HÈÕ.RÓ*SÐVWÔ*WÙÙr%   r   N)r    r!   r"   r#   rú   r$   r9   r:   s   @r&   rõ   rõ   P  s   ø‡ € ÷	ð 	r%   rõ   c                   ó‚   a € ] tR tRt o RtR]P                  R]P                  /t	R t
R tR tV 3R lR	 ltR
 tRtV tR# )ÚConchTestServerFactoryiV  Fs   ssh-userauthó   ssh-connectionc                óþ   € \        4       p\        \        P                  ! R  V P                  P                  4        4       4      4      Vn        Wn        \        V R4      '       d   V P                  Vn	        W n
        V# )c              3   óB   "  € T F  pVP                  4       x € K  	  R # 5ir+   )ÚsupportedSignatureAlgorithms)Ú.0Úkeys   & r&   Ú	<genexpr>Ú7ConchTestServerFactory.buildProtocol.<locals>.<genexpr>a  s#   é € ð $á8˜ð ×4Ñ4×6Ð6Û8ùs   ‚r™   )ÚConchTestServerÚlistr   Úfrom_iterableÚprivateKeysrn   ÚsupportedPublicKeysrâ   Úhasattrr™   rw   )r-   Úaddrrw   s   && r&   ÚbuildProtocolÚ$ConchTestServerFactory.buildProtocol^  sn   € Ü#Ó%ˆEÜ(,Ü×#Ò#ñ $à#×/Ñ/×6Ñ6Ô8ó$ó ó)ˆEÔ%ð !ŒMä�tÐ5×6Ò6Ø/3×/JÑ/J�Ô,àŒJØˆLr%   c                ó’   € R \         P                  P                  \        4      R\         P                  P                  \        4      /# ©ó   ssh-rsaó   ssh-dss©rã   ÚKeyÚ
fromStringr	   r   rI   s   &r&   ÚgetPublicKeysÚ$ConchTestServerFactory.getPublicKeysn  s6   € àœDŸH™H×/Ñ/Ô0AÓBØœDŸH™H×/Ñ/Ô0AÓBðð r%   c                ó’   € R \         P                  P                  \        4      R\         P                  P                  \        4      /# r  ©rã   r  r  r   r   rI   s   &r&   ÚgetPrivateKeysÚ%ConchTestServerFactory.getPrivateKeyst  s6   € àœDŸH™H×/Ñ/Ô0BÓCØœDŸH™H×/Ñ/Ô0BÓCðð r%   c                ó\   <€ V ^8„  d   QhRS[ S[S[S[S[S[3,          ,          3,          /# )é   Úreturn)r   Úintr   r   )Úformatr;   s   "€r&   Ú__annotate__Ú#ConchTestServerFactory.__annotate__z  s.   ø€ ÷ 	Yñ 	Y™t¡C©©e±C¹°H­oÕ)>Ð$>Õ?ñ 	Yr%   c                ó4   € R\         P                  ! R4      ./# )zÝ
Diffie-Hellman primes that can be used for the
diffie-hellman-group-exchange-sha1 key exchange.

@return: The primes and generators.
@rtype: L{dict} mapping the key size to a C{list} of
    C{(generator, prime)} tupple.
i   s   diffie-hellman-group14-sha1)r   ÚgetDHGeneratorAndPrimerI   s   &r&   Ú	getPrimesÚ ConchTestServerFactory.getPrimesz  s   € ð œ4×6Ò6Ð7UÓVÐWÐXÐXr%   c                óB   € \         P                  P                  WV4      # r+   )râ   Ú
SSHFactoryÚ
getService)r-   ÚtransÚnames   &&&r&   r)  Ú!ConchTestServerFactory.getService‰  s   € Ü×%Ñ%×0Ñ0°¸dÓCÐCr%   )rw   N)r    r!   r"   r#   Únoisyrä   ÚSSHUserAuthServerrá   ÚSSHConnectionÚservicesr  r  r  r%  r)  r$   r9   r:   s   @r&   rý   rý   V  sP   ø‡ € Øˆð ˜X×7Ñ7Ø˜z×7Ñ7ð
ˆò
	ò 	ò	÷	Yð 	Y÷	Dð 	Dr%   rý   c                   ó6   a € ] tR tRt o ^ tR tR tR tRtV t	R# )ÚConchTestBaseiŒ  c                ó˜   € V P                   '       d   R # \        V R4      '       g   \        P                  ! RV  RV 24      h^V n         R # )Nr™   zunexpectedly lost connection Ú
)Údoner  r   ÚFailTest©r-   Úreasons   &&r&   ÚconnectionLostÚConchTestBase.connectionLost�  sH   € Ø�y�yˆyÙÜ˜4Ð!9×:Ò:Ü×'Ò'Ø3°D°6¸¸F¸8ÐDóð ð ˆDŽIr%   c           
     ó´   € ^V n         V\        P                  8w  d,   \        P                  ! \        RV : RV: RV: 24      4       V P                  4        R# )rT   zgot disconnect for z	: reason z, desc: N)r™   r˜   ÚDISCONNECT_BY_APPLICATIONr   r`   rî   r“   )r-   Ú
reasonCodeÚdescs   &&&r&   ÚreceiveErrorÚConchTestBase.receiveError˜  sH   € Ø*+ˆDÔ'ð œY×@Ñ@Ô@Ü—’Ýã£ªTð3óôð ×ÑÖ!r%   c                ó4   € \         P                  ! R V 24      h)zgot unimplemented: seqid )r   r6  )r-   ÚseqIDs   &&r&   ÚreceiveUnimplementedÚ"ConchTestBase.receiveUnimplemented¨  s   € Ü×#Ò#Ð&?À¸wÐ$GÓHÐHr%   )r5  r™   N)
r    r!   r"   r#   r5  r9  r?  rC  r$   r9   r:   s   @r&   r2  r2  Œ  s    ø‡ € Øˆò	ò	"÷ 	Ið 	Ir%   r2  c                   ó&   a € ] tR tRt o R tRtV tR# )r  i«  c                ón   € \         P                  W4       \        P                  P                  W4       R # r+   )r2  r9  r˜   ÚSSHServerTransportr7  s   &&r&   r9  ÚConchTestServer.connectionLost¬  ó$   € Ü×(Ñ(¨Ô6Ü×(Ñ(×7Ñ7¸ÖEr%   r   N)r    r!   r"   r#   r9  r$   r9   r:   s   @r&   r  r  «  s   ø‡ € ÷	Fð 	Fr%   r  c                   ó<   a € ] tR tRt o RtR tR tR tR tRt	V t
R# )	ÚConchTestClienti°  z�
@ivar _channelFactory: A callable which accepts an SSH connection and
    returns a channel which will be attached to a new channel on that
    connection.
c                ó   € Wn         R # r+   ©Ú_channelFactory©r-   ÚchannelFactorys   &&r&   r.   ÚConchTestClient.__init__·  s   € Ø#1Ö r%   c                ón   € \         P                  W4       \        P                  P                  W4       R # r+   )r2  r9  r˜   ÚSSHClientTransportr7  s   &&r&   r9  ÚConchTestClient.connectionLostº  rI  r%   c                óþ   € V\         P                  P                  \        4      P	                  4       8H  pVR 8H  pV'       d   V'       d   \
        P                  ! ^4      # \
        P                  ! \        R4      4      # )s/   85:25:04:32:58:55:96:9f:57:ee:fb:a8:1a:ea:69:dazKey or fingerprint mismatch)	rã   r  r  r	   Úblobr   rì   rí   rî   )r-   r  ÚfpÚkeyMatchÚfingerprintMatchs   &&&  r&   ÚverifyHostKeyÚConchTestClient.verifyHostKey¾  s[   € ØœdŸh™h×1Ñ1Ô2CÓD×IÑIÓKÑKˆHØ!Ð%WÑWÐß×,Ü—}’} QÓ'Ð'Ü—:’:œiÐ(EÓFÓGÐGr%   c                ób   € V P                  \        R \        V P                  4      4      4       R# )rè   N)ÚrequestServiceÚConchTestClientAuthÚConchTestClientConnectionrN  rI   s   &r&   ÚconnectionSecureÚ ConchTestClient.connectionSecureÅ  s)   € Ø×ÑÜ#ØÔ!:¸4×;OÑ;OÓ!Póör%   rM  N)r    r!   r"   r#   r8   r.   r9  rZ  r`  r$   r9   r:   s   @r&   rK  rK  °  s%   ø‡ € ñ	ò	2ò	Fò	H÷	ð 	r%   rK  c                   óD   a € ] tR tRt o ^ t^ t^ tR tR tR t	R t
RtV tR# )r^  iÌ  c                ó¸   € V P                   '       g)   V P                  '       d   \        P                  ! R 4      h\        P
                  P                  W4       R# )z2got USERAUTH_SUCCESS before password and publickeyN)ÚcanSucceedPasswordÚcanSucceedPublicKeyr   r6  rä   ÚSSHUserAuthClientÚssh_USERAUTH_SUCCESS)r-   Úpackets   &&r&   rg  Ú(ConchTestClientAuth.ssh_USERAUTH_SUCCESSÑ  sE   € Ø×*×*Ð*¨t×/G×/GÐ/GÜ×'Ò'ØHóð ô ×&Ñ&×;Ñ;¸DÖIr%   c                ó<   € ^V n         \        P                  ! R4      # )rT   ré   )rd  r   rì   rI   s   &r&   ÚgetPasswordÚConchTestClientAuth.getPasswordØ  s   € Ø&'ˆDÔ#Ü—=’= Ó-Ð-r%   c                ó~   € ^V n         \        P                  ! \        P                  P                  \        4      4      # )rT   )re  r   rì   rã   r  r  r   rI   s   &r&   ÚgetPrivateKeyÚ!ConchTestClientAuth.getPrivateKeyÜ  s)   € Ø'(ˆDÔ$Ü—=’=¤§¡×!4Ñ!4Ô5GÓ!HÓIÐIr%   c                óH   € \         P                  P                  \        4      # r+   ©rã   r  r  r	   rI   s   &r&   ÚgetPublicKeyÚ ConchTestClientAuth.getPublicKeyà  s   € Ü—8‘8×&Ñ&Ô'8Ó9Ð9r%   )rd  re  N)r    r!   r"   r#   ÚhasTriedNonere  rd  rg  rk  rn  rr  r$   r9   r:   s   @r&   r^  r^  Ì  s1   ø‡ € ØˆØÐØÐò	Jò	.ò	J÷	:ð 	:r%   r^  c                   ó<   a € ] tR tRt o RtRt^ t^tR tR t	Rt
V tR# )r_  iã  zw
@ivar _completed: A L{Deferred} which will be fired when the number of
    results collected reaches C{totalResults}.
rþ   c                óP   € \         P                  P                  V 4       Wn        R # r+   )rá   r/  r.   rN  rO  s   &&r&   r.   Ú"ConchTestClientConnection.__init__í  s   € Ü×$Ñ$×-Ñ-¨dÔ3Ø#1Ö r%   c                óH   € V P                  V P                  V R 7      4       R# )©r]   N)ÚopenChannelrN  rI   s   &r&   ÚserviceStartedÚ(ConchTestClientConnection.serviceStartedñ  s   € Ø×Ñ˜T×1Ñ1°tÐ1Ó<Ö=r%   rM  N)r    r!   r"   r#   r8   r+  ÚresultsÚtotalResultsr.   r{  r$   r9   r:   s   @r&   r_  r_  ã  s*   ø‡ € ñ	ð
 !ˆØˆØˆò	2÷	>ð 	>r%   r_  c                   óP   a € ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
tV tR# )ÚSSHTestChanneliô  c                ó¶   € Wn         W n        . V n        . V n        \        P
                  ! 4       V n        \        P                  P                  ! V .VO5/ VB  R # r+   )
r+  Ú_openedÚreceivedÚreceivedExtr   rz   r{   rà   Ú
SSHChannelr.   )r-   r+  Úopenedrª   Úkwargss   &&&*,r&   r.   ÚSSHTestChannel.__init__õ  sG   € ØŒIØ!ŒLØˆDŒMØ!ˆDÔÜ Ÿ>š>Ó+ˆDŒLÜ×Ñ×'Ò'¨Ð>¨tÒ>°vÔ>r%   c                ó<   € V P                   P                  V4       R # r+   )r‚  Úerrbackr7  s   &&r&   Ú
openFailedÚSSHTestChannel.openFailedý  s   € Ø�L‰L× Ñ  Ö(r%   c                ó<   € V P                   P                  V 4       R # r+   )r‚  r¤   )r-   Úignores   &&r&   ÚchannelOpenÚSSHTestChannel.channelOpen   ó   € Ø�L‰L×!Ñ! $Ö'r%   c                ó<   € V P                   P                  V4       R # r+   )rƒ  ÚappendrN   s   &&r&   ÚdataReceivedÚSSHTestChannel.dataReceived  s   € Ø�M‰M× Ñ  Ö&r%   c                óž   € V\         P                  8X  d   V P                  P                  V4       R# \        P
                  ! R V: 24       R# )zUnrecognized extended data: N)rá   ÚEXTENDED_DATA_STDERRr„  r“  r   ro   )r-   ÚdataTyperO   s   &&&r&   ÚextReceivedÚSSHTestChannel.extReceived  s8   € Øœ:×:Ñ:Ô:Ø× Ñ ×'Ñ'¨Ö-ä—’Ð6°x±lÐCÖDr%   c                óB   € \         P                  ! R V4      w  V n        R# )z>LN)ÚstructÚunpackÚstatus)r-   rž  s   &&r&   Úrequest_exit_statusÚ"SSHTestChannel.request_exit_status  s   € Ü"ŸMšM¨$°Ó7‰MˆTŽ[r%   c                ó   € R V n         R# )TN)Ú	eofCalledrI   s   &r&   rŸ   ÚSSHTestChannel.eofReceived  s	   € Ø!ˆDŽNr%   c                ó<   € V P                   P                  R 4       R # r+   )r{   r¤   rI   s   &r&   r¥   ÚSSHTestChannel.closed  r‘  r%   )r‚  r¢  r+  r{   rƒ  r„  rž  N)r    r!   r"   r#   r.   r‹  r�  r”  r™  rŸ  rŸ   r¥   r$   r9   r:   s   @r&   r€  r€  ô  s3   ø‡ € ò	?ò	)ò	(ò	'ò	Eò	8ò	"÷	(ð 	(r%   r€  c                 ó¢   € \         P                  ! R\        P                  P	                  \
        4      ./4      p \         P                  ! V 4      # )z”
Produces a SSHPublicKeyChecker with an in-memory key mapping with
a single use: 'testuser'

@return: L{twisted.conch.checkers.SSHPublicKeyChecker}
rè   )rß   ÚInMemorySSHKeyDBrã   r  r  r	   ÚSSHPublicKeyChecker)ÚconchTestPublicKeyDBs    r&   ÚconchTestPublicKeyCheckerrª    sD   € ô  (×8Ò8Øœ4Ÿ8™8×.Ñ.Ô/@ÓAÐBÐCó 
Ðô ×+Ò+Ð,@ÓAÐAr%   c                   ór   a € ] tR tRt o Rt]'       g   RtRR ltR tR t	R t
R tR	 tR
 tR tR tRtV tR# )ÚSSHProtocolTestsi"  zR
Tests for communication between L{SSHServerTransport} and
L{SSHClientTransport}.
úcan't run without cryptographyc                óÄ  aaa€ \         P                  ! 4       o\        R4      V n        \        P
                  ! V P                  4      p\        4       pVP                  \        4       4       VP                  \        4       4       VP                  V4       \        4       pW5n        VP                  4        VP                  R4      V n        \        V P                  4      V n        \!        VVV3R l4      V n        \        V P"                  4      V n        V P                  P'                  V P$                  4       V P"                  P'                  V P                  4       S# )z¯
Create a connected SSH client and server protocol pair and return a
L{Deferred} which fires with an L{SSHTestChannel} instance connected to
a channel on that SSH connection.
rè   Nc                 ó"   <€ \        SS3R V /SB # ry  )r€  )r]   r‡  r+  Úresults   &€€€r&   Ú<lambda>Ú:SSHProtocolTests._ourServerOurClientTest.<locals>.<lambda>>  s   ø€ œ¨¨fÑJ¸4ÐJÀ6ÒJr%   )r   rz   r)   Úrealmr   ÚPortalrõ   ÚregisterCheckerræ   rª  rý   ÚstartFactoryr  Úserverr
   ÚclientTransportrK  ÚclientÚserverTransportr³   )r-   r+  r‡  rµ   ÚsshpcÚfacr°  s   &fl   @r&   Ú_ourServerOurClientTestÚ(SSHProtocolTests._ourServerOurClientTest+  sü   ú€ ô —’Ó!ˆÜ# KÓ0ˆŒ
Ü�MŠM˜$Ÿ*™*Ó%ˆÜ#Ó%ˆØ×ÑÔ6Ó8Ô9Ø×ÑÔ7Ó9Ô:Ø	×Ñ˜%Ô Ü$Ó&ˆØŒ
Ø×ÑÔØ×'Ñ'¨Ó-ˆŒÜ,¨T¯[©[Ó9ˆÔÜ%ÞJó
ˆŒô  -¨T¯[©[Ó9ˆÔà�‰×"Ñ" 4×#7Ñ#7Ô8Ø�‰×"Ñ" 4×#7Ñ#7Ô8Øˆr%   c                óè   a € S P                  4       pV 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V# )zÅ
Run the Conch server against the Conch client.  Set up several different
channels which exercise different behaviors and wait for them to
complete.  Verify that the channels with errors log them.
c           	      óž   <€ V Sn         SP                  V P                  P                  V R \        P
                  ! R4      ^4      \        4      # )ó	   subsystems	   not-crazy©rà   ÚassertFailurer]   ÚsendRequestr   ÚNSrî   ©rà   r-   s   &€r&   ÚcbSubsystemÚFSSHProtocolTests.test_subsystemsAndGlobalRequests.<locals>.cbSubsystemO  sF   ø€ Ø"ˆDŒLØ×%Ñ%Ø—‘×(Ñ(Ø˜\¬6¯9ª9°\Ó+BÀAóô ó	ð r%   c                 ó€   <€ SP                   pVP                  P                  VR \        P                  ! R4      ^4      # )rÁ  r@   ©rà   r]   rÄ  r   rÅ  ©Úignoredrà   r-   s   & €r&   ÚcbNotCrazyFailedÚKSSHProtocolTests.test_subsystemsAndGlobalRequests.<locals>.cbNotCrazyFailedZ  s5   ø€ Ø—l‘lˆGØ—<‘<×+Ñ+Ø˜¤v§y¢y°Ó':¸Aóð r%   c                 óZ  <€ SP                   pVP                  P                  R R^4      pVP                  P                  RR^4      pVP                  SP                  R4       SP                  VP                  P                  RR ^4      \        4      p\        P                  ! W#V.4      # )ó   fooó   bars   foo-2ó   bar2rU   )	rà   r]   ÚsendGlobalRequestÚaddCallbackÚassertEqualrÃ  rî   r   ÚgatherResults)rÌ  rà   Úd1Úd2Úd3r-   s   &    €r&   ÚcbGlobalRequestsÚKSSHProtocolTests.test_subsystemsAndGlobalRequests.<locals>.cbGlobalRequestsb  s�   ø€ Ø—l‘lˆGØ—‘×/Ñ/°¸ÀÓBˆBà—‘×/Ñ/°¸'À1ÓEˆBØ�N‰N˜4×+Ñ+¨WÔ5à×#Ñ#Ø—‘×.Ñ.¨v°v¸qÓAÄ9óˆBô ×&Ò&¨° |Ó4Ð4r%   c                 ó  <€ SP                  SP                  P                  P                  R RRR/4       SP                  pRVP
                  P                  n        VP
                  P                  4        VP                  ! 4        R# )rL   rÑ  rS   rÒ  TN)
rÕ  r³  r   rB   rà   r]   r˜   r™   ÚserviceStoppedr“   rË  s   & €r&   Ú
disconnectÚESSHProtocolTests.test_subsystemsAndGlobalRequests.<locals>.disconnectq  sh   ø€ Ø×ÑØ—
‘
×!Ñ!×0Ñ0°5¸&À'È7Ð2Sôð —l‘lˆGØ<@ˆG�L‰L×"Ñ"Ô9Ø�L‰L×'Ñ'Ô)Ø×"Ò"Ö$r%   ©r½  rÔ  )r-   rà   rÇ  rÍ  rÚ  rÞ  s   f     r&   Ú test_subsystemsAndGlobalRequestsÚ1SSHProtocolTests.test_subsystemsAndGlobalRequestsG  sn   ø€ ð ×.Ñ.Ó0ˆõ	ð 	×Ò˜KÔ(õ	ð 	×ÒÐ,Ô-õ	5ð 	×ÒÐ,Ô-õ	%ð 	×Ò˜JÔ'àˆr%   c                ó  a a€ S P                  4       p\        P                  ! RRR4      oVV 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V# )zs
L{SSHChannel.sendRequest} can open a shell with a I{pty-req} request,
specifying a terminal type and window size.
ó   conch-test-termr%   c                 óN   <€ V Sn         V P                  P                  V R S^4      # )s   pty-req)rà   r]   rÄ  )rà   rO   r-   s   &€€r&   Ú	cbChannelÚ.SSHProtocolTests.test_shell.<locals>.cbChannel‡  s%   ø€ Ø"ˆDŒLØ—<‘<×+Ñ+¨G°ZÀÀqÓIÐIr%   c                 óÔ  <€ SP                   P                  P                  P                  ^ ,          P                  pSP                  VP                  SP                   P                  4       SP                  VP                  R4       SP                  VP                  R4       SP                  VP                  4       SP                  pVP                  P                  VRR^4      # )r‹   rä  r†   r%   ©é   éP   r‹   r‹   )r³  r   r]   Úchannelsr   ÚassertIsrÕ  r~   r   Ú
assertTruerx   rà   rÄ  )rÌ  r   rà   r-   s   &  €r&   ÚcbPtyÚ*SSHProtocolTests.test_shell.<locals>.cbPty�  s¦   ø€ à—j‘j×'Ñ'×,Ñ,×5Ñ5°aÕ8×@Ñ@ˆGØ�M‰M˜'Ÿ.™.¨$¯*©*×*;Ñ*;Ô<Ø×Ñ˜W×2Ñ2Ð4FÔGØ×Ñ˜W×0Ñ0°.ÔAØ�O‰O˜GŸN™NÔ+Ø—l‘lˆGØ—<‘<×+Ñ+¨G°X¸sÀAÓFÐFr%   c                 ó@  <€ SP                   P                  R 4       SP                   P                  P                  SP                   4       \        P
                  ! SP                   P                  SP                  P                  P                  P                  .4      # )s   testing the shell! )
rà   r”   r]   ÚsendEOFr   rÖ  r{   r³  r   ru   ©rÌ  r-   s   &€r&   ÚcbShellÚ,SSHProtocolTests.test_shell.<locals>.cbShell™  sm   ø€ Ø�L‰L×ÑÐ8Ô9Ø�L‰L×Ñ×%Ñ% d§l¡lÔ3Ü×&Ò&Ø—‘×%Ñ% t§z¡z×'8Ñ'8×'EÑ'E×'MÑ'MÐNóð r%   c                 óÈ  <€ SP                   P                  ^ 8w  d3   \        P                  ! RSP                   P                  3,          4       SP	                  RP                  SP                   P                  4      R4       SP                  SP                   P                  4       SP                  SP                  P                  P                  P                  4       R# )r‹   zshell exit status was not 0: %ir%   s   testing the shell! 
N)rà   rž  r   ro   rÕ  Újoinrƒ  rî  r¢  r³  r   ru   ry   ró  s   &€r&   ÚcbExitedÚ-SSHProtocolTests.test_shell.<locals>.cbExited¢  s•   ø€ Ø�|‰|×"Ñ" aÔ'Ü—’Ð9¸T¿\¹\×=PÑ=PÐ<RÕRÔSØ×ÑØ—‘˜Ÿ™×.Ñ.Ó/Ð1Nôð �O‰O˜DŸL™L×2Ñ2Ô3Ø�O‰O˜DŸJ™J×-Ñ-×:Ñ:×>Ñ>Ö?r%   ré  )r½  r   ÚpackRequest_pty_reqrÔ  )r-   rà   ræ  rï  rô  rø  rO   s   f     @r&   Ú
test_shellÚSSHProtocolTests.test_shell~  s„   ù€ ð
 ×.Ñ.Ó0ˆä×*Ò*Ð+=¸~ÈsÓSˆö	Jð 	×Ò˜IÔ&õ	Gð 	×Ò˜EÔ"õ	ð 	×Ò˜GÔ$õ	@ð 	×Ò˜HÔ%Øˆr%   c                óˆ   a € S P                  4       pV 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V# )z‡
If L{SSHChannel.sendRequest} issues an exec which the server responds to
with an error, the L{Deferred} it returns fires its errback.
c           	      óž   <€ V Sn         SP                  V P                  P                  V R \        P
                  ! R4      ^4      \        4      # )ó   execs	   jumboliahrÂ  rÆ  s   &€r&   ræ  Ú3SSHProtocolTests.test_failedExec.<locals>.cbChannelµ  sB   ø€ Ø"ˆDŒLØ×%Ñ%Ø—‘×(Ñ(¨°'¼6¿9º9À\Ó;RÐTUÓVÜóð r%   c                 ó    <€ SP                  \        P                  4      pSP                  V^ ,          P                  P
                  R4       R# )r‹   N)r�   N)ÚflushLoggedErrorsr   r—   rÕ  Úvaluerª   ©rÌ  Úerrorsr-   s   & €r&   ÚcbFailedÚ2SSHProtocolTests.test_failedExec.<locals>.cbFailed¾  s:   ø€ ð ×+Ñ+¬E×,<Ñ,<Ó=ˆFØ×Ñ˜V A�YŸ_™_×1Ñ1Ð3EÖFr%   rà  )r-   rà   ræ  r  s   f   r&   Útest_failedExecÚ SSHProtocolTests.test_failedExec®  sC   ø€ ð
 ×.Ñ.Ó0ˆõ	ð 	×Ò˜IÔ&õ	Gð 	×Ò˜HÔ%Øˆr%   c                ó¸   a € S P                  4       pV 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V# )zy
When the process started by a L{SSHChannel.sendRequest} exec request
exits, the exit status is reported to the channel.
c                 óv   <€ V Sn         V P                  P                  V R \        P                  ! R4      ^4      # )rÿ  rŒ   rÊ  rÆ  s   &€r&   ræ  Ú5SSHProtocolTests.test_falseChannel.<locals>.cbChannelÎ  s/   ø€ Ø"ˆDŒLØ—<‘<×+Ñ+¨G°W¼f¿iºiÈÓ>QÐSTÓUÐUr%   c                 ó0   <€ SP                   P                  # r+   ©rà   r{   ró  s   &€r&   ÚcbExecÚ2SSHProtocolTests.test_falseChannel.<locals>.cbExecÔ  ó   ø€ Ø—<‘<×'Ñ'Ð'r%   c                 ó    <€ SP                  SP                  P                  . 4       SP                  SP                  P                  ^ 4       R# rÂ   )rÕ  rà   rƒ  ÚassertNotEqualrž  ró  s   &€r&   ÚcbClosedÚ4SSHProtocolTests.test_falseChannel.<locals>.cbClosedÙ  s7   ø€ à×Ñ˜TŸ\™\×2Ñ2°BÔ7Ø×Ñ §¡× 3Ñ 3°QÖ7r%   rà  ©r-   rà   ræ  r  r  s   f    r&   Útest_falseChannelÚ"SSHProtocolTests.test_falseChannelÇ  sX   ø€ ð
 ×.Ñ.Ó0ˆõ	Vð 	×Ò˜IÔ&õ	(ð 	×Ò˜FÔ#õ	8ð
 	×Ò˜HÔ%Øˆr%   c                ó¾   a € S P                  ^^R7      pV 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V# )zl
Bytes sent over the extended channel for stderr data are delivered to
the channel's C{extReceived} method.
©ÚlocalWindowÚlocalMaxPacketc                 óv   <€ V Sn         V P                  P                  V R \        P                  ! R4      ^4      # )rÿ  s   eecho hellorÊ  rÆ  s   &€r&   ræ  Ú5SSHProtocolTests.test_errorChannel.<locals>.cbChannelè  ó3   ø€ Ø"ˆDŒLØ—<‘<×+Ñ+Ø˜¤&§)¢)¨NÓ";¸Qóð r%   c                 ó¬   <€ \         P                  ! SP                  P                  SP                  P
                  P                  P                  .4      # r+   ©r   rÖ  rà   r{   r³  r   ru   ró  s   &€r&   r  Ú2SSHProtocolTests.test_errorChannel.<locals>.cbExecð  ó>   ø€ Ü×&Ò&Ø—‘×%Ñ% t§z¡z×'8Ñ'8×'EÑ'E×'MÑ'MÐNóð r%   c                 ó<  <€ SP                  SP                  P                  . 4       SP                  R P                  SP                  P                  4      R4       SP                  SP                  P
                  ^ 4       SP                  SP                  P                  4       SP                  SP                  P                  ^4       SP                  SP                  P                  SP                  P                  P                  P                  4       R# )r%   ó   hello
N)rÕ  rà   rƒ  r÷  r„  rž  rî  r¢  ÚlocalWindowLeftr³  r   ru   r£   ró  s   &€r&   r  Ú4SSHProtocolTests.test_errorChannel.<locals>.cbClosed÷  s¾   ø€ Ø×Ñ˜TŸ\™\×2Ñ2°BÔ7Ø×Ñ˜SŸX™X d§l¡l×&>Ñ&>Ó?ÀÔNØ×Ñ˜TŸ\™\×0Ñ0°!Ô4Ø�O‰O˜DŸL™L×2Ñ2Ô3Ø×Ñ˜TŸ\™\×9Ñ9¸1Ô=Ø×ÑØ—‘×,Ñ,Ø—
‘
×!Ñ!×.Ñ.×FÑFör%   rà  r  s   f    r&   Útest_errorChannelÚ"SSHProtocolTests.test_errorChannelá  s^   ø€ ð
 ×.Ñ.¸1ÈQÐ.ÓOˆõ	ð 	×Ò˜IÔ&õ	ð
 	×Ò˜FÔ#õ		ð 	×Ò˜HÔ%Øˆr%   c                ó€   a € S P                  S P                  R4      \        4      pV 3R lpVP                  V4       V# )zƒ
When an attempt is made to open an unknown channel type, the L{Deferred}
returned by L{SSHChannel.sendRequest} fires its errback.
s   crazy-unknown-channelc                 óÖ   <€ SP                  \        P                  4      pSP                  V^ ,          P                  P
                  R4       SP                  \        V4      ^4       R# )r‹   N)é   zunknown channel)r  r   r—   rÕ  r  rª   r÷   r  s   & €r&   r  Ú6SSHProtocolTests.test_unknownChannel.<locals>.cbFailed  sL   ø€ Ø×+Ñ+¬E×,<Ñ,<Ó=ˆFØ×Ñ˜V A�YŸ_™_×1Ñ1Ð3IÔJØ×ÑœS ›[¨!Ö,r%   )rÃ  r½  rî   rÔ  )r-   Údr  s   f  r&   Útest_unknownChannelÚ$SSHProtocolTests.test_unknownChannel  s>   ø€ ð
 ×ÑØ×(Ñ(Ð)AÓBÄIó
ˆõ	-ð
 	
�‰�hÔØˆr%   c                ó¾   a € S P                  ^^R7      pV 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V# )zK
An L{SSHChannel} can be configured with a maximum packet size to
receive.
r  c                 óv   <€ V Sn         V P                  P                  V R \        P                  ! R4      ^4      # )rÿ  s   secho hellorÊ  rÆ  s   &€r&   ræ  Ú2SSHProtocolTests.test_maxPacket.<locals>.cbChannel  r  r%   c                 ó0   <€ SP                   P                  # r+   r  ró  s   &€r&   r  Ú/SSHProtocolTests.test_maxPacket.<locals>.cbExec'  r  r%   c                 ó¾  <€ SP                  SP                  P                  ^ 4       SP                  RP                  SP                  P                  4      R4       SP                  RP                  SP                  P
                  4      R4       SP                  SP                  P                  ^4       SP                  SP                  P                  4       R# ©r‹   r%   r%  N)	rÕ  rà   rž  r÷  rƒ  r„  r&  rî  r¢  ró  s   &€r&   r  Ú1SSHProtocolTests.test_maxPacket.<locals>.cbClosed,  s“   ø€ Ø×Ñ˜TŸ\™\×0Ñ0°!Ô4Ø×Ñ˜SŸX™X d§l¡l×&;Ñ&;Ó<¸lÔKØ×Ñ˜SŸX™X d§l¡l×&>Ñ&>Ó?ÀÔNØ×Ñ˜TŸ\™\×9Ñ9¸2Ô>Ø�O‰O˜DŸL™L×2Ñ2Ö3r%   rà  r  s   f    r&   Útest_maxPacketÚSSHProtocolTests.test_maxPacket  s^   ø€ ð ×.Ñ.¸2ÈaÐ.ÓPˆõ	ð 	×Ò˜IÔ&õ	(ð 	×Ò˜FÔ#õ	4ð 	×Ò˜HÔ%Øˆr%   c                ó¾   a € S P                  ^^R7      pV 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V 3R lpVP                  ! V4       V# )zM
Normal standard out bytes are sent to the channel's C{dataReceived}
method.
r  c                 óv   <€ V Sn         V P                  P                  V R \        P                  ! R4      ^4      # )rÿ  s
   echo hellorÊ  rÆ  s   &€r&   ræ  Ú-SSHProtocolTests.test_echo.<locals>.cbChannel=  s3   ø€ Ø"ˆDŒLØ—<‘<×+Ñ+Ø˜¤&§)¢)¨MÓ":¸Aóð r%   c                 ó¬   <€ \         P                  ! SP                  P                  SP                  P
                  P                  P                  .4      # r+   r!  ró  s   &€r&   ÚcbEchoÚ*SSHProtocolTests.test_echo.<locals>.cbEchoE  r#  r%   c                 óð  <€ SP                  SP                  P                  ^ 4       SP                  RP                  SP                  P                  4      R4       SP                  SP                  P
                  ^4       SP                  SP                  P                  4       SP                  SP                  P
                  SP                  P                  P                  P                  4       R# r7  )rÕ  rà   rž  r÷  rƒ  r&  rî  r¢  r³  r   ru   r£   ró  s   &€r&   r  Ú,SSHProtocolTests.test_echo.<locals>.cbClosedL  s¤   ø€ Ø×Ñ˜TŸ\™\×0Ñ0°!Ô4Ø×Ñ˜SŸX™X d§l¡l×&;Ñ&;Ó<¸lÔKØ×Ñ˜TŸ\™\×9Ñ9¸1Ô=Ø�O‰O˜DŸL™L×2Ñ2Ô3Ø×ÑØ—‘×,Ñ,Ø—
‘
×!Ñ!×.Ñ.×FÑFör%   rà  )r-   rà   ræ  r?  r  s   f    r&   Ú	test_echoÚSSHProtocolTests.test_echo6  s^   ø€ ð
 ×.Ñ.¸1ÈQÐ.ÓOˆõ	ð 	×Ò˜IÔ&õ	ð
 	×Ò˜FÔ#õ	ð 	×Ò˜HÔ%Øˆr%   )rà   r¹  r¸  r³  r·  rº  N)r?   )r    r!   r"   r#   r8   r   rq   r½  rá  rû  r  r  r(  r/  r9  rC  r$   r9   r:   s   @r&   r¬  r¬  "  sJ   ø‡ € ñ÷
 Ø/ˆôò85òn.ò`ò2ò4"òHò"÷@!ð !r%   r¬  c                   ób   a € ] tR tRt o ]'       g   RtRR ltR tR tR t	R t
R	 tR
 tRtV tR# )ÚSSHFactoryTestsiZ  r­  Nc                óˆ   a€ \         P                  ! 4       pV3R  lVn        R Vn        R Vn        VP                  4        V# )c                  ó   <€ S # r+   r   ©Úprimess   €r&   r±  Ú0SSHFactoryTests.makeSSHFactory.<locals>.<lambda>`  s   ø€ ¡vr%   c                  óL   € R \         P                  P                  \        4      /# ©r  rq  r   r%   r&   r±  rK  a  s   € ØœŸ™×+Ñ+Ô,=Ó>ñ,
r%   c                  óL   € R \         P                  P                  \        4      /# rM  )rã   r  r  r   r   r%   r&   r±  rK  d  s   € ØœŸ™×+Ñ+Ô,>Ó?ñ-
r%   )râ   r(  r%  r  r  r¶  )r-   rJ  Ú
sshFactorys   &f r&   ÚmakeSSHFactoryÚSSHFactoryTests.makeSSHFactory^  sA   ø€ Ü×'Ò'Ó)ˆ
Ü-ˆ
Ôñ$
ˆ
Ô ñ%
ˆ
Ô!ð 	×ÑÔ!ØÐr%   c                óŠ   € V P                  4       pVP                  ! R4      pV P                  V\        P                  4       R# )zK
By default, buildProtocol() constructs an instance of
SSHServerTransport.
N)rP  r  ÚassertIsInstancer˜   rG  )r-   râ   r   s   &  r&   Útest_buildProtocolÚ"SSHFactoryTests.test_buildProtocolj  s8   € ð
 ×%Ñ%Ó'ˆØ×(Ò(¨Ó.ˆØ×Ñ˜h¬	×(DÑ(DÖEr%   c                óŽ   a€ . oV3R lpV P                  4       pWn        VP                  ! R4       V P                  R.S4       R# )zK
buildProtocol() calls 'self.protocol()' to construct a protocol
instance.
c                  óP   <€ SP                  V 4       \        P                  ! 4       # r+   )r“  r˜   rG  )rª   Úcallss   *€r&   ÚmakeProtocolÚHSSHFactoryTests.test_buildProtocolRespectsProtocol.<locals>.makeProtocolz  s   ø€ Ø�L‰L˜ÔÜ×/Ò/Ó1Ð1r%   Nr   )rP  r   r  rÕ  )r-   rY  râ   rX  s   &  @r&   Ú"test_buildProtocolRespectsProtocolÚ2SSHFactoryTests.test_buildProtocolRespectsProtocols  sE   ø€ ð
 ˆõ	2ð ×%Ñ%Ó'ˆØ'ÔØ×Ò˜dÔ#Ø×Ñ˜"˜˜uÖ%r%   c                óÎ   € \         P                  ! 4       pR Vn        R Vn        VP	                  4        VP                  R4      pV P                  . ROVP                  4       R# )zY
buildProtocol() sets supportedPublicKeys to the list of supported
signature algorithms.
c                  ó’   € R \         P                  P                  \        4      R\         P                  P                  \        4      /# r  r  r   r%   r&   r±  ÚGSSHFactoryTests.test_buildProtocolSignatureAlgorithms.<locals>.<lambda>‰  s1   € ØœŸ™×+Ñ+Ô,=Ó>ØœŸ™×+Ñ+Ô,=Ó>ñ#
r%   c                  ó’   € R \         P                  P                  \        4      R\         P                  P                  \        4      /# r  r  r   r%   r&   r±  r_  �  s1   € ØœŸ™×+Ñ+Ô,>Ó?ØœŸ™×+Ñ+Ô,>Ó?ñ$
r%   N)s   rsa-sha2-512s   rsa-sha2-256r  r  )râ   r(  r  r  r¶  r  rÕ  r
  )r-   rš   rµ   s   &  r&   Ú%test_buildProtocolSignatureAlgorithmsÚ5SSHFactoryTests.test_buildProtocolSignatureAlgorithmsƒ  sY   € ô
 ×ÒÓ ˆñ
ˆŒñ
ˆÔð 	
�‰ÔØ�O‰O˜DÓ!ˆØ×ÑÚFØ×!Ñ!ö	
r%   c                ó¼   € V P                  RR7      pVP                  R4      pV P                  RVP                  4       V P                  RVP                  4       R# )zO
Group key exchanges are not supported when we don't have the primes
database.
NrI  ó"   diffie-hellman-group-exchange-sha1ó$   diffie-hellman-group-exchange-sha256)rP  r  ÚassertNotInÚsupportedKeyExchanges)r-   Úf1Úp1s   &  r&   Útest_buildProtocolNoPrimesÚ*SSHFactoryTests.test_buildProtocolNoPrimes˜  s[   € ð
 × Ñ ¨Ð Ó-ˆà×Ñ˜dÓ#ˆà×ÑØ1°2×3KÑ3Kô	
ð 	×ÑØ3°R×5MÑ5Mö	
r%   c                óÀ   € V P                  ^R/R7      pVP                  R4      pV P                  RVP                  4       V P                  RVP                  4       R# )zE
Group key exchanges are supported when we have the primes database.
rI  Nrd  re  )r  r,  )rP  r  ÚassertInrg  ©r-   Úf2Úp2s   &  r&   Útest_buildProtocolWithPrimesÚ,SSHFactoryTests.test_buildProtocolWithPrimes¨  sU   € ð × Ñ ¨¨F¨Ð Ó4ˆà×Ñ˜dÓ#ˆà�‰Ð;¸R×=UÑ=UÔVØ�‰Ð=¸r×?WÑ?WÖXr%   c                óž   € V P                  4       pVP                  R4      pV P                  RRP                  VP                  4      4       R# )zO
ECDSA key exchanges are listed with 256 having a higher priority among ECDSA.
Ns8   ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521ó   ,)rP  r  rm  r÷  rg  rn  s   &  r&   Útest_buildProtocolKexECDSAÚ*SSHFactoryTests.test_buildProtocolKexECDSA³  sE   € ð × Ñ Ó"ˆà×Ñ˜dÓ#ˆð 	�‰ØGØ�I‰I�b×.Ñ.Ó/ö	
r%   r   r+   )r    r!   r"   r#   r   rq   rP  rT  r[  ra  rj  rq  ru  r$   r9   r:   s   @r&   rF  rF  Z  s7   ø‡ € ßØ/ˆô
òFò&ò 
ò*
ò 	Y÷
ð 
r%   rF  c                   óŠ   a € ] tR tRt o Rt]'       g   Rt]'       d   ]! ]P                  4      t	R t
R tR tR tR tR	tV tR
# )ÚMPTestsiÃ  zc
Tests for L{common.getMP}.

@cvar getMP: a method providing a MP parser.
@type getMP: C{callable}
r­  c                óH   € V P                  V P                  R4      R4       R# )z‡
L{common.getMP} should parse the a multiple precision integer from a
string: a 4-byte length followed by length bytes of the integer.
s         N)rT   r%   ©rÕ  ÚgetMPrI   s   &r&   Ú
test_getMPÚMPTests.test_getMPÑ  s   € ð
 	×Ñ˜Ÿ™Ð$GÓHÈ(ÖSr%   c                óH   € V P                  V P                  R4      R4       R# )z^
L{common.getMP} should be able to parse a big enough integer
(that doesn't fit on one byte).
s      N)ir%   rz  rI   s   &r&   Útest_getMPBigIntegerÚMPTests.test_getMPBigIntegerØ  s!   € ð
 	×ÑØ�J‰JÐ:Ó;¸_ö	
r%   c                óJ   € V P                  V P                  R^4      R4       R# )zO
L{common.getMP} has the ability to parse multiple integer in the same
string.
s               N)rT   r  r%   rz  rI   s   &r&   Útest_multipleGetMPÚMPTests.test_multipleGetMPá  s)   € ð
 	×ÑØ�J‰JØWØóð ö	
r%   c                óH   € V P                  V P                  R4      R4       R# )z]
When more data than needed is sent to L{common.getMP}, it should return
the remaining data.
s         fooN)rT   rÐ  rz  rI   s   &r&   Útest_getMPRemainingDataÚMPTests.test_getMPRemainingDataî  s!   € ð
 	×ÑØ�J‰JÐ=Ó>Àö	
r%   c                ó\   € V P                  \        P                  V P                  R4       R# )zi
When the string passed to L{common.getMP} doesn't even make 5 bytes,
it should raise a L{struct.error}.
s    N)ÚassertRaisesrœ  r   r{  rI   s   &r&   Útest_notEnoughDataÚMPTests.test_notEnoughData÷  s   € ð
 	×Ñœ&Ÿ,™,¨¯
©
°KÖ@r%   r   N)r    r!   r"   r#   r8   r   rq   Ústaticmethodr   r{  r|  r  r‚  r…  r‰  r$   r9   r:   s   @r&   rx  rx  Ã  sF   ø‡ € ñ÷ Ø/ˆçÙ˜VŸ\™\Ó*ˆòTò
ò
ò
÷Að Ar%   rx  c                   ó>   a € ] tR tRt o Rt]'       g   RtR tRtV t	R# )ÚGMPYInstallDeprecationTestsiÿ  zA
Tests for the deprecation of former GMPY accidental public API.
r=   c                óÞ   € \         P                  ! 4        V P                  V P                  .4      pV P	                  \        V4      ^4       V P	                  V^ ,          R,          R4       R# )z4
L{twisted.conch.ssh.common.install} is deprecated.
ÚmessagezAtwisted.conch.ssh.common.install was deprecated in Twisted 16.5.0N)r   ÚinstallÚflushWarningsÚtest_deprecatedrÕ  r÷   )r-   Úwarningss   & r&   r’  Ú+GMPYInstallDeprecationTests.test_deprecated  sX   € ô 	�ŠÔØ×%Ñ% t×';Ñ';Ð&<Ó=ˆØ×Ñœ˜X›¨Ô*Ø×ÑØ�Q�K˜	Õ"ØOö	
r%   r   N)
r    r!   r"   r#   r8   r   rq   r’  r$   r9   r:   s   @r&   r�  r�  ÿ  s   ø‡ € ñ÷ Ø0ˆ÷

ð 

r%   r�  )Sr8   rœ  Ú	itertoolsr   Útypingr   r   r   Útwisted.conch.test.keydatar   r   r   r	   Útwisted.conch.test.loopbackr
   Útwisted.credr   Útwisted.cred.errorr   Útwisted.internetr   r   r   Útwisted.internet.errorr   Útwisted.pythonr   r   Útwisted.python.reflectr   Útwisted.trialr   r   Útwisted.conchr   r   Útwisted.conch.sshr   r   r   r   r)   r'   r1   rs   r§   ÚregisterAdapterÚISessionÚProtocolrH   r‘   r‡   r–   r•   rß   rà   rá   râ   rã   r˜   rä   ræ   ÚSSHProtocolCheckerrõ   r(  rý   r2  rG  r  rS  rK  rf  r^  r/  r_  r…  r€  rª  ÚTestCaser¬  rF  rx  r�  r   r%   r&   Ú<module>r§     sö  ðñó
 Ý ß $Ñ $÷ó õ 6Ý Ý 0ß 5Ñ 5Ý 4ß 'Ý 0Ý "á˜^Ó,€çß+ßCÔC÷ñ ÷

ñ 
ô>?%�f×&Ñ&ô ?%÷D=$ñ =$õ@ &çØ×ÒØ! ?°G×4DÑ4Dôô
�X×&Ñ&ô ÷Uñ U÷<Sñ S÷.Sñ S÷(Sñ Sð, ÒÝ&÷÷ ÷	<ñ 	<ô˜h×9Ñ9ô ô4D ×!3Ñ!3ô 4D÷lIñ Iô>F˜-¨×)EÑ)Eô Fô
˜-¨×)EÑ)Eô ô8:˜h×8Ñ8ô :ô.> J×$<Ñ$<ô >ô"(˜×+Ñ+ô (òB
Bôu�x×(Ñ(ô uôp	f
�h×'Ñ'ô f
ôR9Aˆh×Ñô 9Aôx
 (×"3Ñ"3ö 
r%   