o
    >h^                  
   @   s  d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
mZmZ d dlmZ d dlmZ d dlmZmZmZ d d	lmZ d d
lmZ d dlmZmZmZ d dlmZ d dlm Z  d dl!m"Z" d dl#m$Z$m%Z% d dl&m'Z'm(Z( z
d dlm)Z)m*Z* W n	 e+y   Y nw e"dZ,e,rd dl-m.Z. d dl/m0Z0m1Z1m2Z2 nd dl3m0Z0 G dd dZ.zd dl4m1Z5 W n e+y Z6 zdZ7e8e6Z9[6W Y dZ6[6ndZ6[6ww e5Z7G dd dZ:G dd de(Z;G dd dej<Z=G dd  d ej>Z?G d!d" d"ej@ZAG d#d$ d$ej@ZBG d%d& d&ej<ZCd>d(d)ZDG d*d+ d+ZEG d,d- d-eEZFee0G d.d/ d/e.ZGG d0d1 d1ZHG d2d3 d3eEZIG d4d5 d5ZJG d6d7 d7eEeJe(ZKG d8d9 d9eFeJe(ZLG d:d; d;eIeJe(ZMG d<d= d=eFe(ZNdS )?    N)count)implementer)
ConchError)privateRSA_opensshpublicRSA_opensshConchTestRealm)portal)deferprotocolreactor)ProcessExitedAlready)LoopingCall)filepathlogruntime)FilePath)which)requireModule)HAS_IPV6skipWithoutIPv6)SkipTestTestCase)ConchTestServerFactoryconchTestPublicKeyCheckercryptography)	ConchUser)ISession
SSHSessionwrapProtocol)r   c                   @   s   e Zd ZdS )r   N)__name__
__module____qualname__ r#   r#   }/var/www/vedio/testing/chatpythonscript.ninositsolution.com/env/lib/python3.10/site-packages/twisted/conch/test/test_conch.pyr   +   s    r   )r   c                   @   s   e Zd ZdZdZdd ZdS )	FakeStdioz
    A fake for testing L{twisted.conch.scripts.conch.SSHSession.eofReceived} and
    L{twisted.conch.scripts.cftp.SSHSession.eofReceived}.

    @ivar writeConnLost: A flag which records whether L{loserWriteConnection}
        has been called.
    Fc                 C   s
   d| _ dS )z9
        Record the call to loseWriteConnection.
        TN)writeConnLostselfr#   r#   r$   loseWriteConnectionD   s   
zFakeStdio.loseWriteConnectionN)r    r!   r"   __doc__r&   r)   r#   r#   r#   r$   r%   9   s    r%   c                   @   s$   e Zd ZdZedu reZdd ZdS )StdioInteractingSessionTestsz>
    Tests for L{twisted.conch.scripts.conch.SSHSession}.
    Nc                 C   s*   t  }t }||_|  | |j dS )z}
        L{twisted.conch.scripts.conch.SSHSession.eofReceived} loses the
        write half of its stdio connection.
        N)r%   StdioInteractingSessionstdioeofReceived
assertTruer&   )r(   r-   channelr#   r#   r$   test_eofReceivedS   s
   z-StdioInteractingSessionTests.test_eofReceived)r    r!   r"   r*   r,   _reasonskipr1   r#   r#   r#   r$   r+   K   s
    r+   c                   @   s$   e Zd Zdd Zdd Zdd ZdS )Echoc                 C      t d d S )NzECHO CONNECTION MADEr   msgr'   r#   r#   r$   connectionMade`      zEcho.connectionMadec                 C   r5   )NzECHO CONNECTION DONEr6   r(   reasonr#   r#   r$   connectionLostc   r9   zEcho.connectionLostc                 C   s&   | j | d|v r| j   d S d S )N   
)	transportwriteloseConnectionr(   datar#   r#   r$   dataReceivedf   s   zEcho.dataReceivedN)r    r!   r"   r8   r<   rC   r#   r#   r#   r$   r4   _   s    r4   c                   @   s   e Zd ZeZdS )EchoFactoryN)r    r!   r"   r4   r   r#   r#   r#   r$   rD   l       rD   c                   @   s<   e Zd ZdZdZdZdZdd Zdd Zdd	 Z	d
d Z
dS )ConchTestOpenSSHProcessa  
    Test protocol for launching an OpenSSH client process.

    @ivar deferred: Set by whatever uses this object. Accessed using
    L{_getDeferred}, which destroys the value so the Deferred is not
    fired twice. Fires when the process is terminated.
    N    c                 C      | j d }| _ |S Ndeferredr(   dr#   r#   r$   _getDeferred}      z$ConchTestOpenSSHProcess._getDeferredc                 C      |  j |7  _ d S rI   )bufrA   r#   r#   r$   outReceived      z#ConchTestOpenSSHProcess.outReceivedc                 C   rP   rI   )problemsrA   r#   r#   r$   errReceived   rS   z#ConchTestOpenSSHProcess.errReceivedc              	   C   sV   |j jdkr|  td|j j| jd dS | j	dd}|  
| dS )z~
        Called when the process has ended.

        @param reason: a Failure giving the reason for the process' end.
        r   zexit code was not 0: {} ({})charmaps   
r=   N)valueexitCoderN   errbackr   formatrT   decoderQ   replacecallback)r(   r;   rQ   r#   r#   r$   processEnded   s   
	z$ConchTestOpenSSHProcess.processEnded)r    r!   r"   r*   rK   rQ   rT   rN   rR   rU   r^   r#   r#   r#   r$   rF   p   s    rF   c                   @   sT   e Zd ZdZdZdd Zdd Zdd Zd	d
 Zdd Z	dd Z
dd Zdd ZdS )ConchTestForwardingProcessa  
    Manages a third-party process which launches a server.

    Uses L{ConchTestForwardingPort} to connect to the third-party server.
    Once L{ConchTestForwardingPort} has disconnected, kill the process and fire
    a Deferred with the data received by the L{ConchTestForwardingPort}.

    @ivar deferred: Set by whatever uses this object. Accessed using
    L{_getDeferred}, which destroys the value so the Deferred is not
    fired twice. Fires when the process is terminated.
    Nc                 C   s   || _ d| _|| _dS )aF  
        @type port: L{int}
        @param port: The port on which the third-party server is listening.
        (it is assumed that the server is running on localhost).

        @type data: L{str}
        @param data: This is sent to the third-party server. Must end with '
'
        in order to trigger a disconnect.
        N)portbufferrB   )r(   r`   rB   r#   r#   r$   __init__   s   

z#ConchTestForwardingProcess.__init__c                 C   rH   rI   rJ   rL   r#   r#   r$   rN      rO   z'ConchTestForwardingProcess._getDeferredc                 C   s   |    d S rI   )_connectr'   r#   r#   r$   r8      s   z)ConchTestForwardingProcess.connectionMadec                 C   s0   t tt| | j}|d| j}|| j |S )a  
        Connect to the server, which is often a third-party process.
        Tries to reconnect if it fails because we have no way of determining
        exactly when the port becomes available for listening -- we can only
        know when the process starts.
        	127.0.0.1)	r   ClientCreatorr   ConchTestForwardingPortrB   
connectTCPr`   
addErrback
_ebConnect)r(   ccrM   r#   r#   r$   rc      s   z#ConchTestForwardingProcess._connectc                 C   s   t d| j d S )Ng?)r   	callLaterrc   )r(   fr#   r#   r$   ri      rS   z%ConchTestForwardingProcess._ebConnectc                 C   s.   || _ | jd | j  td| j dS )z
        The network connection has died; save the buffer of output
        from the network and attempt to quit the process gracefully,
        and then (after the reactor has spun) send it a KILL signal.
           r   N)ra   r>   r?   r@   r   rk   
_reallyDie)r(   ra   r#   r#   r$   forwardingPortDisconnected   s   
z5ConchTestForwardingProcess.forwardingPortDisconnectedc                 C   s(   z	| j d W d S  ty   Y d S w )NKILL)r>   signalProcessr   r'   r#   r#   r$   rn      s
   z%ConchTestForwardingProcess._reallyDiec                 C   s   |   | j dS )z
        Fire the Deferred at self.deferred with the data collected
        from the L{ConchTestForwardingPort} connection, if any.
        N)rN   r]   ra   r:   r#   r#   r$   r^      s   z'ConchTestForwardingProcess.processEnded)r    r!   r"   r*   rK   rb   rN   r8   rc   ri   ro   rn   r^   r#   r#   r#   r$   r_      s    r_   c                   @   s0   e Zd ZdZdd Zdd Zdd Zdd	 Zd
S )rf   z
    Connects to server launched by a third-party process (managed by
    L{ConchTestForwardingProcess}) sends data, then reports whatever it
    received back to the L{ConchTestForwardingProcess} once the connection
    is ended.
    c                 C   s   || _ || _dS )z
        @type protocol: L{ConchTestForwardingProcess}
        @param protocol: The L{ProcessProtocol} which made this connection.

        @type data: str
        @param data: The data to be sent to the third-party server.
        N)r   rB   )r(   r   rB   r#   r#   r$   rb      s   
z ConchTestForwardingPort.__init__c                 C   s   d| _ | j| j d S )NrG   )ra   r>   r?   rB   r'   r#   r#   r$   r8      s   z&ConchTestForwardingPort.connectionMadec                 C   rP   rI   )ra   rA   r#   r#   r$   rC      rS   z$ConchTestForwardingPort.dataReceivedc                 C   s   | j | j d S rI   )r   ro   ra   r:   r#   r#   r$   r<     rS   z&ConchTestForwardingPort.connectionLostN)r    r!   r"   r*   rb   r8   rC   r<   r#   r#   r#   r$   rf      s    rf   conchc                 C   sF   t jd| g}g }|t|  D ]}t|tr|d}|| q|S )Na$  -c
### Twisted Preamble
import sys, os
path = os.path.abspath(sys.argv[0])
while os.path.dirname(path) != path:
    if os.path.basename(path).startswith('Twisted'):
        sys.path.insert(0, path)
        break
    path = os.path.dirname(path)

from twisted.conch.scripts.%s import run
run()utf-8)sys
executablelist
isinstancestrencodeappend)argsmodstartmadeArgsargr#   r#   r$   	_makeArgs  s   

r   c                   @   sH   e Zd ZesdZedd Zdd Zdd Zdd	 Z	d
d Z
dd ZdS )ConchServerSetupMixinzcan't run without cryptographyc                   C   s   t dS )Ns   testuserr   r#   r#   r#   r$   realmFactory#  s   z"ConchServerSetupMixin.realmFactoryc                 C   s   dD ]}t j|rt | qtdd}|t W d    n1 s%w   Y  tdd}|t W d    n1 s?w   Y  t dd t	d
 }|jjsX|jjr\tdtdd}|dt  W d    d S 1 stw   Y  d S )	N)rsa_testrsa_test.pubkh_testr   wbr   i  zgprivate key readable by others despite chmod; possible windows permission issue? see https://tm.tl/9767r   s
   127.0.0.1 )ospathexistsremoveopenr?   r   r   chmodr   getPermissionsgroupreadotherr   )r(   rl   permissionsr#   r#   r$   _createFiles'  s&   
"z"ConchServerSetupMixin._createFilesc                 C   s*   t   }|d | d }|  |S )N) r      )socketbindgetsocknameclose)r(   sr`   r#   r#   r$   _getFreePort:  s
   
z"ConchServerSetupMixin._getFreePortc                 C   s.   |   }t|}|t  t }||_|S )z
        Make a L{ConchTestServerFactory}, which allows us to start a
        L{ConchTestServer} -- i.e. an actually listening conch.
        )r   r	   PortalregisterCheckerr   r   )r(   realmpfactoryr#   r#   r$   _makeConchFactoryA  s   
z'ConchServerSetupMixin._makeConchFactoryc                 C   sz   |    |  | _d| j_tjd| jdd| _tdt | _| j	 j
| _tr;tjdt dd| _| j	 j
| _d S d S )Nr   r   rd   )	interfacez::1)r   r   conchFactoryexpectedLoseConnectionr   	listenTCPconchServerrD   
echoServergetHostr`   echoPortr   echoServerV6
echoPortV6r'   r#   r#   r$   setUpM  s   
zConchServerSetupMixin.setUpc                 C   sn   zd| j j_W n	 ty   Y nw | j jj  t| jj	t| j
j	g}tr2|t| jj	 t|S )Nr   )r   protodoneAttributeErrorr>   r@   r
   maybeDeferredr   stopListeningr   r   rz   r   gatherResults)r(   	deferredsr#   r#   r$   tearDownZ  s   
zConchServerSetupMixin.tearDownN)r    r!   r"   r   r3   staticmethodr   r   r   r   r   r   r#   r#   r#   r$   r     s    
r   c                   @   s(   e Zd ZdZdd Zdd Zdd ZdS )	ForwardingMixina  
    Template class for tests of the Conch server's ability to forward arbitrary
    protocols over SSH.

    These tests are integration tests, not unit tests. They launch a Conch
    server, a custom TCP server (just an L{EchoProtocol}) and then call
    L{execute}.

    L{execute} is implemented by subclasses of L{ForwardingMixin}. It should
    cause an SSH client to connect to the Conch server, asking it to forward
    data to the custom TCP server.
    c                 C   s   |  dt }|| jdS )z
        Test that we can use whatever client to send the command "echo goodbye"
        to the Conch server. Make sure we receive "goodbye" back from the
        server.
        echo goodbye   goodbye
executerF   addCallbackassertEqualrL   r#   r#   r$   	test_execx  s   zForwardingMixin.test_execc                 C   >   |   }t|d}| jd|d|| jf d}|| jd |S )zy
        Test that we can use whatever client to forward a local port to a
        specified port on the server.
           test
r   z-N -L%i:127.0.0.1:%isshArgsr   r_   r   r   r   r   r(   	localPortprocessrM   r#   r#   r$   test_localToRemoteForwarding     
z,ForwardingMixin.test_localToRemoteForwardingc                 C   r   )zs
        Test that we can use whatever client to forward a port from the server
        to a port locally.
        r   r   z-N -R %i:127.0.0.1:%ir   r   r   r#   r#   r$   test_remoteToLocalForwarding  r   z,ForwardingMixin.test_remoteToLocalForwardingN)r    r!   r"   r*   r   r   r   r#   r#   r#   r$   r   j  s
    	r   c                   @   sH   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dS )RekeyAvatara#  
    This avatar implements a shell which sends 60 numbered lines to whatever
    connects to it, then closes the session with a 0 exit status.

    60 lines is selected as being enough to send more than 2kB of traffic, the
    amount the client is configured to initiate a rekey after.
    c                 C   s   t |  t| jd< d S )Ns   session)r   rb   r   channelLookupr'   r#   r#   r$   rb     s   
zRekeyAvatar.__init__c                    sH   t  }| t|  fdd}t|t   d dS )zE
        Write 60 lines of data to the transport, then exit.
        c                    sZ   t | }|dkr   jjjdd   d S d|f }|d}| d S )N<   s   exit-statuss       zline #%02d
rs   )nextstopsessionconnsendRequestr@   ry   r?   )counterilinecallr>   r#   r$   r?     s   

z$RekeyAvatar.openShell.<locals>.writeg{Gz?N)r   ProtocolmakeConnectionr   r   r   r}   )r(   r>   r   r?   r#   r   r$   	openShell  s   
zRekeyAvatar.openShellc                 C   s   dS )z2
        Ignore the close of the session.
        Nr#   r'   r#   r#   r$   closed      zRekeyAvatar.closedc                 C      d S rI   r#   r'   r#   r#   r$   r.        zRekeyAvatar.eofReceivedc                 C   r   rI   r#   )r(   r   commandr#   r#   r$   execCommand  r   zRekeyAvatar.execCommandc                 C   r   rI   r#   )r(   term
windowSizemodesr#   r#   r$   getPty  r   zRekeyAvatar.getPtyc                 C   r   rI   r#   )r(   newWindowSizer#   r#   r$   windowChanged  r   zRekeyAvatar.windowChangedN)r    r!   r"   r*   rb   r   r   r.   r   r   r   r#   r#   r#   r$   r     s    !r   c                   @   s   e Zd ZdZdd ZdS )
RekeyRealmzS
    This realm gives out new L{RekeyAvatar} instances for any avatar request.
    c                 G   s   |d t  dd fS )Nr   c                   S   r   rI   r#   r#   r#   r#   r$   <lambda>  r   z*RekeyRealm.requestAvatar.<locals>.<lambda>)r   )r(   avatarIDmind
interfacesr#   r#   r$   requestAvatar  s   zRekeyRealm.requestAvatarN)r    r!   r"   r*   r   r#   r#   r#   r$   r     s    r   c                   @   s   e Zd ZdZeZdd ZdS )RekeyTestsMixinzp
    TestCase mixin which defines tests exercising L{SSHTransportBase}'s handling
    of rekeying messages.
    c                    s.   t  } d|d} fdd}|| |S )z
        After a client-initiated rekey is completed, application data continues
        to be passed over the SSH connection.
        r   z-o RekeyLimit=2Kc                    s6   d dd tdD d }|d} | | d S )N
c                 S   s   g | ]}d |f qS )z
line #%02dr#   ).0r   r#   r#   r$   
<listcomp>  s    zFRekeyTestsMixin.test_clientRekey.<locals>.finished.<locals>.<listcomp>r   rs   )joinrangery   r   )resultexpectedResultr'   r#   r$   finished  s   
z2RekeyTestsMixin.test_clientRekey.<locals>.finished)rF   r   r   )r(   r   rM   r   r#   r'   r$   test_clientRekey  s
   
z RekeyTestsMixin.test_clientRekeyN)r    r!   r"   r*   r   r   r   r#   r#   r#   r$   r     s    r   c                   @   s"   e Zd Zeds
dZdddZdS )OpenSSHClientMixinsshz$no ssh command-line client availabler   c           	      C   sl   t  |_d| d | }| j j}||  }g }|D ]
}||d qt	
|tdd | |jS )a  
        Connects to the SSH server started in L{ConchServerSetupMixin.setUp} by
        running the 'ssh' command line tool.

        @type remoteCommand: str
        @param remoteCommand: The command (with arguments) to run on the
        remote end.

        @type process: L{ConchTestOpenSSHProcess}

        @type sshArgs: str
        @param sshArgs: Arguments to pass to the 'ssh' process.

        @return: L{defer.Deferred}
        zssh -2 -l testuser -p %i -F /dev/null -oIdentitiesOnly=yes -oUserKnownHostsFile=kh_test -oPasswordAuthentication=no -oHostKeyAlgorithms=ssh-rsa -a -i rsa_test  127.0.0.1 rs   r   r   )r
   DeferredrK   r   r   r`   splitrz   ry   r   spawnProcessr   )	r(   remoteCommandr   r   cmdliner`   cmdsencodedCmdscmdr#   r#   r$   r     s    

zOpenSSHClientMixin.executeN)r   )r    r!   r"   r   r3   r   r#   r#   r#   r$   r     s    r   c                   @   sP   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd ZdS )OpenSSHKeyExchangeTestsz\
    Tests L{SSHTransportBase}'s key exchange algorithm compatibility with
    OpenSSH.
    c                 C   s   g }zt jtdd ddgt jd}t|ts|d}| }W n	 ty*   Y nw ||vr6t	| d| 
dt d	| }|| jd
S )aI  
        Call execute() method of L{OpenSSHClientMixin} with an ssh option that
        forces the exclusive use of the key exchange algorithm specified by
        keyExchangeAlgo

        @type keyExchangeAlgo: L{str}
        @param keyExchangeAlgo: The key exchange algorithm to use

        @return: L{defer.Deferred}
        r   r   z-Qkex)stderrrs   z not supported by ssh clientz
echo helloz-oKexAlgorithms=s   hello
)
subprocesscheck_outputr   STDOUTrw   rx   r[   r   BaseExceptionr   r   rF   r   r   )r(   keyExchangeAlgokexAlgorithmsoutputrM   r#   r#   r$   assertExecuteWithKexAlgorithm>  s&   

z5OpenSSHKeyExchangeTests.assertExecuteWithKexAlgorithmc                 C   
   |  dS )zb
        The ecdh-sha2-nistp256 key exchange algorithm is compatible with
        OpenSSH
        zecdh-sha2-nistp256r	  r'   r#   r#   r$   test_ECDHSHA256^     
z'OpenSSHKeyExchangeTests.test_ECDHSHA256c                 C   r
  )zb
        The ecdh-sha2-nistp384 key exchange algorithm is compatible with
        OpenSSH
        zecdh-sha2-nistp384r  r'   r#   r#   r$   test_ECDHSHA384e  r  z'OpenSSHKeyExchangeTests.test_ECDHSHA384c                 C   r
  )zb
        The ecdh-sha2-nistp521 key exchange algorithm is compatible with
        OpenSSH
        zecdh-sha2-nistp521r  r'   r#   r#   r$   test_ECDHSHA521l  r  z'OpenSSHKeyExchangeTests.test_ECDHSHA521c                 C   r
  )zl
        The diffie-hellman-group14-sha1 key exchange algorithm is compatible
        with OpenSSH.
        zdiffie-hellman-group14-sha1r  r'   r#   r#   r$   test_DH_GROUP14s  r  z'OpenSSHKeyExchangeTests.test_DH_GROUP14c                 C   r
  )zs
        The diffie-hellman-group-exchange-sha1 key exchange algorithm is
        compatible with OpenSSH.
        z"diffie-hellman-group-exchange-sha1r  r'   r#   r#   r$   test_DH_GROUP_EXCHANGE_SHA1z  r  z3OpenSSHKeyExchangeTests.test_DH_GROUP_EXCHANGE_SHA1c                 C   r
  )zu
        The diffie-hellman-group-exchange-sha256 key exchange algorithm is
        compatible with OpenSSH.
        z$diffie-hellman-group-exchange-sha256r  r'   r#   r#   r$   test_DH_GROUP_EXCHANGE_SHA256  s   z5OpenSSHKeyExchangeTests.test_DH_GROUP_EXCHANGE_SHA256c                 C   s   |  t| jd dS )zy
        The list of key exchange algorithms supported
        by OpenSSH client is obtained with C{ssh -Q kex}.
        zunsupported-algorithmN)assertRaisesr   r	  r'   r#   r#   r$   test_unsupported_algorithm  s   z2OpenSSHKeyExchangeTests.test_unsupported_algorithmN)r    r!   r"   r*   r	  r  r  r  r  r  r  r  r#   r#   r#   r$   r   8  s     	r   c                   @   s   e Zd ZdZedd ZdS )OpenSSHClientForwardingTestszR
    Connection forwarding tests run against the OpenSSL command line client.
    c                 C   r   )zG
        Forwarding of arbitrary IPv6 TCP connections via SSH.
        r   r   z-N -L%i:[::1]:%ir   )r   r_   r   r   r   r   r   r#   r#   r$   test_localToRemoteForwardingV6  r   z;OpenSSHClientForwardingTests.test_localToRemoteForwardingV6N)r    r!   r"   r*   r   r  r#   r#   r#   r$   r    s    r  c                   @   s   e Zd ZdZdS )OpenSSHClientRekeyTestszE
    Rekeying tests run against the OpenSSL command line client.
    N)r    r!   r"   r*   r#   r#   r#   r$   r    rE   r  c                   @   s8   e Zd ZdZejdkrdZdddZdd	 Zd
d Z	dS )CmdLineClientTestszP
    Connection forwarding tests run against the Conch command line client.
    win32z!can't run cmdline client on win32r   Nc                 C   s   |du rg }t  |_| j j}d|| d | }t||  }t	j
 }t	jtj|d< g }	i }
|D ]}t|trD|d}|	| q8|D ]}|| }t|tr\|d}t|trf|d}||
|< qLtj|tj|	|
d |jS )z{
        As for L{OpenSSHClientTestCase.execute}, except it runs the 'conch'
        command line tool, not 'ssh'.
        Nz[-p {} -l testuser --known-hosts kh_test --user-authentications publickey -a -i rsa_test -v r   
PYTHONPATHrs   )env)r
   r   rK   r   r   r`   rZ   r   r   r   environcopypathsepr   rt   r   rw   rx   ry   rz   r   r   ru   )r(   r   r   r   	conchArgsr`   r   r   r  r   
encodedEnvvarvalr#   r#   r$   r     s<   








zCmdLineClientTests.executec                    sV    fdd}t   jdt dd jddgd}|jd	 || |S )
z4
        It can store logs to a local file.
        c                    s      }d| d S )Ns   Log opened.)
getContentassertIn)r   
logContentlogPathr(   r#   r$   cb_check_log  s   z<CmdLineClientTests.test_runWithLogFile.<locals>.cb_check_logr   z--logz	--logfilez--host-key-algorithmszssh-rsa)r   r   r  r   )r   r   mktempr   rF   r   r   r   )r(   r(  rM   r#   r&  r$   test_runWithLogFile  s   
z&CmdLineClientTests.test_runWithLogFilec                 C   s"   | j dt d}|| jd |S )zH
        Do not use --host-key-algorithms flag on command line.
        r   )r   r   r   r   rL   r#   r#   r$   %test_runWithNoHostAlgorithmsSpecified  s
   z8CmdLineClientTests.test_runWithNoHostAlgorithmsSpecified)r   N)
r    r!   r"   r*   r   platformTyper3   r   r*  r+  r#   r#   r#   r$   r    s    

%r  )rr   )Or   r   r  rt   	itertoolsr   zope.interfacer   twisted.conch.errorr   twisted.conch.test.keydatar   r   twisted.conch.test.test_sshr   twisted.credr	   twisted.internetr
   r   r   twisted.internet.errorr   twisted.internet.taskr   twisted.pythonr   r   r   twisted.python.filepathr   twisted.python.procutilsr   twisted.python.reflectr   twisted.test.testutilsr   r   twisted.trial.unittestr   r   r   r   ImportErrorr   twisted.conch.avatarr   twisted.conch.ssh.sessionr   r   r   twisted.conch.interfacestwisted.conch.scripts.conch_StdioInteractingSessioner,   rx   r2   r%   r+   r   r4   FactoryrD   ProcessProtocolrF   r_   rf   r   r   r   r   r   r   r   r   r  r  r  r#   r#   r#   r$   <module>   st   +L
K6D	1\