%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/certbot/compat/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/certbot/compat/__pycache__/misc.cpython-312.pyc

�

M/�e$��x�dZddlmZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
	ddlmZdd	lmZdd
lmZddlmZdZej2e�Zergd�ngZd$d�Zd$d�Zdedee de fd�Z!dddd�Z"dddd�Z#de de fd�Z$de de fd�Z%	d%d e d!e d"ee&de	e'e e ffd#�Z(y#e$rd
ZY�lwxYw)&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�returnc�j�ts-tj�dk(rtjd��yy)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�
shellwin32�
IsUserAnAdminr�Error���5/usr/lib/python3/dist-packages/certbot/compat/misc.py�+raise_for_non_administrative_windows_rightsr!s.���*�2�2�4��9��l�l�^�_�_�:�:rc���tryd}	tt�}|r#|j|j	�|z�yy#t
$rtjdd��YywxYw)zR
    On Windows, ensure that Console Virtual Terminal Sequences are enabled.

    N�zFailed to set console modeT)�exc_info)rr
r�SetConsoleMode�GetConsoleMode�
pywinerror�logger�debug)�"ENABLE_VIRTUAL_TERMINAL_PROCESSING�hs  r�prepare_virtual_consoler ,sj��
��*0�&�B��*�+���
���Q�-�-�/�2T�T�U�
���B����1�D��A�B�s�3A� A#�"A#�timeout�promptc�>�	tjtjggg|�\}}}|s0tjdj|r
|���d���|dj
�S#t$r!tjj
�cYSwxYw)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}'�r)�select�sys�stdinrr�format�readline�OSError)r!r"�rlist�_s    r�readline_with_timeoutr-@s���$��m�m�S�Y�Y�K��R��A���q�!���,�,�>�E�E�PV�f�_�a�
a�\^�_�a�
a��Q�x� � �"�"���$��y�y�!�!�#�#�
$�s�A/A2�2'B�Bz
C:\CertbotzC:\Certbot\libzC:\Certbot\log)�config�work�logsz/etc/letsencryptz/var/lib/letsencryptz/var/log/letsencrypt�folder_typec�L�tjdk7r	t|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)r1s r�get_default_folderr7is%��
�w�w�$��$�[�1�1�"�;�/�/r�pathc��tjdk7r|Stjj|�\}}||j	dd�zS)z�
    Replace unsupported characters in path for current OS by underscores.
    :param str path: the path to normalize
    :return: the normalized path
    :rtype: str
    r3�:r,)rr4r8�
splitdrive�replace)r8�drive�tails   r�.underscores_for_unsupported_characters_in_pathr?zsD��
�w�w�$�����'�'�$�$�T�*�K�E�4��4�<�<��S�)�)�)r�cmd_name�	shell_cmd�envc	�t�tjd||�tr9tj|dtj
tj
dd|��}n<dd|g}tj|tj
tj
dd|��}|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�checkrBzpowershell.exez-Command)rDrErFrGrB)	r�infor�
subprocess�run�PIPErDrE�
returncode)r@rArB�proc�line�out�errs       r�execute_command_statusrQ�s���"�K�K�(�(�I�>���~�~�i�t�J�O�O�%/�_�_��$)�s�4��!�*�i�8���~�~�d�:�?�?�:�?�?�15�U��M��
�{�{�D�K�K��C��?�?�C��$�$r)rN)N))�__doc__�
__future__r�loggingr%rIr&�typingrr�certbotr�certbot.compatr�
pywintypesrr�win32com.shellr	r�win32consoler
rr�ImportError�	getLogger�__name__r�STANDARD_BINARY_DIRSrr �float�strr-r6r5r7r?�dict�intrQrrr�<module>rcs%���'��
��
������.�2�)�.��J�

��	�	�8�	$��NX�I�]_��`�B�($�5�$�(�3�-�$�C�$�<�����!�"�"���0�C�0�C�0�"
*��
*��
*�"26�%�S�%�S�%� (���%�:?��S�#�
�:N�%��g���J��s�B/�/B9�8B9

Zerion Mini Shell 1.0