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 :  /usr/lib/python3/dist-packages/twisted/protocols/haproxy/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


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

Current File : /usr/lib/python3/dist-packages/twisted/protocols/haproxy/__pycache__/_v1parser.cpython-310.pyc
o

�b��@spdZddlmZmZddlmZddlmZddlm	Z	m
Z
ddlmZm
Z
mZmZee
j�Gdd	�d	��Zd
S)zD
IProxyParser implementation for version one of the PROXY protocol.
�)�Tuple�Union)�implementer)�address�)�_info�_interfaces)�InvalidNetworkProtocol�InvalidProxyHeader�MissingAddressData�convertErrorc@sxeZdZdZdZdZdZdZeeefZdZ	dd	d
�Z
dedee
ejefe
dffd
d�Zededejfdd��ZdS)�V1Parserz�
    PROXY protocol version one header parser.

    Version one of the PROXY protocol is a human readable format represented
    by a single, newline delimited binary string that contains all of the
    relevant source and destination data.
    sPROXYsUNKNOWNsTCP4sTCP6s
�returnNcCs
d|_dS)N�)�buffer)�self�r�E/usr/lib/python3/dist-packages/twisted/protocols/haproxy/_v1parser.py�__init__,s
zV1Parser.__init__�data�NNcCsv|j|7_t|j�dkr|j|jvrt��|j�|jd�}t|�dks'dSd|_|��}|��}|�|�}||fS)a�
        Consume a chunk of data and attempt to parse it.

        @param data: A bytestring.
        @type data: L{bytes}

        @return: A two-tuple containing, in order, a
            L{_interfaces.IProxyInfo} and any bytes fed to the
            parser that followed the end of the header.  Both of these values
            are None until a complete header is parsed.

        @raises InvalidProxyHeader: If the bytes fed to the parser create an
            invalid PROXY header.
        �krrr)r�len�NEWLINEr
�split�pop�parse)rr�lines�	remaining�header�inforrr�feed/s
z
V1Parser.feed�linec	
Cs|}d}d}d}d}d}d}ttt��|�dd�\}}Wd�n1s&wY||jkr3t��ttt��|�dd�\}}Wd�n1sKwY||jvrXt��||jkrdt�	|dd�Sttt
��|�dd�\}}Wd�n1s|wYttt
��|�dd�\}}Wd�n1s�wYttt
��|�dd�\}}Wd�n1s�wYttt
��|�d�d}Wd�n1s�wY||jkr�t�	|t�
d|��t|��t�
d|��t|���St�	|t�d|��t|��t�d|��t|���S)a�
        Parse a bytestring as a full PROXY protocol header line.

        @param line: A bytestring that represents a valid HAProxy PROXY
            protocol header line.
        @type line: bytes

        @return: A L{_interfaces.IProxyInfo} containing the parsed data.

        @raises InvalidProxyHeader: If the bytestring does not represent a
            valid PROXY header.

        @raises InvalidNetworkProtocol: When no protocol can be parsed or is
            not one of the allowed values.

        @raises MissingAddressData: When the protocol is TCP* but the header
            does not contain a complete set of addresses and ports.
        N� rr�TCP)r�
ValueErrorr
r�PROXYSTRr	�ALLOWED_NET_PROTOS�
UNKNOWN_PROTOr�	ProxyInfor�
TCP4_PROTOr�IPv4Address�decode�int�IPv6Address)	�clsr"�originalLine�proxyStr�networkProtocol�
sourceAddr�
sourcePort�destAddr�destPortrrrrLsT�
�

����
��zV1Parser.parse)rN)�__name__�
__module__�__qualname__�__doc__r&r(r*�
TCP6_PROTOr'rr�bytesrrrr)r!�classmethodrrrrrr
s&�
�
�r
N)r:�typingrr�zope.interfacer�twisted.internetr�rr�_exceptionsr	r
rr�IProxyParserr
rrrr�<module>s

Anon7 - 2022
AnonSec Team