%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/share/hplip/base/__pycache__/
Upload File :
Create Path :
Current File : //usr/share/hplip/base/__pycache__/password.cpython-312.pyc

�

=	f�-���ddlZddlZddlZddlZddlmZmZddl�ddlm	Z	m
Z
ddlmZddlm
Z
dZd	�Zd
�Zd�ZGd�d
e�Zy)�N�)�utils�tui)�*)�BytesIO�StringIO)�input)�pexpect�c��ddl}td�td�ttj|��t	d�}|jd�}||fS)Nr�z
Username: z
Password: )�getpass�print�log�boldr	)�promptr�username�passwords    �!/usr/share/hplip/base/password.py�showPasswordPromptr&sI���	�2�J�	�2�J�	�3�8�8�F����\�"�H��w���|�,�H��h���c�4�ddl}|jd��dS)NrF)�full_distribution_name)�distro�linux_distribution)rs r�get_distro_namer2s����$�$�E�$�B�1�E�Erc��t�S�N)r)�os_name1s r�get_distro_std_namer 7s����rc�l�eZdZefd�Zd�Zd�Zdd�Zdd�Zdd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zdd
�Zd�Zy)�Passwordc��d|_d|_d|_||_t	j
�|_g|_t	jtjddd��s]t	jtjddd��r3t	jtjddd��r	d|_�nt	jtjddd��s\t	jtjddd��s2t	jtjddd��rd|_n�t	jtjddd��s[t	jtjddd��s1t	jtjddd��rd|_tjD]B}	tj|tj�}|jj!|��Dy#t"$r|jj!|�Y�lwxYw)Nr
F�	configure�qt5�0�qt4�qt3)�_Password__password�_Password__password_prompt_str�_Password__passwordValidated�_Password__moder�readAuthType�_Password__authType�_Password__expectList�to_bool�sys_conf�get�_Password__ui_toolkit�EXPECT_WORD_LIST�re�compile�I�append�	TypeError)�self�Mode�s�ps    r�__init__zPassword.__init__=sl�����%'��"�#(�� �����,�,�.�������}�}�X�\�\�+�u�c�B�C�PU�P]�P]�^f�^j�^j�kv�x}�@C�_D�QE�JO�JW�JW�X`�Xd�Xd�ep�rw�y|�X}�J~� %�D�����x�|�|�K���D�E�e�m�m�\d�\h�\h�it�v{�~A�]B�OC�HM�HU�HU�V^�Vb�Vb�cn�pu�wz�V{�H|� %�D�����x�|�|�K���D�E�e�m�m�\d�\h�\h�it�v{�~A�]B�OC�HM�HU�HU�V^�Vb�Vb�cn�pu�wz�V{�H|� %�D���'�'�	,�A�
,��J�J�q�"�$�$�'���!�!�(�(��+�
	,���
,��!�!�(�(��+�
,�s�#$H%�%$I�Ic�R�|jdk(rydtjd�zS)N�su�*Please enter the root/superuser password: �)Please enter the sudoer (%s)'s password: �USER)r.�os�getenv�r:s r�__getPasswordDisplayStringz#Password.__getPasswordDisplayString[s%���?�?�d�"�?�>����6�AR�R�Rrc��|jdk(rd|_nd|_tjdd|j�y)N�sudor@�authentication�su_sudo)r.�	user_conf�setrFs r�__changeAuthTypezPassword.__changeAuthTypeas1���?�?�f�$�"�D�O�$�D�O��
�
�&�	�4�?�?�Crc��|dk(r*|jdk(rd}ndtjd�z}tjtj|��S)Nr
r@rArBrC)r.rDrErrr)r:�pswd_msgs  r�__get_passwordzPassword.__get_passwordhsK���r�>����$�&�G��F�����J������s�x�x��1�2�2rc���|dk(rd}|jdk(rddlm}|||d�\}}n6|jdk(rddlm}|||d�\}}nddlm}|||d�\}}|dk(r|dk(rtd��|S)	Nr
ziYour HP Device requires to install HP proprietary plugin
Please enter root/superuser password to continuer(r)�showPasswordUIFr%zUser Cancel)r3�ui.setupformrS�ui5.setupdialog�ui4.setupdialog�	Exception)r:rP�userrSrrs      r�__get_password_uizPassword.__get_password_uiqs����r�>�D�H�����%�3�!/��$��!F��H�h�
�
�
�%�
'�6�!/��$��!F��H�h�6�!/��$��!F��H�h��r�>�h�"�n��M�*�*��rc�^�ddl}|j�}d\}}	tj||��}		tj
�}	t
�|j|j�}	|j}
|
r%tj
�}|j|
�|	dk(rd|j�}}�n
|	dk(r�d|vr�|jdk(r�|
jd	d
�}
|
jdd�}
|
|_	tj|
tj �}|jj#|�t&j)d
|jz���|jdk(r:t*j,|	|_t&j)d|jz�|j/|j0���~	t7�	|j9�|r|j<|fSy#tj$rYywxYw#t$$r|jj#|
�Y��wxYw#t2tjf$r}t&j5�Yd}~��d}~wwxYw#t:$rY��wxYw#t7�	|j9�w#t:$rYwwxYwxYw)Nr)Fr
)�timeout)rr
Tr�truer
�[z\[�]z\]z*Adding missing password prompt string [%s]z$Updating password prompt string [%s])�iorr
�spawnu�ExceptionPexpect�time�update_spinner�expectr/�before�write�getvaluer*�replacer5r6r7r8r9r�debugrr4�sendliner)rW�	exception�cleanup_spinner�close�OSError�
exitstatus)
r:�cmdr[r_�output�ok�ret�child�start�i�cbr=�es
             r�__password_checkzPassword.__password_check�s]�����������C�	��N�N�3��8�E�4	�+
 ��	�	����"�$����T�%6�%6�7�A����B�� $�	�	������R�(��A�v�"&����(9�C����a��!�S�=�T�-G�-G�2�-M�!#���C��!7�B�!#���C��!7�B�9;�D�6�<�$&�J�J�r�2�4�4�$8��!%� 1� 1� 8� 8�� ;��I�I� L�t�Oi�Oi� i�k� � �5�5��;�9>�9O�9O� !�:#�D�6��I�I� F��Ic�Ic� c�e����t���7�K��>
��
����
���#�#�S�(�(���{�'�'�	��	��:$-�=� $� 1� 1� 8� 8�� <�=��"�w�7�7�8�
 ��
�
����
 ���
��
��	
��
����
���
��
�s��G4�C	H7�>$H
�"B%H7�J�I1�4H
�	H
�
$H4�1H7�3H4�4H7�7I.�I)�$J�)I.�.J�1	I=�<I=�J,�J�J,�	J)�&J,�(J)�)J,c��d}	|jtk(r|j|�|_nV	|j	�dk(r|j|d�|_n*|j|t
jd��|_|j�dz}tj|�|j|�\}}tjd|�d|�d	��|jtk(rA|jd
k(rddlm}n+|jd
k(rddlm}n|jdk(rddlm}|dk(rd|_yd|vrX|j)�d}|jtk(r|�td��tj+|�td��d|_|dz
}|jtk(r(|t,kDr	d�ydt,dz|z
z�nA|t,kDrtj+d�ytj+dt,dz|z
z���#t$r}tj|�Yd}~yd}~wwxYw)NrTr@�rootrCr\z	status = z	  output=� r'r)�FailureMessageUIr%r(znot in the sudoers filezLUser doesn't have sudo permissions.
Changing Authentication Type. Try again.z User is not in the sudoers file.r
zPassword incorrect. z'Password incorrect. %d attempt(s) left.)r,�INTERACTIVE_MODE�_Password__get_passwordr)�getAuthType�_Password__get_password_uirDrErWrri�
getAuthCmd�_Password__password_check�GUI_MODEr3rVr}rUrTr+�_Password__changeAuthType�error�PASSWORD_RETRY_COUNT)	r:rP�x�exrp�statusrqr}�msgs	         r�__validatePasswordzPassword.__validatePassword�s��
����{�{�.�.�"&�"5�"5�h�"?���	��'�'�)�T�1�*.�*@�*@�$�f�+.���+/�*@�*@�$�b�i�i��&7�+9����/�/�#�f�,�C��I�I�c�N�!�2�2�3�7�N�F�F��I�I�6�6�B�C��{�{�h�&��$�$��-�@��&�&�%�/�@��&�&�%�/�=���{�+/��(��*�f�4��%�%�'�e���;�;�(�*�$�S�)� � B�C�C��I�I�c�N�� B�C�C�#%����Q����;�;�(�*��/�/�(�)?�@��(�)R�0�1�4�q�8�*:�;��/�/��	�	�"8�9���	�	�"K�0�1�4�q�8�#:�;�u��!���I�I�b�M����s�AH#�#	I�,I�Ic�D�|jdk(r	d\}}||fSd\}}||fS)Nr@�r@z
su -c "%s"�rIzsudo %s)r.�r:�AuthType�AuthCmds   r�__get_password_utilszPassword.__get_password_utils	s<���?�?�d�"� 2��H�g��� � �!2��H�g��� � rc���tj�\}}|j�jdd�}t	|�}|j
dk(rd\}}nd\}}	||fS)Nr|r
rIr�r�)rr�lowerrhr r.)r:�os_name�_ver�distro_namer�r�s      r�__get_password_utils_uiz Password.__get_password_utils_uish���.�.�0�����-�-�/�)�)�#�b�1��)�'�2���?�?�f�$� 1��H�g� 2��H�g�		��� � rc��tjd�d|_d|_|jdk(rtjd�yy)NzClearing password...r
FrIzsudo -K)rrir)r+r.r�runrFs r�
clearPasswordzPassword.clearPassword(s;���	�	�(�)����#(�� ��?�?�f�$��I�I�i� �%rc�n�|jtk(r|j}|S|j�\}}|Sr)r,r~r.� _Password__get_password_utils_ui)r:�retValuer�s   rr�zPassword.getAuthType/s9���;�;�*�*����H���!%� <� <� >��H�g��rc�|�|jtk(r|j�\}}|S|j�\}}|Sr)r,r~�_Password__get_password_utilsr�r�s   rr�zPassword.getAuthCmd7sC���;�;�*�*� $� 9� 9� ;��H�g���!%� <� <� >��H�g��rc��|jr|jS|r|jS|j|�|jSr)r+r)�_Password__validatePassword)r:rP�psswd_queried_cnts   r�getPasswordzPassword.getPassword?s:���#�#��?�?�"���?�?�"�����)����rc��|jSr)r*rFs r�getPasswordPromptStringz Password.getPasswordPromptStringIs���)�)�)rN)r
)r
r{)�
)r
r)�__name__�
__module__�__qualname__r~r>�#_Password__getPasswordDisplayStringr�rr�r�r�r�r�r�r�r�r�r��rrr"r";sP��,�,�<S�D�3��&D�L=;�~!�!�.!����*rr")rDrrb�stringr
rr�g�sixextrr�sixext.movesr	r
r�rrr �objectr"r�rr�<module>r�sF��*
���
���%����� �F�
�O*�v�O*r

Zerion Mini Shell 1.0