JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/certbot/compat/__pycache__/misc.cpython-39.pyc

a

}|�g$�@s\dZddlmZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
z8ddlmZdd	lmZdd
lmZddlmZdZWney�d
ZYn0e�e�Zer�gd�ngZdd�dd�Zdd�dd�Zeee e d�dd�Z!dddd�Z"dddd�Z#e e d�dd �Z$e e d!�d"d#�Z%d'e e ee&e	e'e e fd$�d%d&�Z(dS)(zk
This compat module handles various platform specific calls that do not fall into one
particular category.
�)�absolute_importN)�Optional)�Tuple)�errors)�os)�error)�shell)�GetStdHandle)�STD_OUTPUT_HANDLEFT)z	/usr/sbinz/usr/local/binz/usr/local/sbin)�returncCstst��dkrt�d��dS)z�
    On Windows, raise if current shell does not have the administrative rights.
    Do nothing on Linux.

    :raises .errors.Error: If the current shell does not have administrative rights on Windows.
    rzAError, certbot must be run on a shell with administrative rights.N)�
POSIX_MODE�
shellwin32Z
IsUserAnAdminr�Error�rr�7/usr/lib/python3.9/site-packages/certbot/compat/misc.py�+raise_for_non_administrative_windows_rights!srcCsTtrdSd}z"tt�}|r,|�|��|B�Wn tyNtjddd�Yn0dS)zR
    On Windows, ensure that Console Virtual Terminal Sequences are enabled.

    N�zFailed to set console modeT)�exc_info)rr	r
ZSetConsoleModeZGetConsoleMode�
pywinerror�logger�debug)Z"ENABLE_VIRTUAL_TERMINAL_PROCESSING�hrrr�prepare_virtual_console,sr)�timeout�promptrcCsfzDt�tjggg|�\}}}|s8t�d�|r0|nd���|d��WSty`tj��YS0dS)a(
    Read user input to return the first line entered, or raise after specified timeout.

    :param float timeout: The timeout in seconds given to the user.
    :param str prompt: The prompt message to display to the user.

    :returns: The first line entered by the user.
    :rtype: str

    z,Timed out waiting for answer to prompt '{0}'�rN)�select�sys�stdinrr�format�readline�OSError)rrZrlist�_rrr�readline_with_timeout@s�r#z
C:\CertbotzC:\Certbot\libzC:\Certbot\log)ZconfigZworkZlogsz/etc/letsencryptz/var/lib/letsencryptz/var/log/letsencrypt)�folder_typercCstjdkrt|St|S)z�
    Return the relevant default folder for the current OS

    :param str folder_type: The type of folder to retrieve (config, work or logs)

    :returns: The relevant default folder.
    :rtype: str

    �nt)r�name�LINUX_DEFAULT_FOLDERS�WINDOWS_DEFAULT_FOLDERS)r$rrr�get_default_folderis

r))�pathrcCs.tjdkr|Stj�|�\}}||�dd�S)z�
    Replace unsupported characters in path for current OS by underscores.
    :param str path: the path to normalize
    :return: the normalized path
    :rtype: str
    r%�:r")rr&r*�
splitdrive�replace)r*�drive�tailrrr�.underscores_for_unsupported_characters_in_pathzs
r0)�cmd_name�	shell_cmd�envrc	Csnt�d||�tr0tj|dtjtjdd|d�}n$dd|g}tj|tjtjdd|d�}|j|j}}|j||fS)a#
    Run a command:
        - on Linux command will be run by the standard shell selected with
          subprocess.run(shell=True)
        - on Windows command will be run in a Powershell shell

    This function returns the exit code, and does not log the result and output
    of the command.

    :param str cmd_name: the user facing name of the hook being run
    :param str shell_cmd: shell command to execute
    :param dict env: environ to pass into subprocess.run

    :returns: `tuple` (`int` returncode, `str` stderr, `str` stdout)
    zRunning %s command: %sTF)r�stdout�stderr�universal_newlines�checkr3zpowershell.exez-Command)r4r5r6r7r3)	r�infor�
subprocess�run�PIPEr4r5�
returncode)r1r2r3�proc�line�out�errrrr�execute_command_status�s�
�rA)N))�__doc__Z
__future__rZloggingrr9r�typingrrZcertbotrZcertbot.compatrZ
pywintypesrrZwin32com.shellrr
Zwin32consoler	r
r�ImportErrorZ	getLogger�__name__rZSTANDARD_BINARY_DIRSrr�float�strr#r(r'r)r0�dict�intrArrrr�<module>sH

����
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({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