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/names/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

�b��@szdZddlmZddlmZmZddlmZmZddl	m
Z
ddlmZddl
mZdd	�Zd
d�ZGdd
�d
ej�ZdS)z
hosts(5) support.
�)�defer)�isIPAddress�
isIPv6Address)�common�dns)�failure)�nativeString)�FilePathc	Cs�g}z|����}Wnty|YSw|��}|D]F}|�d�}|dkr-|d|�}|s0q|��}|��dd�|dd�D�vrbzt|d�}Wn	tyTYqwt|�s]t	|�rb|�
|�q|S)a�
    Search the given file, which is in hosts(5) standard format, for addresses
    associated with a given name.

    @param hostsFile: The name of the hosts(5)-format file to search.
    @type hostsFile: L{FilePath}

    @param name: The name to search for.
    @type name: C{bytes}

    @return: L{None} if the name is not found in the file, otherwise a
        C{str} giving the address in the file associated with the name.
    �#���NcSsg|]}|���qS�)�lower)�.0�srr�5/usr/lib/python3/dist-packages/twisted/names/hosts.py�
<listcomp>/sz$searchFileForAll.<locals>.<listcomp>�r)�
getContent�
splitlines�
BaseExceptionr
�find�splitr�
ValueErrorrr�append)�	hostsFile�name�results�lines�line�idx�parts�maybeIPrrr�searchFileForAlls0�
�
�r"cCstt|�|�}|r
|dSdS)a�
    Grep given file, which is in hosts(5) standard format, for an address
    entry with a given name.

    @param file: The name of the hosts(5)-format file to search.
    @type file: C{str} or C{bytes}

    @param name: The name to search for.
    @type name: C{bytes}

    @return: L{None} if the name is not found in the file, otherwise a
        C{str} giving the first address in the file associated with
        the name.
    rN)r"r	)�filer�	addressesrrr�
searchFileFor9sr%c@sJeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
d�Zddd�Z	eZ
dS)�Resolverz9
    A resolver that services hosts(5) format files.
    �
/etc/hosts�cCstj�|�||_||_dS�N)r�ResolverBase�__init__r#�ttl)�selfr#r,rrrr+Ss
zResolver.__init__c�$t��fdd�tt�j���D��S)zv
        Return a tuple of L{dns.RRHeader} instances for all of the IPv4
        addresses in the hosts file.
        c3�:�|]}t|�rt��tjtj�jt�|�j��VqdSr))rr�RRHeader�A�INr,�Record_A�r�addr�rr-rr�	<genexpr>]s�� 
�z%Resolver._aRecords.<locals>.<genexpr>��tupler"r	r#�r-rrr6r�	_aRecordsXs�zResolver._aRecordscr.)zv
        Return a tuple of L{dns.RRHeader} instances for all of the IPv6
        addresses in the hosts file.
        c3r/r))rrr0�AAAAr2r,�Record_AAAAr4r6rrr7hs���
�z(Resolver._aaaaRecords.<locals>.<genexpr>r8r:rr6r�_aaaaRecordscs�zResolver._aaaaRecordscCs*|r
t�|ddf�St�t�t�|���S)aF
        Generate a response for the given name containing the given result
        records, or a failure if there are no result records.

        @param name: The DNS name the response is for.
        @type name: C{str}

        @param records: A tuple of L{dns.RRHeader} instances giving the results
            that will go into the response.

        @return: A L{Deferred} which will fire with a three-tuple of result
            records, authority records, and additional records, or which will
            fail with L{dns.DomainError} if there are no result records.
        r)r�succeed�failr�Failurer�DomainError)r-r�recordsrrr�_respondpszResolver._respondNcC�t�|�}|�||�|��S)zm
        Read any IPv4 addresses from C{self.file} and return them as
        L{Record_A} instances.
        )r�domainStringrDr;�r-r�timeoutrrr�
lookupAddress��
zResolver.lookupAddresscCrE)zp
        Read any IPv6 addresses from C{self.file} and return them as
        L{Record_AAAA} instances.
        )rrFrDr>rGrrr�lookupIPV6Address�rJzResolver.lookupIPV6Address)r'r(r))�__name__�
__module__�__qualname__�__doc__r+r;r>rDrIrK�lookupAllRecordsrrrrr&Ns


r&N)rO�twisted.internetr�twisted.internet.abstractrr�
twisted.namesrr�twisted.pythonr�twisted.python.compatr�twisted.python.filepathr	r"r%r*r&rrrr�<module>s'

Spamworldpro Mini