HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1991109/root/usr/lib/python3/dist-packages/certbot/compat/__pycache__/
Upload File :
Current File : //proc/1991109/root/usr/lib/python3/dist-packages/certbot/compat/__pycache__/misc.cpython-311.pyc
�

E��c$���dZddlmZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
	ddlmZdd	lmZdd
lmZddlmZdZn
#e$rd
ZYnwxYweje��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(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�returnc�n�ts+tj��dkrtjd���dSdS)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!sC���`�*�2�4�4��9�9��l�^�_�_�_�`�`�9�9rc��trdSd}	tt��}|r,|�|���|z��dSdS#t
$r t�dd���YdSwxYw)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 ,s���
����*0�&�B��*�+�+���	V�
���Q�-�-�/�/�2T�T�U�U�U�U�U�	V�	V���B�B�B����1�D��A�A�A�A�A�A�B���s�AA�&A;�:A;�timeout�promptc�:�	tjtjggg|��\}}}|s+tjd�|r|nd�����|d���S#t$r!tj���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�S�Y�K��R��A�A���q�!��	a��,�>�E�E�PV�F^�f�f�\^�_�_�a�a�
a��Q�x� � �"�"�"���$�$�$��y�!�!�#�#�#�#�#�
$���s�A,A/�/(B�Bz
C:\CertbotzC:\Certbot\libzC:\Certbot\log)�config�work�logsz/etc/letsencryptz/var/lib/letsencryptz/var/log/letsencrypt�folder_typec�V�tjdkr
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�$���$�[�1�1�"�;�/�/r�pathc��tjdkr|Stj�|��\}}||�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?zsH��
�w�$������'�$�$�T�*�*�K�E�4��4�<�<��S�)�)�)�)r�cmd_name�	shell_cmd�envc	�>�t�d||��tr0tj|dtjtjdd|���}n3dd|g}tj|tjtjdd|���}|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�>�>�>��M��~�i�t�J�O�%/�_��$)�s�4�4�4���!�*�i�8���~�d�:�?�:�?�15�U��M�M�M��
�{�D�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�2�2�2�2�2�)�)�)�)�)�)�.�.�.�.�.�.��J�J�������J�J�J�����
��	�8�	$�	$��NX�_�I�I�I�I�]_��`�`�`�`�B�B�B�B�($�5�$�(�3�-�$�C�$�$�$�$�<������!�"�"����0�C�0�C�0�0�0�0�"
*��
*��
*�
*�
*�
*�"26�%�%�S�%�S�%� (���%�:?��S�#�
�:N�%�%�%�%�%�%s�A
�
A�A