ACC SHELL
Path : /usr/lib/python/ |
|
Current File : //usr/lib/python/getpass.pyc |
Ńņ
nÄMc @ s? d Z d d k Z d d k Z d d k Z d d d g Z d e f d YZ d d d Z d d d Z d d d
Z
d d d d Z d
Z y d d k
Z
e
i e
i f Wn{ e e f j
oi y d d k Z WnI e j
o= y d d k l Z Wn e j
o
e
Z q0Xe Z q;Xe Z n Xe Z d S( sĮ 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.
On the Mac EasyDialogs.AskPassword is used, if available.
i’’’’Nt getpasst getusert GetPassWarningc B s e Z RS( ( t __name__t
__module__( ( ( s /usr/lib/python2.6/getpass.pyR s s
Password: c
C sŃ d } d } yL t i d t i t i B } t i | d d } | } | p
| } n Wn^ t j
oR } y t i i } Wn t
| | } n Xt i } | p
t i } q¹ n X| d j oś d } y¬ t i
| } | } | d c t i t i BM<t i } t t d o | t i O} n z, t i | | | t | | d | } Wd t i | | | | i XWqĄt i j
o2 } | d j o n ~ ~ t
| | } qĄXn | i d | S( s 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.
s /dev/ttys w+i i t TCSASOFTt inputNs
( t Nonet ost opent O_RDWRt O_NOCTTYt fdopent EnvironmentErrort syst stdint filenot fallback_getpasst stderrt termiost tcgetattrt ECHOt ISIGt TCSAFLUSHt hasattrR t tcsetattrt
_raw_inputt flusht errort write(
t promptt streamt fdt ttyR t et passwdt oldt newt tcsetattr_flags( ( s /usr/lib/python2.6/getpass.pyt unix_getpass sJ
c C sÜ t i t i j o t | | Sd d k } x | D] } | i | q4 Wd } xj | i } | d j p
| d j o Pn | d j o
t n | d j o | d } qT | | } qT | i d | i d | S( s9 Prompt for password with echo off, using Windows getch().i’’’’Nt s
s
s s ( R R t __stdin__R t msvcrtt putcht getcht KeyboardInterrupt( R R R* t ct pw( ( s /usr/lib/python2.6/getpass.pyt win_getpassY s&