a �DOgf� @s�ddlZddlZddlZddlZddlZgd�ZGdd�de�Zddd�Zddd �Z dd d �Z dd d�Z dd�Z zddl Z e je jfWn>eefy�z ddlZWney�e ZYn0e ZYn0eZdS)�N)�getpass�getuser�GetPassWarningc@s eZdZdS)rN)�__name__� __module__� __qualname__�rr�/usr/lib64/python3.9/getpass.pyr�r� Password: c Cs�d}t�����}zJt�dtjtjB�}t�|d�}|�|�t� |�}|�|�|sX|}Wn^t y�|� �zt j ��}Wn$ttfy�d}t||�}Yn0t j }|s�t j}Yn0|du�r�z�t�|�}|dd�}|dtjM<tj} ttd��r | tjO} z6t�|| |�t|||d�}Wt�|| |�|��nt�|| |�|��0Wn>tj�y�|du�r|�||u�r�|� �t||�}Yn0|�d�|Wd�S1�s�0YdS)Nz/dev/ttyzw+��TCSASOFT)�input� )� contextlib� ExitStack�os�open�O_RDWR�O_NOCTTY�io�FileIO� enter_context� TextIOWrapper�OSError�close�sys�stdin�fileno�AttributeError� ValueError�fallback_getpass�stderr�termios� tcgetattrZECHOZ TCSAFLUSH�hasattrr � tcsetattr� _raw_input�flush�error�write) �prompt�stream�passwd�stack�fdZttyr�old�newZtcsetattr_flagsrrr � unix_getpasssV             �   r2cCs�tjtjurt||�S|D]}t�|�qd}t��}|dkst|dkrHqt|dkrTt�|dkrj|dd�}q.||}q.t�d�t�d�|S)N�� r�������)rr� __stdin__r!�msvcrtZputwchZgetwch�KeyboardInterrupt)r+r,�cZpwrrr � win_getpassas       r<cCs0tjdtdd�|stj}td|d�t||�S)Nz%Can not control echo on the terminal.�)� stacklevelz&Warning: Password input may be echoed.)�file)�warnings�warnrrr"�printr')r+r,rrr r!xs� r!r3cCs�|s tj}|stj}t|�}|rnz|�|�Wn6tyd|�|jd�}|�|j�}|�|�Yn0|� �|� �}|s~t �|ddkr�|dd�}|S)N�replacer7r) rr"r�strr*�UnicodeEncodeError�encode�encoding�decoder(�readline�EOFError)r+r,r�linerrr r'�s&    r'cCs<dD]}tj�|�}|r|Sqddl}|�t���dS)N)ZLOGNAMEZUSERZLNAME�USERNAMEr)r�environ�get�pwd�getpwuid�getuid)�name�userrOrrr r�s   r)r N)r N)r N)r3NN)rrrrr@�__all__� UserWarningrr2r<r!r'rr#r$r&� ImportErrorrr9rrrrr �s* D