QffdZddlZddlZddlZddlZddlZgdZGddeZd dZ d dZ d dZ d d Z d Z ddlZejej fe Zy#eef$r ddlZe ZYy#e$re ZYYywxYwwxYw) aUtilities 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)getpassgetuserGetPassWarningc eZdZy)rN)__name__ __module__ __qualname__./opt/alt/python312/lib64/python3.12/getpass.pyrrsr rcd}tj5} tjdtjtj z}t j|d}|j|t j|}|j||s|}| t'j(|}|dd}|dxxt&j*zcc<t&j,} t/t&dr| t&j0z} t'j2|| |t5|||}t'j2|| ||j7 |j;d|cdddS#t$ry|j tjj}n##tt f$rd}t#||}YnwxYwtj}|stj$}YWwxYw#t'j2|| ||j7wxYw#t&j8$r'|||ur|jt#||}YwxYw#1swYyxYw)aPrompt 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/ttyzw+TCSASOFT)input ) contextlib ExitStackosopenO_RDWRO_NOCTTYioFileIO enter_context TextIOWrapperOSErrorclosesysstdinfilenoAttributeError ValueErrorfallback_getpassstderrtermios tcgetattrECHO TCSAFLUSHhasattrr tcsetattr _raw_inputflusherrorwrite) promptstreampasswdstackfdttyroldnewtcsetattr_flagss r unix_getpassr8s F    5 $RYYr{{%:;B))B%C    $$$S)E    & > :''+!fA7<<-'")"3"37J/#w'7'77O#%%b/3?'eDF%%b/3?LLN  Tc11 $ KKM :YY%%'"J/ :)&&9 :IIE $0%%b/3?LLN== :%&KKM)&&9 :I sI#BE5I#"A)H& %G:1'H&I#5G7F.-G7.G G7 G%G73I#6G77I#:)H##H&&6I I#I  I##I,cftjtjur t||S|D]}t j |d} t j }|dk(s|dk(rn|dk(rt|dk(r|dd}n||z};t j dt j d|S)z:Prompt for password with echo off, using Windows getwch(). rN)rr __stdin__r#msvcrtputwchgetwchKeyboardInterrupt)r/r0cpws r win_getpassrFas yy %//  a B MMO 9T  ;# # 9CRBaB  MM$ MM$ Ir ctjdtd|stj}t d|t ||S)Nz%Can not control echo on the terminal.) stacklevelz&Warning: Password input may be echoed.)file)warningswarnrrr$printr+)r/r0s r r#r#xs: MM9>  2@ ff %%r c|stj}|stj}t|}|r" |j ||j|j}|st|ddk(r|dd}|S#t $rK|j |jd}|j|j}|j |YwxYw)Nreplacer>r) rr$rstrr.UnicodeEncodeErrorencodeencodingdecoder,readlineEOFError)r/r0rlines r r+r+s    [F  ! LL   >> D  Bx4CRy K" !]]6??I>F]]6??3F LL  !sA;;ACCcdD]'}tjj|}|s%|cSddl}|j tj dS)zGet 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. )LOGNAMEUSERLNAMEUSERNAMErN)renvirongetpwdgetpwuidgetuid)nameuserr_s r rrsG9zz~~d# K9  << $Q ''r )z Password: N)r:NN)__doc__rrrrrK__all__ UserWarningrr8rFr#r+rr%r&r*r ImportErrorr!r@r r r rhs    0(['AH.&2($  w(((G ^$ #"#s/AA8!A)%A8)A40A83A44A8