404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.188.96.76: ~ $
3

گa�!�@s�UdZddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	dd	l
mZdd
l
mZddl
m
Z
ddlmZddlm	Zeje�Zejdd
�dd�Zeeed�dd�Zeedd�dd�Zejdd
�dd�Ze�Zeeedd�dd�Zejdd
�dd�ZgZ ee edd�dd�Z!dd�d d!�Z"ejeeedd"�d#d$�Z#ejeeedd"�d%d&�Z$eeeee%dd'�d(d)�Z&eeed*�d+d,�Z'eeed-�d.d/�Z(dS)0z;Facilities for implementing hooks that call shell commands.�N)�List)�Optional)�Set)�
configuration)�errors)�util)�
filesystem)�misc)�os)�ops)�config�returncCs4t|jd�t|jd�t|jd�t|jd�dS)z#Check hook commands are executable.ZpreZpostZdeploy�renewN)�
validate_hook�pre_hook�	post_hook�deploy_hook�
renew_hook)r�r�/usr/lib/python3.6/hooks.py�validate_hookssr)�	shell_cmdr
cCs.tj|�s"tj|�tj|�s"dStjj|�S)z�Extract the program run by a shell command.

    :param str shell_cmd: command to be executed

    :returns: basename of command or None if the command isn't found
    :rtype: str or None

    N)rZ
exe_exists�	plug_utilZpath_surgeryr
�path�basename)rrrr�_progs
	


r)r�	hook_namer
cCs\|rX|jdd�d}t|�sXtjd}tjj|�r@dj||�}ndj|||�}tj|��dS)z�Check that a command provided as a hook is plausibly executable.

    :raises .errors.HookCommandNotFound: if the command is not found
    N�r�PATHz3{1}-hook command {0} exists, but is not executable.z>Unable to find {2}-hook command {0} in the PATH.
(PATH is {1}))	�splitrr
�environr�exists�formatrZHookCommandNotFound)rr�cmdr�msgrrrr-s

rcCsB|jdkr,|jr,xt|j�D]}t|�qW|j}|r>t|�dS)a�Run pre-hooks if they exist and haven't already been run.

    When Certbot is running with the renew subcommand, this function
    runs any hooks found in the config.renewal_pre_hooks_dir (if they
    have not already been run) followed by any pre-hook in the config.
    If hooks in config.renewal_pre_hooks_dir are run and the pre-hook in
    the config is a path to one of these scripts, it is not run twice.

    :param configuration.NamespaceConfig config: Certbot settings

    rN)�verb�directory_hooks�
list_hooksZrenewal_pre_hooks_dir�_run_pre_hook_if_necessaryr)r�hookr#rrrr?sr)�commandr
cCs.|tkrtjd|�ntd|�tj|�dS)z�Run the specified pre-hook if we haven't already.

    If we've already run this exact command before, a message is logged
    saying the pre-hook was skipped.

    :param str command: pre-hook to be run

    z*Pre-hook command already run, skipping: %szpre-hookN)�executed_pre_hooks�logger�info�	_run_hook�add)r*rrrr(Ws	
r(cCsR|j}|jdkr@|jr2xt|j�D]}t|�q"W|rNt|�n|rNtd|�dS)a�Run post-hooks if defined.

    This function also registers any executables found in
    config.renewal_post_hooks_dir to be run when Certbot is used with
    the renew subcommand.

    If the verb is renew, we delay executing any post-hooks until
    :func:`run_saved_post_hooks` is called. In this case, this function
    registers all hooks found in config.renewal_post_hooks_dir to be
    called followed by any post-hook in the config. If the post-hook in
    the config is a path to an executable in the post-hook directory, it
    is not scheduled to be run twice.

    :param configuration.NamespaceConfig config: Certbot settings

    rz	post-hookN)rr%r&r'Zrenewal_post_hooks_dir�_run_eventuallyr.)rr#r)rrrrgs

rcCs|tkrtj|�dS)z�Registers a post-hook to be run eventually.

    All commands given to this function will be run exactly once in the
    order they were given when :func:`run_saved_post_hooks` is called.

    :param str command: post-hook to register to be run

    N)�
post_hooks�append)r*rrrr0�s	r0)r
cCsxtD]}td|�qWdS)zGRun any post hooks that were saved up in the course of the 'renew' verbz	post-hookN)r1r.)r#rrr�run_saved_post_hooks�s
r3)r�domains�lineage_pathr
cCs|jrt|j|||j�dS)aRun post-issuance hook if defined.

    :param configuration.NamespaceConfig config: Certbot settings
    :param domains: domains in the obtained certificate
    :type domains: `list` of `str`
    :param str lineage_path: live directory path for the new cert

    N)r�_run_deploy_hook�dry_run)rr4r5rrrr�s
rcCspt�}|jr:x,t|j�D]}t||||j�|j|�qW|jrl|j|krZtj	d|j�nt|j|||j�dS)a]Run post-renewal hooks.

    This function runs any hooks found in
    config.renewal_deploy_hooks_dir followed by any renew-hook in the
    config. If the renew-hook in the config is a path to a script in
    config.renewal_deploy_hooks_dir, it is not run twice.

    If Certbot is doing a dry run, no hooks are run and messages are
    logged saying that they were skipped.

    :param configuration.NamespaceConfig config: Certbot settings
    :param domains: domains in the obtained certificate
    :type domains: `list` of `str`
    :param str lineage_path: live directory path for the new cert

    z0Skipping deploy-hook '%s' as it was already run.N)
�setr&r'Zrenewal_deploy_hooks_dirr6r7r/rr,r-)rr4r5Zexecuted_dir_hooksr)rrrr�s

r)r*r4r5r7r
cCs<|rtjd|�dSdj|�tjd<|tjd<td|�dS)aRun the specified deploy-hook (if not doing a dry run).

    If dry_run is True, command is not run and a message is logged
    saying that it was skipped. If dry_run is False, the hook is run
    after setting the appropriate environment variables.

    :param str command: command to run as a deploy-hook
    :param domains: domains in the obtained certificate
    :type domains: `list` of `str`
    :param str lineage_path: live directory path for the new cert
    :param bool dry_run: True iff Certbot is doing a dry run

    z)Dry run: skipping deploy hook command: %sN� ZRENEWED_DOMAINSZRENEWED_LINEAGEzdeploy-hook)r,r-�joinr
r r.)r*r4r5r7rrrr6�s
r6)�cmd_namerr
cCs6tj||tj�d�\}}}tjd|�d�|||�|S)z�Run a hook command.

    :param str cmd_name: the user facing name of the hook being run
    :param shell_cmd: shell command to execute
    :type shell_cmd: `list` of `str` or `str`

    :returns: stderr if there was any)�envzHook '�')r	Zexecute_command_statusrZenv_no_snap_for_external_calls�display_opsZreport_executed_command)r;r�
returncode�err�outrrrr.�sr.)�dir_pathr
cs.�fdd�tj��D�}dd�|D�}t|�S)z�List paths to all hooks found in dir_path in sorted order.

    :param str dir_path: directory to search

    :returns: `list` of `str`
    :rtype: sorted list of absolute paths to executables in dir_path

    c3s|]}tjj�|�VqdS)N)r
rr:)�.0�f)rBrr�	<genexpr>�szlist_hooks.<locals>.<genexpr>cSs&g|]}tj|�r|jd�r|�qS)�~)rZ
is_executable�endswith)rCrrrr�
<listcomp>�szlist_hooks.<locals>.<listcomp>)r
�listdir�sorted)rBZallpathsZhooksr)rBrr'�s	r'))�__doc__ZloggingZtypingrrrZcertbotrrrZcertbot.compatrr	r
Zcertbot.displayrr>Zcertbot.pluginsrZ	getLogger�__name__r,ZNamespaceConfigr�strrrrr8r+r(rr1r0r3rr�boolr6r.r'rrrr�<module>s<



 

Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 302 B 0644
__init__.cpython-36.pyc File 302 B 0644
account.cpython-36.opt-1.pyc File 13.29 KB 0644
account.cpython-36.pyc File 13.29 KB 0644
auth_handler.cpython-36.opt-1.pyc File 16.2 KB 0644
auth_handler.cpython-36.pyc File 16.29 KB 0644
cert_manager.cpython-36.opt-1.pyc File 14.98 KB 0644
cert_manager.cpython-36.pyc File 14.98 KB 0644
client.cpython-36.opt-1.pyc File 25.25 KB 0644
client.cpython-36.pyc File 25.25 KB 0644
constants.cpython-36.opt-1.pyc File 3.98 KB 0644
constants.cpython-36.pyc File 3.98 KB 0644
eff.cpython-36.opt-1.pyc File 4.45 KB 0644
eff.cpython-36.pyc File 4.45 KB 0644
error_handler.cpython-36.opt-1.pyc File 5.8 KB 0644
error_handler.cpython-36.pyc File 5.8 KB 0644
hooks.cpython-36.opt-1.pyc File 8.34 KB 0644
hooks.cpython-36.pyc File 8.34 KB 0644
lock.cpython-36.opt-1.pyc File 8.77 KB 0644
lock.cpython-36.pyc File 8.77 KB 0644
log.cpython-36.opt-1.pyc File 12.77 KB 0644
log.cpython-36.pyc File 12.85 KB 0644
main.cpython-36.opt-1.pyc File 43.5 KB 0644
main.cpython-36.pyc File 43.69 KB 0644
renewal.cpython-36.opt-1.pyc File 15.53 KB 0644
renewal.cpython-36.pyc File 15.53 KB 0644
reporter.cpython-36.opt-1.pyc File 2.85 KB 0644
reporter.cpython-36.pyc File 2.91 KB 0644
snap_config.cpython-36.opt-1.pyc File 4.04 KB 0644
snap_config.cpython-36.pyc File 4.04 KB 0644
storage.cpython-36.opt-1.pyc File 38.5 KB 0644
storage.cpython-36.pyc File 38.5 KB 0644
updater.cpython-36.opt-1.pyc File 4.18 KB 0644
updater.cpython-36.pyc File 4.18 KB 0644