Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/twisted/protocols/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�b��@s�dZddlZddlmZddlmZddlmZmZdZ	dZ
Gdd	�d	e�ZGd
d�de�Z
Gdd
�d
e�ZGdd�de�ZGdd�dej�ZGdd�d�ZGdd�dej�Zgd�ZdS)z 
Ident protocol implementation.
�N)�defer)�basic)�failure�log�i��c@s"eZdZdZdZdefdd�ZdS)�
IdentErrorz;
    Can't determine connection owner; reason unknown.
    z
UNKNOWN-ERROR�returncCs|jS�N)�identDescription��self�r
�9/usr/lib/python3/dist-packages/twisted/protocols/ident.py�__str__�zIdentError.__str__N)�__name__�
__module__�__qualname__�__doc__r
�strrr
r
r
rrsrc@�eZdZdZdZdS)�NoUserz�
    The connection specified by the port pair is not currently in use or
    currently not owned by an identifiable entity.
    zNO-USERN�rrrrr
r
r
r
rr�rc@r)�InvalidPorta
    Either the local or foreign port was improperly specified. This should
    be returned if either or both of the port ids were out of range (TCP
    port numbers are from 1-65535), negative integers, reals or in any
    fashion not recognized as a non-negative integer.
    zINVALID-PORTNrr
r
r
rr'src@r)�
HiddenUserz�
    The server was able to identify the user of this port, but the
    information was not returned at the request of the user.
    zHIDDEN-USERNrr
r
r
rr2rrc@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)�IdentServera�
    The Identification Protocol (a.k.a., "ident", a.k.a., "the Ident
    Protocol") provides a means to determine the identity of a user of a
    particular TCP connection. Given a TCP port number pair, it returns a
    character string which identifies the owner of that connection on the
    server's system.

    Server authors should subclass this class and override the lookup method.
    The default implementation returns an UNKNOWN-ERROR response for every
    query.
    cCs�|�d�}t|�dkr|��dSz	tt|�\}}Wnty(|��YdSwt|kr3tkrInnt|kr?tkrInn|�||�dS|�	t
�t��||�dS)N�,�)
�split�len�invalidQuery�map�int�
ValueError�	_MIN_PORT�	_MAX_PORT�
validQuery�	_ebLookupr�Failurer)r�line�parts�portOnServer�portOnClientr
r
r�lineReceivedHs
��zIdentServer.lineReceivedcCs|j��dSr	)�	transport�loseConnectionrr
r
rr!\szIdentServer.invalidQuerycCsL|j��j|f}|j��j|f}t�|j||��|j||��	|j
||�dS)z�
        Called when a valid query is received to look up and deliver the
        response.

        @param portOnServer: The server port from the query.
        @param portOnClient: The client port from the query.
        N)r/�getHost�host�getPeerr�
maybeDeferred�lookup�addCallback�	_cbLookup�
addErrbackr()rr,r-�
serverAddr�
clientAddrr
r
rr'_s�zIdentServer.validQuerycCs"|\}}|�d||||f�dS)Nz%d, %d : USERID : %s : %s)�sendLine)r�result�sport�cport�sysName�userIdr
r
rr7mszIdentServer._cbLookupcCsL|�t�r|�d|||jf�dSt�|�|�d||t|j�f�dS)Nz%d, %d : ERROR : %s)�checkrr;�valuer�err)rrr=r>r
r
rr(qs

�zIdentServer._ebLookupcC�t��)aq
        Lookup user information about the specified address pair.

        Return value should be a two-tuple of system name and username.
        Acceptable values for the system name may be found online at::

            U{http://www.iana.org/assignments/operating-system-names}

        This method may also raise any IdentError subclass (or IdentError
        itself) to indicate user information will not be provided for the
        given query.

        A Deferred may also be returned.

        @param serverAddress: A two-tuple representing the server endpoint
        of the address being queried.  The first element is a string holding
        a dotted-quad IP address.  The second element is an integer
        representing the port.

        @param clientAddress: Like I{serverAddress}, but represents the
        client endpoint of the address being queried.
        �r)r�
serverAddress�
clientAddressr
r
rr5zszIdentServer.lookupN)
rrrrr.r!r'r7r(r5r
r
r
rr;s	rc@sxeZdZdZdZzddlmZefdd�Z[Wney%ddd�ZYnwd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dS)�ProcServerMixinzDImplements lookup() to grab entries for responses from /proc/net/tcp�LINUXr)�getpwuidcCs||�dS�Nrr
�r�uidrJr
r
r�getUsername�szProcServerMixin.getUsernameNcCrDr	rErLr
r
rrN�rccsL�td��}|��|D]}|��VqWd�dS1swYdS)Nz
/proc/net/tcp)�open�readline�strip)r�f�Lr
r
r�entries�s�
�"�zProcServerMixin.entriesc
Cs&d�ttt�dt�dt|d�����S)N�.�4Bz=L�)�joinr"r�struct�unpack�packr#)r�hexstrr
r
r�dottedQuadFromHexString�s�z'ProcServerMixin.dottedQuadFromHexStringcCs*|�d�\}}|�|�}t|d�}||fS)N�:rW)rr]r#)r�packed�addr�portr
r
r�
unpackAddress�s

zProcServerMixin.unpackAddresscCsN|����}|�|d�\}}|�|d�\}}t|d�}||f||f|fS)Nrr�)rQrrbr#)rr*r+�	localAddr�	localPort�
remoteAddr�
remotePortrMr
r
r�	parseLine�s
zProcServerMixin.parseLinecCsP|��D] }|�|�\}}}||kr$|d|dkr$|j|�|�fSqt��)Nr)rTrh�SYSTEM_NAMErNr)rrFrG�entrdrfrMr
r
rr5�s�zProcServerMixin.lookupr	)rrrrri�pwdrJrN�ImportErrorrTr]rbrhr5r
r
r
rrH�s�rHc@s@eZdZeeeefZdd�Zdd�Z	dd�Z
dd�Zd	d
�ZdS)�IdentClientcCs
g|_dSr	)�queriesrr
r
r�__init__�s
zIdentClient.__init__cCsR|j�t��||f�t|j�dkr|jddS|�d||f�|jddS)zK
        Lookup user information about the specified address pair.
        r���r�%d, %d)rn�appendr�Deferredr r;)rr,r-r
r
rr5�s
zIdentClient.lookupcCsl|js
t�d|���dS|j�d�\}}}|�||�|jr4|�d|jdd|jddf�dSdS)NzUnexpected server response: rrqrr)rnr�msg�pop�
parseResponser;)rr*�d�_r
r
rr.�s*�zIdentClient.lineReceivedcCs(|jD]}|d�t|��qg|_dSrK)rn�errbackr)r�reason�qr
r
r�connectionLost�s

zIdentClient.connectionLostcCs�|�dd�}t|�dkr|�t|��dSttj|�\}}}|dkr@|jD]}|j|kr6|�||��dSq%|�t|��dS|�	||f�dS)Nr^r��ERROR)
rr ryrr"rrQ�
errorTypesr
�callback)r�deferredr*r+�ports�type�addInfo�etr
r
rrv�s

�zIdentClient.parseResponseN)
rrrrrrrrror5r.r|rvr
r
r
rrm�s	rm)rrrrrrmrH)rrY�twisted.internetr�twisted.protocolsr�twisted.pythonrrr%r&�	Exceptionrrrr�LineOnlyReceiverrrHrm�__all__r
r
r
r�<module>s		Y20

Spamworldpro Mini