%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/twisted/conch/test/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/twisted/conch/test/__pycache__/test_openssh_compat.cpython-312.pyc

�

Ϫ�f����dZddlZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
dd	lmZd
ZdZed�rdd
lmZndZdZeed�sdZdZeee�Gd�de��Zy)z,
Tests for L{twisted.conch.openssh_compat}.
�N)�skipIf)�getDHGeneratorAndPrime)�keydata)�FilePath)�
requireModule)�MockOS)�TestCaseF��cryptography)�OpenSSHFactoryTzCannot run without cryptography�geteuidzgeteuid/seteuid not availablec�8�eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zy)	�OpenSSHFactoryTestsz&
    Tests for L{OpenSSHFactory}.
    Nc��t�|_t|j��|_|jj�|jj|j_t|j��|_|jj�|jj|j_	|jjd�jd�|jjd�jd�|jjd�jtj�|jjd�jtj�|jjd�jd�|jjd�jtj�|jjd	�jd
�t!�|_|j%t&d|j"j(�|j%t&d|j"j*�y)
N�ssh_host_foosfoo�bar_key�ssh_host_one_key�ssh_host_two_key�ssh_host_three_keysnot a key contentzssh_host_one_key.pub�modulis�
#    $OpenBSD: moduli,v 1.xx 2016/07/26 12:34:56 jhacker Exp $i
# Time Type Tests Tries Size Generator Modulus
20030501000000 2 6 100 2047 2 FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF
�seteuid�setegid)r�factoryr�mktemp�keysDir�makedirs�path�dataRoot�	moduliDir�
moduliRoot�child�
setContentr�privateRSA_openssh�privateDSA_openssh�publicRSA_opensshr�mockos�patch�osrr)�selfs �H/usr/lib/python3/dist-packages/twisted/conch/test/test_openssh_compat.py�setUpzOpenSSHFactoryTests.setUp%s���%�'�������
�.��������� $��� 1� 1�����!�$�+�+�-�0��������!�"&�.�.�"5�"5����������>�*�5�5�f�=������9�%�0�0��8������-�.�9�9�'�:T�:T�U������-�.�9�9�'�:T�:T�U������/�0�;�;�<P�Q������1�2�=�=�g�>W�>W�X������X�&�1�1�
�	
� �h����
�
�2�y�$�+�+�"5�"5�6��
�
�2�y�$�+�+�"5�"5�6�c���|jj�}|jt|�d�|j	�}|jt|�dg�y)zw
        L{OpenSSHFactory.getPublicKeys} should return the available public keys
        in the data directory
        ��ssh-rsaN)r�
getPublicKeys�assertEqual�len�keys�list�r)r3�keyTypess   r*�test_getPublicKeysz&OpenSSHFactoryTests.test_getPublicKeysJsK��
�|�|�)�)�+������T��A�&��9�9�;������h��*��6r,c�`�|jj�}|jt|�d�|j	�}|jt|�ddh�|j|jjg�|j|jjg�y)z�
        Will return the available private keys in the data directory, ignoring
        key files which failed to be loaded.
        �r/�ssh-dssN)	r�getPrivateKeysr1r2r3�setr&�seteuidCalls�setegidCallsr5s   r*�test_getPrivateKeysz'OpenSSHFactoryTests.test_getPrivateKeysTs���
�|�|�*�*�,������T��A�&��9�9�;������X���Z�(@�A�������1�1�2�6�������1�1�2�6r,c����|jjd���jd�|j�jd�tj
�dtddf��fd�}|jtd|�|jj�}|jt|�d	�|j�}|jt|�d
dh�|j|jjdt	j �g�|j|jj"dt	j$�g�y)z�
        L{OpenSSHFactory.getPrivateKeys} should switch to root if the keys
        aren't readable by the current user.
        rr��euid�returnNc�6���jd��|�S)NrA)�chmod)rB�keyFile�savedSeteuids ��r*rz>OpenSSHFactoryTests.test_getPrivateKeysAsRoot.<locals>.seteuidls����M�M�%� ���%�%r,rr9r/r:)rr!rE�
addCleanupr(r�intr'rr;r1r2r3r<r&r=r
r>�getegid)r)rr3r6rFrGs    @@r*�test_getPrivateKeysAsRootz-OpenSSHFactoryTests.test_getPrivateKeysAsRoot`s����
�,�,�$�$�%7�8���
�
�d������
�
�u�-��z�z��	&�#�	&�$�	&�	
�
�
�2�y�'�*��|�|�*�*�,������T��A�&��9�9�;������X���Z�(@�A�������1�1�A�r�z�z�|�3D�E�������1�1�A�r�z�z�|�3D�Er,c�t�|jj�}|j|dtd�gi�y)zq
        L{OpenSSHFactory.getPrimes} should return the available primes
        in the moduli directory.
        isdiffie-hellman-group14-sha1N)r�	getPrimesr1r)r)�primess  r*�test_getPrimesz"OpenSSHFactoryTests.test_getPrimesxs;��
���'�'�)�������-�.L�M�N�
�	
r,)rCN)	�__name__�
__module__�__qualname__�__doc__r+r7r?rKrO�r,r*rrs"���#7�J7�
7�F�0
r,r)rSr(�unittestr�twisted.conch.ssh._kexr�twisted.conch.testr�twisted.python.filepathr�twisted.python.reflectr�twisted.test.test_processr�twisted.trial.unittestr	�doSkip�
skipReason�$twisted.conch.openssh_compat.factoryr�hasattrrrTr,r*�<module>r`s|���
��9�&�,�0�,�+�	��
�
��� �C�
�F�2�J��r�9��
�F�0�J���
��c
�(�c
��c
r,

Zerion Mini Shell 1.0