shell bypass 403

Cubjrnet7 Shell


name : edns.cpython-39.opt-1.pyc
a

�M�e�;�@s�UdZddlZddlZddlZddlZddlmZmZmZm	Z	ddl
ZddlZddl
ZddlZGdd�dejj�ZGdd�d�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
ejj�ZGdd�de�ZGdd�de�ZejeejeejeiZeeefed<eed�dd�Ze	eefded�dd�Ze	eefe e!e!ed�dd�Z"eedd�dd�Z#ejZej$Z$ej%Z%ej&Z&ejZej'Z'ej(Z(ej)Z)ej*Z*ej+Z+ejZdS) zEDNS Options�N)�Any�Dict�Optional�Unionc@sDeZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
edd
��ZdS)�
OptionType������	�
���
�cCsdS�Ni�����clsrr�,/usr/lib/python3.9/site-packages/dns/edns.py�_maximum8szOptionType._maximumN)�__name__�
__module__�__qualname__�NSID�DAU�DHU�N3U�ECS�EXPIRE�COOKIE�	KEEPALIVE�PADDING�CHAIN�EDE�classmethodrrrrrr src@s�eZdZdZeeefd�dd�Zd ee	ee
d�dd�Zed	�d
d�Ze
eddd
�dd��Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS)!�Optionz%Base class for all EDNS option types.��otypecCst�|�|_dS)z_Initialize an option.

        *otype*, a ``dns.edns.OptionType``, is the option type.
        N)r�maker))�selfr)rrr�__init__@szOption.__init__N��file�returncCst�dS)zUConvert an option to wire format.

        Returns a ``bytes`` or ``None``.

        N��NotImplementedError�r+r.rrr�to_wireGszOption.to_wire�r/cCst�dS�Nr0�r+rrr�to_textOszOption.to_text�dns.wire.Parser�r)�parserr/cCst�dS)aBuild an EDNS option object from wire format.

        *otype*, a ``dns.edns.OptionType``, is the option type.

        *parser*, a ``dns.wire.Parser``, the parser, which should be
        restructed to the option length.

        Returns a ``dns.edns.Option``.
        Nr0�rr)r:rrr�from_wire_parserRszOption.from_wire_parsercCs,|��}|��}||krdS||kr(dSdS)z�Compare an EDNS option with another option of the same type.

        Returns < 0 if < *other*, 0 if == *other*, and > 0 if > *other*.
        r����)r3)r+�other�wireZowirerrr�_cmp_szOption._cmpcCs,t|t�sdS|j|jkrdS|�|�dkS)NFr��
isinstancer'r)rA�r+r?rrr�__eq__ls

z
Option.__eq__cCs,t|t�sdS|j|jkrdS|�|�dkS)NTrrBrDrrr�__ne__ss

z
Option.__ne__cCs(t|t�r|j|jkrtS|�|�dkS�Nr�rCr'r)�NotImplementedrArDrrr�__lt__zsz
Option.__lt__cCs(t|t�r|j|jkrtS|�|�dkSrGrHrDrrr�__le__sz
Option.__le__cCs(t|t�r|j|jkrtS|�|�dkSrGrHrDrrr�__ge__�sz
Option.__ge__cCs(t|t�r|j|jkrtS|�|�dkSrGrHrDrrr�__gt__�sz
Option.__gt__cCs|��Sr5)r7r6rrr�__str__�szOption.__str__)N)rrr�__doc__rr�strr,rr�bytesr3r7r&r<rArErFrJrKrLrMrNrrrrr'=s
r'cs~eZdZdZeeefeeefd��fdd�Zde	e
e	ed�dd�Zed	�d
d�Ze
eeefded
�dd��Z�ZS)�
GenericOptionzwGeneric Option Class

    This class is used for EDNS option types for which we have no better
    implementation.
    )r)�datacs"t��|�tjj�|d�|_dS)NT)�superr,�dns�rdata�RdataZ	_as_bytesrS)r+r)rS��	__class__rrr,�szGenericOption.__init__Nr-cCs|r|�|j�dS|jSdSr5)�writerSr2rrrr3�szGenericOption.to_wirer4cCs
d|jS)Nz
Generic %dr(r6rrrr7�szGenericOption.to_textr8r9cCs|||���Sr5��
get_remainingr;rrrr<�szGenericOption.from_wire_parser)N)rrrrOrrrPrQr,rrr3r7r&r'r<�
__classcell__rrrXrrR�s$�rRcs�eZdZdZdeeeed��fdd�
Zed�dd	�Ze	ee
d
�dd��Zdeeee
d
�dd�Zeeeefde
d�dd��Z�ZS)�	ECSOptionz!EDNS Client Subnet (ECS, RFC7871)Nr)�address�srclen�scopelenc	sRt��tj�tj�|�}|tjkrjd|_	|dur6d}tj
j�|�}tj
j�
|dd�}tj
j�
|dd�}nX|tjkr�d|_	|dur�d}tj
j�|�}tj
j�
|dd�}tj
j�
|dd�}ntd	��||_||_||_tj�||�}tt�|d
��}|d|�|_|d}|dk�rNt�dt|jd
d��dd|>@�}|jdd
�||_dS)a�*address*, a ``str``, is the client address information.

        *srclen*, an ``int``, the source prefix length, which is the
        leftmost number of bits of the address to be used for the
        lookup.  The default is 24 for IPv4 and 56 for IPv6.

        *scopelen*, an ``int``, the scope prefix length.  This value
        must be 0 in queries, and should be set in responses.
        �N�8r�r=�� zBad address family� @r�Br>�)rTr,rrrUZinetZaf_for_address�socketZAF_INET6�familyrVrWZ_as_ipv6_address�_as_intZAF_INETZ_as_ipv4_address�
ValueErrorr_r`raZ	inet_pton�int�math�ceil�addrdata�struct�pack�ord)	r+r_r`ra�afrq�nbytesZnbitsZlastrXrrr,�s6


&zECSOption.__init__r4cCsd�|j|j|j�S)NzECS {}/{} scope/{})�formatr_r`rar6rrrr7�szECSOption.to_text)�textr/c
Cs$d}|��}d}t|�dkr&|d}n>t|�dkrV|d|krLtd�|���|d}ntd�|���|�d�}|dkr�|�d�\}}d}n(|dkr�|�d�\}}}ntd�|���zt|�}Wn$ty�td	d
�|���Yn0zt|�}	Wn&t�ytdd�|���Yn0t||	|�S)
a�Convert a string into a `dns.edns.ECSOption`

        *text*, a `str`, the text form of the option.

        Returns a `dns.edns.ECSOption`.

        Examples:

        >>> import dns.edns
        >>>
        >>> # basic example
        >>> dns.edns.ECSOption.from_text('1.2.3.4/24')
        >>>
        >>> # also understands scope
        >>> dns.edns.ECSOption.from_text('1.2.3.4/24/32')
        >>>
        >>> # IPv6
        >>> dns.edns.ECSOption.from_text('2001:4b98::1/64/64')
        >>>
        >>> # it understands results from `dns.edns.ECSOption.to_text()`
        >>> dns.edns.ECSOption.from_text('ECS 1.2.3.4/24/32')
        rNr=rrbzcould not parse ECS from "{}"�/�0zinvalid scope z"{}": scope must be an integerzinvalid srclen z"{}": srclen must be an integer)�split�lenrmrw�countrnr^)
rxZoptional_prefix�tokensZecs_textZ	n_slashesr_ZtsrclenZtscope�scoper`rrr�	from_text�s<


�
�
zECSOption.from_textr-cCs6t�d|j|j|j�|j}|r.|�|�dS|SdS)N�!HBB)rrrsrkr`rarqrZ�r+r.�valuerrrr3s�
zECSOption.to_wirer8r9c
Cs�|�d�\}}}tt�|d��}|�|�}|dkrRd|}tj�|d|�}	n.|dkrxd|}tj�|d|�}	nt	d��||	||�S)	Nr�rgr=��rb�zunsupported family)
Z
get_structrnrorpZ	get_bytesrUZipv4Z	inet_ntoaZipv6rm)
rr)r:rk�srcrZaddrlen�prefixZpadZaddrrrrr<&s
zECSOption.from_wire_parser)Nr)N)rrrrOrPrrnr,r7�staticmethodr'r�rrQr3r&rrr<r]rrrXrr^�s/8
�r^c@s|eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZedd��ZdS)�EDECoderr=rbrr�rr	r
rrr
rrr�rr��������recCsdSrrrrrrrTszEDECode._maximumN)rrrZOTHERZUNSUPPORTED_DNSKEY_ALGORITHMZUNSUPPORTED_DS_DIGEST_TYPEZSTALE_ANSWERZ
FORGED_ANSWERZDNSSEC_INDETERMINATEZDNSSEC_BOGUSZSIGNATURE_EXPIREDZSIGNATURE_NOT_YET_VALIDZDNSKEY_MISSINGZRRSIGS_MISSINGZNO_ZONE_KEY_BIT_SETZNSEC_MISSINGZCACHED_ERRORZ	NOT_READYZBLOCKEDZCENSOREDZFILTEREDZ
PROHIBITEDZSTALE_NXDOMAIN_ANSWERZNOT_AUTHORITATIVEZ
NOT_SUPPORTEDZNO_REACHABLE_AUTHORITYZ
NETWORK_ERRORZINVALID_DATAr&rrrrrr�9s6r�cs�eZdZdZhd�Zdeeefeed��fdd�
Z	ed�dd	�Z
deeeed
�dd�Z
eeeefd
ed�dd��Z�ZS)�	EDEOptionz!Extended DNS Error (EDE, RFC8914)>ZDSZDNSKEYZNSECZDNSSECZNXDOMAINZRRSIGsN)�coderxcs>t��tj�t�|�|_|dur4t|t�s4t	d��||_
dS)z�*code*, a ``dns.edns.EDECode`` or ``str``, the info code of the
        extended error.

        *text*, a ``str`` or ``None``, specifying additional information about
        the error.
        Nztext must be string or None)rTr,rr%r�r*r�rCrPrmrx)r+r�rxrXrrr,^s
zEDEOption.__init__r4csnd�j��}�jtvrPt��j�}d��fdd�|�d�D��}|d|�d�7}�jdurj|d�j��7}|S)	NzEDE � c3s$|]}|�jvr|n|��VqdSr5)�_preserve_case�title)�.0Zwordr6rr�	<genexpr>qs�z$EDEOption.to_text.<locals>.<genexpr>�_z (�)z: )r�r�r7�joinr{rx)r+�outputZdescrr6rr7ms
�
zEDEOption.to_textr-cCsBt�d|j�}|jdur(||j�d�7}|r:|�|�dS|SdS)Nz!H�utf8)rrrsr�rx�encoderZr�rrrr3zs

zEDEOption.to_wirer8r9cCsLt�|���}|��}|r>|ddkr2|dd�}|�d�}nd}|||�S)Nr>rr�)r�r*Z
get_uint16r\�decode)rr)r:r�rxZbtextrrrr<�szEDEOption.from_wire_parser)N)N)rrrrOr�rr�rPrr,r7rrQr3r&rr'r<r]rrrXrr�Ys"
�r�csheZdZed��fdd�Zdeeed�dd�Zed�d	d
�Z	e
eeefe
jjed�dd
��Z�ZS)�
NSIDOption)�nsidcst��tj�||_dSr5)rTr,rrr�)r+r�rXrrr,�szNSIDOption.__init__Nr-cCs|r|�|j�dS|jSdSr5)rZr�r2rrrr3�szNSIDOption.to_wirer4cCs:tdd�|jD��r |j��}nt�|j���}d|��S)Ncss|]}|dko|dkVqdS)rf�~Nr)r��crrrr���z%NSIDOption.to_text.<locals>.<genexpr>zNSID )�allr�r��binasciiZhexlify)r+r�rrrr7�szNSIDOption.to_textr9cCs||���Sr5r[r;rrrr<�szNSIDOption.from_wire_parser)N)rrrrQr,rrr3rPr7r&rrrUr@�Parserr'r<r]rrrXrr��s�r��_type_to_class)r)r/cCst�|�}|durt}|S)z�Return the class for the specified option type.

    The GenericOption class is used if a more specific class is not
    known.
    N)r��getrR)r)rrrr�get_option_class�s
r�r8r9cCst�|�}t|�}|�||�S)aBuild an EDNS option object from wire format.

    *otype*, an ``int``, is the option type.

    *parser*, a ``dns.wire.Parser``, the parser, which should be
    restricted to the option length.

    Returns an instance of a subclass of ``dns.edns.Option``.
    )rr*r�r<)r)r:rrrr�option_from_wire_parser�s
r�)r)r@�current�olenr/cCsFtj�||�}|�|��t||�Wd�S1s80YdS)arBuild an EDNS option object from wire format.

    *otype*, an ``int``, is the option type.

    *wire*, a ``bytes``, is the wire-format message.

    *current*, an ``int``, is the offset in *wire* of the beginning
    of the rdata.

    *olen*, an ``int``, is the length of the wire-format option data

    Returns an instance of a subclass of ``dns.edns.Option``.
    N)rUr@r�Zrestrict_tor�)r)r@r�r�r:rrr�option_from_wire�sr�)�implementationr)r/cCs|t|<dS)z�Register the implementation of an option type.

    *implementation*, a ``class``, is a subclass of ``dns.edns.Option``.

    *otype*, an ``int``, is the option type.
    N)r�)r�r)rrr�
register_type�sr�),rOr�rorjrr�typingrrrrZdns.enumrUZdns.inetZ	dns.rdataZdns.wire�enum�IntEnumrr'rRr^r�r�r�rr%rr��__annotations__r�rPr�rQrnr�r�rrrr r!r"r#r$rrrr�<module>sPU =���


© 2025 Cubjrnet7