%PDF- %PDF-
Mini Shell

Mini Shell

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

�

M/�e�4��>�dZddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	dd	lm
Z
dd
lmZddlm
Z
ddlmZdd
lmZddlmZddlmZddlmZej.e�Zd8dededefd�Zdeej:de	ej:fd�Zd9deede	edeefd�Z	d9de	e
j@de	edeefd�Z!deedeefd�Z"deedeefd�Z#	d9deede	ede
eeeffd �Z$d:d!edeefd"�Z%deeddfd#�Z&d$eeddfd%�Z'd&eddfd'�Z(d(ed)e)d*ed+eddf
d,�Z*deedefd-�Z+	d9d.ed/e
eeffd0eegefd1ed2e	ed3ede
eeffd4�Z,d0eegefd5ed3ede
eeffd6�Z-d0eegefd5ed3ede
eeffd7�Z.y);z+Contains UI methods for LE user operations.�N)�indent)�Any)�Callable)�Iterable)�List)�Optional)�Tuple)�errors)�
interfaces)�util)�account)�os�invalid�optional�returnc��d}d}d}|r
|r||z
}d}nd}nd}		tj|r||zn|d��\}}|tjk7r,|rtj
d��tj
d	��t
j|�r|S|r||z}d}t|�}��#tj$rd}tj|��wxYw)
aJPrompt for valid email address.

    :param bool invalid: True if an invalid address was provided by the user
    :param bool optional: True if the user can use
        --register-unsafely-without-email to avoid providing an e-mail

    :returns: e-mail address
    :rtype: str

    :raises errors.Error: if the user cancels

    z-There seem to be problems with that address. zCEnter email address (used for urgent renewal and security notices)
a

If you really want to skip this, you can run the client with --register-unsafely-without-email but you will then be unable to receive notice about impending expiration or revocation of your certificates or problems with your Certbot installation that will lead to failure to renew.

FT��force_interactivezoYou should register before running non-interactively, or provide --agree-tos and --email <email_address> flags.zHAn e-mail address or --register-unsafely-without-email must be provided.z#An e-mail address must be provided.)	�display_util�
input_textr
�MissingCommandlineFlag�OK�Errorr�
safe_email�bool)rr�invalid_prefix�msg�unsafe_suggestion�suggest_unsafe�code�emails        �5/usr/lib/python3/dist-packages/certbot/display/ops.py�	get_emailr#s��E�N�
P�C�P�����$�$�C�"�N�!�N���
�	5�&�1�1�'�.�3�2F�WZ�DH�J�K�D�%��<�?�?�"���l�l�J�K�K��,�,�D�E�E��?�?�5�!��L��#�c�)�C�"�N��u�+��+���,�,�	5�O�C��/�/��4�4�	5�s�!B&�&+C�accountsc��|D�cgc]}|j��}}tjd|d��\}}|tjk(r||Sycc}w)zChoose an account.

    :param list accounts: Containing at least one
        :class:`~certbot._internal.account.Account`

    zPlease choose an accountTrN)�slugr�menur)r$�acc�labelsr �indexs     r"�choose_accountr+LsS��#+�
+�3�c�h�h�
+�F�
+��#�#�$>��Z^�_�K�D�%��|����������,s�A�values�questionc�r�tj|r|nd|d��\}}|tjk(r|r|SgS)aDisplay screen to let user pick one or multiple values from the provided
    list.

    :param list values: Values to select from
    :param str question: Question to ask to user while choosing values

    :returns: List of selected values
    :rtype: list
    �T)�tagsr)r�	checklistr)r,r-r �itemss    r"�
choose_valuesr3\s<���(�(�X��2�F�;?�A�K�D�%��|����5���
�I��	installerc���|�tjd�t�St|j	��}t|�}|s
t�St
||�\}}|tjk(r|r|SgS)aQDisplay screen to select domains to validate.

    :param installer: An installer object
    :type installer: :class:`certbot.interfaces.Installer`

    :param `str` question: Overriding default question to ask the user if asked
        to choose from domain names.

    :returns: List of selected names
    :rtype: `list` of `str`

    z$No installer, picking names manually)	�logger�debug�_choose_names_manually�list�
get_all_names�get_valid_domains�
_filter_namesrr)r5r-�domains�namesr s     r"�choose_namesr@msq�������;�<�%�'�'��9�*�*�,�-�G��g�&�E��%�'�'���x�0�K�D�%��|����5���
�Ir4r>c��g}|D]'}	|jtj|���)|S#tj$rY�AwxYw)z�Helper method for choose_names that implements basic checks
     on domain names

    :param list domains: Domain names to validate
    :return: List of valid domains
    :rtype: list
    )�appendr�enforce_domain_sanityr
�ConfigurationError)r>�
valid_domains�domains   r"r<r<�sX�� "�M����	�� � ��!;�!;�F�!C�D��
����(�(�	��	�s�$1�A�A�FQDNsc��t|d���S)z�Sort FQDNs by SLD (and if many, by their subdomains)

    :param list FQDNs: list of domain names

    :returns: Sorted list of domain names
    :rtype: list
    c�6�|jd�ddd�ddS)N�.����)�split)�fqdns r"�<lambda>z_sort_names.<locals>.<lambda>�s��$�*�*�S�/�$�B�$�*?���*C�r4)�key)�sorted)rGs r"�_sort_namesrR�s���%�C�D�Dr4r?�override_questionc��t|�}|r|}nd}tj||dd��\}}||D�cgc]
}t|���c}fScc}w)aDetermine which names the user would like to select from a list.

    :param list names: domain names

    :returns: tuple of the form (`code`, `names`) where
        `code` - str display exit code
        `names` - list of names selected
    :rtype: tuple

    z�Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.�	--domainsT)r0�cli_flagr)rRrr1�str)r?rS�sorted_namesr-r �ss      r"r=r=�s]���u�%�L��$��
�	��(�(��|�k�T�S�K�D�%��%�(�Q�#�a�&�(�(�(��(s�A
�
prompt_prefixc��tj|dzdd��\}}|tjk(r�i}d}	tj|�}t|�D]\}}	tj|�||<� |r}dj
tj�}|j�D])\}	}
|d	j
tj|	|
�z}�+|d
j
tj�z}|r%tj |d��}|r
t#�SgS|SgS#t
$r%g}dj
tj�}Y��wxYw#tj$r}t|�||<Yd}~��#d}~wwxYw)z�Manually input names for those without an installer.

    :param str prompt_prefix: string to prepend to prompt for domains

    :returns: list of provided names
    :rtype: `list` of `str`

    zaPlease enter the domain name(s) you would like on your certificate (comma and/or space separated)rUT)rVrr/ziInternationalized domain names are not presently supported.{0}{0}Would you like to re-enter the names?{0}Nz<One or more of the entered domain names was not valid:{0}{0}z{1}: {2}{0}z+{0}Would you like to re-enter the names?{0}r)rrr�internal_display_util�separate_list_input�UnicodeEncodeError�formatr�linesep�	enumeraterrCr
rDrWr2�yesnor9)rZr �input_�invalid_domains�
retry_message�domain_list�irF�e�invalid_domain�err�retrys            r"r9r9�s��� �*�*��	)�	)���	6�L�D�&��|�������
�	0�/�C�C�F�K�K�#�;�/�	1�I�A�v�
1�!%�!;�!;�F�!C��A��	1��� �&����,�
�(7�'<�'<�'>�
5�#��� -�
�0D�0D��J�J���15�!5�
�
5�*�=�v�v��J�J�@ � �M�� �&�&�}��M�E��-�/�/��I���
�I��?"�	0��K��#�V�B�J�J�/�
�	0���,�,�
1�*-�a�&���'��
1�s)�D"�E�"*E�E�E?�&E:�:E?c�^�tjdjt|���y)zsDisplay a box confirming the installation of HTTPS.

    :param list domains: domain names which were enabled

    z;Congratulations! You have successfully enabled HTTPS on {0}N)r�notifyr_�_gen_https_names�r>s r"�success_installationrp�s%�����E�	�� ��)�	*�r4�unused_domainsc�.�tjd�y)z�Display a box confirming the renewal of an existing certificate.

    :param list domains: domain names which were renewed

    zdYour existing certificate has been successfully renewed, and the new certificate has been installed.N)rrm)rqs r"�success_renewalrss�����	.�r4�	cert_pathc�L�tjdj|��y)z�Display a message confirming a certificate has been revoked.

    :param list cert_path: path to certificate which was revoked.

    zWCongratulations! You have successfully revoked the certificate that was located at {0}.N)rrmr_)rts r"�success_revocationrvs!�����	#�#)�6�)�#4�r4�command_name�
returncode�stdout�stderrc��|j�|j�}}|dk7rtjd||�|r$tj|�dt|d����|r"tjd|t|d��yy)aqDisplay a message describing the success or failure of an executed process (e.g. hook).

    :param str command_name: Human-readable description of the executed command
    :param int returncode: The exit code of the executed command
    :param str stdout: The stdout output of the executed command
    :param str stderr: The stderr output of the executed command

    rz%s reported error code %dz ran with output:
� z%s ran with error output:
%sN)�stripr7�warningrrmr)rwrxryrz�out_s�err_ss      r"�report_executed_commandr�sw���<�<�>�6�<�<�>�5�E��Q�����2�L�*�M�����|�n�,?��u�c�@R�?S�T�U�����6��f�U�TW�FX�Y�
r4c��t|�dk(rdj|d�St|�dk(rdj|��St|�dkDr/djdjd	�|d
dD��d|d�Sy
)z�Returns a string of the https domains.

    Domains are formatted nicely with ``https://`` prepended to each.

    :param list domains: Each domain is a 'str'

    rLzhttps://{0}r�z%https://{dom[0]} and https://{dom[1]})�domz	{0}{1}{2}z, c3�&K�|]	}d|z���y�w)z
https://%sN�)�.0r�s  r"�	<genexpr>z#_gen_https_names.<locals>.<genexpr>;s����A�S�l�S�(�A�s�NrKz, and https://r/)�lenr_�joinros r"rnrn-s����7�|�q���#�#�G�A�J�/�/�	�W���	�6�=�=�'�=�J�J�	�W���	��!�!��I�I�A�G�C�R�L�A�A���B�K��	�
r4�method.�	validator�message�default�kwargsc���|�		||�	||fd|i|��\}}|tjk(r
	||�||fS||fS#tj$r4tjd||d��t	dj|���wxYw#tj$rC}tjd||d��t
jt|�d��Yd}~nd}~wwxYw��)	Nz>Encountered invalid default value "%s" when prompting for "%s"T)�exc_infozInvalid default "{0}"r�z/Validator rejected "%s" when prompting for "%s"F)�pause)
r
rr7r8�AssertionErrorr_rr�notificationrW)r�r�r�r�r�r �raw�errors        r"�_get_validatedr�Bs����	J��g����7�>�G�>�v�>�	��c��<�?�?�"�
C��#���S�y� ���9���)�|�|�	J��L�L�Y� � �"&�
�
(�!�!8�!?�!?��!H�I�I�	J���<�<�
C����N� �$�&*��,��)�)�#�e�*�E�B�B��
C��
s!�?�B	�AB�	C�9C�C�argsc�>�ttj|g|��i|��S)aLike `~certbot.display.util.input_text`, but with validation.

    :param callable validator: A method which will be called on the
        supplied input. If the method raises an `errors.Error`, its
        text will be displayed and the user will be re-prompted.
    :param list `*args`: Arguments to be passed to `~certbot.display.util.input_text`.
    :param dict `**kwargs`: Arguments to be passed to `~certbot.display.util.input_text`.
    :return: as `~certbot.display.util.input_text`
    :rtype: tuple
    )r�rr�r�r�r�s   r"�validated_inputr�_s!���,�1�1�9�N�t�N�v�N�Nr4c�>�ttj|g|��i|��S)a"Like `~certbot.display.util.directory_select`, but with validation.

    :param callable validator: A method which will be called on the
        supplied input. If the method raises an `errors.Error`, its
        text will be displayed and the user will be re-prompted.
    :param list `*args`: Arguments to be passed to `~certbot.display.util.directory_select`.
    :param dict `**kwargs`: Arguments to be passed to
        `~certbot.display.util.directory_select`.
    :return: as `~certbot.display.util.directory_select`
    :rtype: tuple
    )r�r�directory_selectr�s   r"�validated_directoryr�ns!���,�7�7��T�T�T�V�T�Tr4)FT)N)r/)/�__doc__�logging�textwrapr�typingrrrrrr	�certbotr
rr�certbot._internalr
�certbot._internal.displayr\�certbot.compatr�certbot.displayr�	getLogger�__name__r7rrWr#�Accountr+r3�	Installerr@r<rRr=r9rprsrv�intr�rnr�r�r�r�r4r"�<module>r�s���1������������%�C��0�	��	�	�8�	$��3�t�3�t�3�s�3�l
�T�'�/�/�2�
�x����7P�
� �$�s�)��x��}���S�	��$,0��H�Z�%9�%9�:��#�C�=��48��I��<�x��}���c���"E�x��}�E��c��E�6:�)��#��)�%-�c�]�)�>C�C��c��N�>S�)�43�#�3�t�C�y�3�l	�$�s�)�	��	�	�D��I�	�$�	�	�#�	�$�	�Z�#�Z�3�Z��Z�UX�Z�]a�Z�$�d�3�i��C��.-1��8�C��s�C�x��$8�9��&��u�c�z�2��=@��$�S�M��<?��DI�#�s�(�O��:O�x���s�
�3�O��O�*-�O�27��S��/�O�
U�8�S�E�3�J�#7�
U�"�
U�.1�
U�6;�C��H�o�
Ur4

Zerion Mini Shell 1.0