AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.128   [ 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/protocols/haproxy/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/protocols/haproxy/test/__pycache__/test_v2parser.cpython-310.pyc
o

�b�.�@s�dZddlmZddlmZddlmZddlmZdZ	e	ddd	d
dfde
d
e
de
de
de
de
de
fdd�Ze	dddddfde
d
e
de
de
de
de
de
fdd�Ze	ddddfde
d
e
de
de
de
de
fdd�Z
Gdd �d ej�Zd!S)"z7
Test cases for L{twisted.protocols.haproxy.V2Parser}.
�)�address)�unittest�)�	_v2parser)�InvalidProxyHeaders


QUIT
�!s$s s�"��sig�verCom�famProto�
addrLength�addrs�ports�returncC�||||||S)aV
    Construct a version 2 IPv6 header with custom bytes.

    @param sig: The protocol signature; defaults to valid L{V2_SIGNATURE}.
    @type sig: L{bytes}

    @param verCom: Protocol version and command.  Defaults to V2 PROXY.
    @type verCom: L{bytes}

    @param famProto: Address family and protocol.  Defaults to AF_INET6/STREAM.
    @type famProto: L{bytes}

    @param addrLength: Network-endian byte length of payload.  Defaults to
        description of default addrs/ports.
    @type addrLength: L{bytes}

    @param addrs: Address payload.  Defaults to C{::1} for source and
        destination.
    @type addrs: L{bytes}

    @param ports: Source and destination ports.  Defaults to 8080 for source
        8888 for destination.
    @type ports: L{bytes}

    @return: A packet with header, addresses, and ports.
    @rtype: L{bytes}
    ��rr	r
rrr
rr�N/usr/lib/python3/dist-packages/twisted/protocols/haproxy/test/test_v2parser.py�_makeHeaderIPv6�#r�sscCr)aX
    Construct a version 2 IPv4 header with custom bytes.

    @param sig: The protocol signature; defaults to valid L{V2_SIGNATURE}.
    @type sig: L{bytes}

    @param verCom: Protocol version and command.  Defaults to V2 PROXY.
    @type verCom: L{bytes}

    @param famProto: Address family and protocol.  Defaults to AF_INET/STREAM.
    @type famProto: L{bytes}

    @param addrLength: Network-endian byte length of payload.  Defaults to
        description of default addrs/ports.
    @type addrLength: L{bytes}

    @param addrs: Address payload.  Defaults to 127.0.0.1 for source and
        destination.
    @type addrs: L{bytes}

    @param ports: Source and destination ports.  Defaults to 8080 for source
        8888 for destination.
    @type ports: L{bytes}

    @return: A packet with header, addresses, and ports.
    @rtype: L{bytes}
    rrrrr�_makeHeaderIPv46rr�1s�s�/home/tests/mysockets/sock/home/tests/mysockets/sockcCs|||||S)a�
    Construct a version 2 IPv4 header with custom bytes.

    @param sig: The protocol signature; defaults to valid L{V2_SIGNATURE}.
    @type sig: L{bytes}

    @param verCom: Protocol version and command.  Defaults to V2 PROXY.
    @type verCom: L{bytes}

    @param famProto: Address family and protocol.  Defaults to AF_UNIX/STREAM.
    @type famProto: L{bytes}

    @param addrLength: Network-endian byte length of payload.  Defaults to 108
        bytes for 2 null terminated paths.
    @type addrLength: L{bytes}

    @param addrs: Address payload.  Defaults to C{/home/tests/mysockets/sock}
        for source and destination paths.
    @type addrs: L{bytes}

    @return: A packet with header, addresses, and8 ports.
    @rtype: L{bytes}
    r)rr	r
rrrrr�_makeHeaderUnix\s#rc@seZdZdZd4dd�Zd4dd�Zd4dd	�Zd4d
d�Zd4dd
�Zd4dd�Z	d4dd�Z
d4dd�Zd4dd�Zd4dd�Z
d4dd�Zd4dd�Zd4dd�Zd4dd�Zd4d d!�Zd4d"d#�Zd4d$d%�Zd4d&d'�Zd4d(d)�Zd4d*d+�Zd4d,d-�Zd4d.d/�Zd4d0d1�Zd4d2d3�ZdS)5�
V2ParserTestsz?
    Test L{twisted.protocols.haproxy.V2Parser} behaviour.
    rNcC�t�}|�tj�|��dS)zL
        Test if a well formed IPv4 header is parsed without error.
        N)r�
assertTruer�V2Parser�parse��self�headerrrr�test_happyPathIPv4��z V2ParserTests.test_happyPathIPv4cCr)zL
        Test if a well formed IPv6 header is parsed without error.
        N)rrrrrrrrr�test_happyPathIPv6�r"z V2ParserTests.test_happyPathIPv6cCr)zL
        Test if a well formed UNIX header is parsed without error.
        N)rrrrrrrrr�test_happyPathUnix�r"z V2ParserTests.test_happyPathUnixcC� tdd�}|�ttjj|�dS)zN
        Test if an invalid signature block raises InvalidProxyError.
        s)rN�r�assertRaisesrrrrrrrr�test_invalidSignature��
�z#V2ParserTests.test_invalidSignaturecCr%)zF
        Test if an invalid version raises InvalidProxyError.
        r�r	Nr&rrrr�test_invalidVersion�r)z!V2ParserTests.test_invalidVersioncCr%)zF
        Test if an invalid command raises InvalidProxyError.
        �#r*Nr&rrrr�test_invalidCommand�r)z!V2ParserTests.test_invalidCommandcCr%)zE
        Test if an invalid family raises InvalidProxyError.
        �@�r
Nr&rrrr�test_invalidFamily�r)z V2ParserTests.test_invalidFamilycCr%)zG
        Test if an invalid protocol raises InvalidProxyError.
        �$r/Nr&rrrr�test_invalidProto�r)zV2ParserTests.test_invalidProtocC�2tdd�}tj�|�}|�|j�|�|j�dS)zU
        Test that local does not return endpoint data for IPv4 connections.
        � r*N�rrrr�assertFalse�source�destination�rr �inforrr�test_localCommandIpv4��
z#V2ParserTests.test_localCommandIpv4cCr3)zU
        Test that local does not return endpoint data for IPv6 connections.
        r4r*N�rrrrr6r7r8r9rrr�test_localCommandIpv6�r<z#V2ParserTests.test_localCommandIpv6cCr3)zU
        Test that local does not return endpoint data for UNIX connections.
        r4r*N�rrrrr6r7r8r9rrr�test_localCommandUnix�r<z#V2ParserTests.test_localCommandUnixcC�Rtdd�}tj�|�}|�|j�|�|jtj�|�|j	�|�|j	tj�dS)zM
        Test that proxy returns endpoint data for IPv4 connections.
        rr*N)
rrrrrr7�assertIsInstancer�IPv4Addressr8r9rrr�test_proxyCommandIpv4��
z#V2ParserTests.test_proxyCommandIpv4cCrA)zM
        Test that proxy returns endpoint data for IPv6 connections.
        rr*N)
rrrrrr7rBr�IPv6Addressr8r9rrr�test_proxyCommandIpv6�rEz#V2ParserTests.test_proxyCommandIpv6cCrA)zM
        Test that proxy returns endpoint data for UNIX connections.
        rr*N)
rrrrrr7rBr�UNIXAddressr8r9rrr�test_proxyCommandUnixrEz#V2ParserTests.test_proxyCommandUnixcCr3)�V
        Test that UNSPEC does not return endpoint data for IPv4 connections.
        �r/Nr5r9rrr�test_unspecFamilyIpv4r<z#V2ParserTests.test_unspecFamilyIpv4cCr3)�V
        Test that UNSPEC does not return endpoint data for IPv6 connections.
        rKr/Nr=r9rrr�test_unspecFamilyIpv6r<z#V2ParserTests.test_unspecFamilyIpv6cCr3)�V
        Test that UNSPEC does not return endpoint data for UNIX connections.
        rKr/Nr?r9rrr�test_unspecFamilyUnix!r<z#V2ParserTests.test_unspecFamilyUnixcCr3)rJ�r/Nr5r9rrr�test_unspecProtoIpv4*r<z"V2ParserTests.test_unspecProtoIpv4cCr3)rMr4r/Nr=r9rrr�test_unspecProtoIpv63r<z"V2ParserTests.test_unspecProtoIpv6cCr3)rO�0r/Nr?r9rrr�test_unspecProtoUnix<r<z"V2ParserTests.test_unspecProtoUnixcC�>d}t�|}t��}|�|�\}}|�|�|�||�dS)zU
        Test that overflow bits are preserved during feed parsing for IPv4.
        �TEST DATA

TEST DATAN)rrr�feedr�assertEqual�r�	testValuer �parserr:�overflowrrr�test_overflowIpv4E�

zV2ParserTests.test_overflowIpv4cCrV)zU
        Test that overflow bits are preserved during feed parsing for IPv6.
        rWN)rrrrXrrYrZrrr�test_overflowIpv6Pr_zV2ParserTests.test_overflowIpv6cCrV)zU
        Test that overflow bits are preserved during feed parsing for Unix.
        rWN)rrrrXrrYrZrrr�test_overflowUnix[r_zV2ParserTests.test_overflowUnixcCs d}t��}|�t|j|�dS)zK
        Test that an initial payload of less than 16 bytes fails.
        sNEEDMOREDATAN)rrr'rrX)rr[r\rrr�test_segmentTooSmallfs�z"V2ParserTests.test_segmentTooSmall)rN)�__name__�
__module__�__qualname__�__doc__r!r#r$r(r+r-r0r2r;r>r@rDrGrIrLrNrPrRrSrUr^r`rarbrrrrr�s4









	
	
	



	
	
	
	
	
	

rN)rf�twisted.internetr�
twisted.trialr�r�_exceptionsr�V2_SIGNATURE�bytesrrr�TestCaserrrrr�<module>s��������
�'�������
�'������
�&

Anon7 - 2022
AnonSec Team