
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3

  \j  ã               @   sÚ   d Z ddlZddlZddlZddlZddlZdddgZG dd„ deƒZddd	„Z	dd
d„Z
ddd„Zddd„Zdd„ ZyddlZejejf W nB eefk
rÐ   yddlZW n ek
rÆ   eZY nX e
ZY nX e	ZdS )a‡  Utilities to get a password and/or the current user name.

getpass(prompt[, stream]) - Prompt for a password, with echo turned off.
getuser() - Get the user name from the environment or password database.

GetPassWarning - This UserWarning is issued when getpass() cannot prevent
                 echoing of the password contents while reading.

On Windows, the msvcrt module will be used.

é    NÚgetpassÚgetuserÚGetPassWarningc               @   s   e Zd ZdS )r   N)Ú__name__Ú
__module__Ú__qualname__© r   r   ú/usr/lib64/python3.6/getpass.pyr      s    ú
Password: c          .   C   s´  d}t jƒ ��œ}yJtjdtjtjB ƒ}tj|dƒ}|j|ƒ tj	|ƒ}|j|ƒ |sX|}W np t
k
rÊ } zT|jƒ  ytjjƒ }W n& ttfk
r¨   d}t| |ƒ}Y nX tj}|sºtj}W Y dd}~X nX |dk	�rœy„tj|ƒ}|dd… }	|	d  tj M  < tj}
ttdƒ�r|
tjO }
z tj||
|	ƒ t| ||d�}W dtj||
|ƒ |jƒ  X W n@ tjk
�rš   |dk	�rz‚ ||k	�rŒ|jƒ  t| |ƒ}Y nX |jdƒ |S Q R X dS )a  Prompt for a password, with echo turned off.

    Args:
      prompt: Written on stream to ask for the input.  Default: 'Password: '
      stream: A writable file object to display the prompt.  Defaults to
              the tty.  If no tty is available defaults to sys.stderr.
    Returns:
      The seKr3t input.
    Raises:
      EOFError: If our input tty or stdin was closed.
      GetPassWarning: When we were unable to turn echo off on the input.

    Always restores terminal settings before returning.
    Nz/dev/ttyzw+é   Ú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Ú	tcgetattrZECHOZ	TCSAFLUSHÚhasattrr   Ú	tcsetattrÚ
_raw_inputÚflushÚerrorÚwrite)ÚpromptÚstreamZpasswdÚstackÚfdZttyr   ÚeÚoldÚnewZtcsetattr_flagsr   r   r	   Úunix_getpass   sR    








r1   c             C   s”   t jt jk	rt| |ƒS x| D ]}tj|ƒ qW d}xHtjƒ }|dksL|dkrNP |dkrZt‚|dkrp|dd… }q4|| }q4W tjdƒ tjdƒ |S )	z9Prompt for password with echo off, using Windows getch().Ú úr   úúNé   éÿÿÿÿ)r   r   Ú	__stdin__r    ÚmsvcrtZputwchZgetwchÚKeyboardInterrupt)r*   r+   ÚcZpwr   r   r	   Úwin_getpassa   s"    



r<   c             C   s0   t jdtdd� |stj}td|d� t| |ƒS )Nz%Can not control echo on the terminal.é   )Ú
stacklevelz&Warning: Password input may be echoed.)Úfile)ÚwarningsÚwarnr   r   r!   Úprintr&   )r*   r+   r   r   r	   r    x   s    r    r2   c             C   sœ   |s
t j}|st j}t| ƒ} | rpy|j| ƒ W n8 tk
rf   | j|jdƒ} | j|jƒ} |j| ƒ Y nX |j	ƒ  |j
ƒ }|s€t‚|d dkr˜|d d… }|S )NÚreplacer6   r   r7   r7   )r   r!   r   Ústrr)   ÚUnicodeEncodeErrorÚencodeÚencodingÚdecoder'   ÚreadlineÚEOFError)r*   r+   r   Úliner   r   r	   r&   �   s&    r&   c              C   s<   x dD ]} t jj| ƒ}|r|S qW ddl}|jt jƒ ƒd S )zÂGet the username from the environment or password database.

    First try various environment variables, then the password
    database.  This works on Windows as long as USERNAME is set.

    ÚLOGNAMEÚUSERÚLNAMEÚUSERNAMEr   N)rL   rM   rN   rO   )r   ÚenvironÚgetÚpwdÚgetpwuidÚgetuid)ÚnameÚuserrR   r   r   r	   r   š   s    
)r
   N)r
   N)r
   N)r2   NN)Ú__doc__r   r   r   r   r@   Ú__all__ÚUserWarningr   r1   r<   r    r&   r   r"   r#   r%   ÚImportErrorr   r9   r   r   r   r   r	   Ú<module>   s,   

D

	


