CasperSecurity

Current Path : /usr/lib/python3/dist-packages/keyring/__pycache__/
Upload File :
Current File : //usr/lib/python3/dist-packages/keyring/__pycache__/cli.cpython-310.pyc

o

���aT�@s�dZddlZddlZddlZddlmZddlmZddlmZmZm	Z	m
Z
Gdd�d�Zdd	d
�Ze
dkr>e�e��dSdS)
z@Simple command line interface to get/set password from a keyring�N�)�core)�backend)�set_keyring�get_password�set_password�delete_passwordc@sleZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zedd��Z
edd��ZdS)�CommandLineToolcCs�t��|_|jjdddddd�|jjddddd	d�|jjd
ddd
�|jjdddd
�|jjdddd�|jjddd�|jjddd�dS)Nz-pz--keyring-path�keyring_pathzPath to the keyring backend)�dest�default�helpz-bz--keyring-backend�keyring_backendzName of the keyring backendz--list-backends�
store_truezList keyring backends and exit)�actionr
z	--disablezDisable keyring and exit�	operationzget|set|del�?)r
�nargs�service)r�username)�argparse�ArgumentParser�parser�add_argument��self�r�-/usr/lib/python3/dist-packages/keyring/cli.py�__init__sH
������
�zCommandLineTool.__init__cCs||j�|�}t|��t|��|jrt��D]}t|�qdS|jr(t	��dS|�
�|��t|d|j
��|j�}|�S)N�do_)r�
parse_args�vars�update�
list_backendsr�get_all_keyring�print�disabler�_check_args�_load_spec_backend�getattrr�
invalid_op)r�argv�args�k�methodrrr�run4s
zCommandLineTool.runcCs:|jr|jdus
|jdur|j�|j�d��dSdSdS)Nz requires service and username)rrrr�errorrrrrr'Fs
�zCommandLineTool._check_argscCs*t|j|j�}|durtd��t|�dS)Nr)rrr�
SystemExitr%�r�passwordrrr�do_getKszCommandLineTool.do_getcCs0|�d|j�d|j�d��}t|j|j|�dS)NzPassword for 'z' in 'z': )�input_passwordrrrr2rrr�do_setQs�zCommandLineTool.do_setcCst|j|j�dS�N)rrrrrrr�do_delWszCommandLineTool.do_delcCs|j�d�dS)Nz)Specify operation 'get', 'del', or 'set'.)rr0rrrrr*ZszCommandLineTool.invalid_opc
Csv|jdurdSz|jrtj�d|j�tt�|j��WdStfy:}z|j	�
d|���WYd}~dSd}~ww)Nrz"Unable to load specified keyring: )rr
�sys�path�insertrr�load_keyring�	Exceptionrr0)r�excrrrr(]s
 ��z"CommandLineTool._load_spec_backendcCs|��pt�|�S)zRetrieve password from input.)�pass_from_pipe�getpass)r�promptrrrr5mszCommandLineTool.input_passwordcCs tj��}|o|�tj���S)z4Return password from pipe if not on TTY, else False.)r9�stdin�isatty�strip_last_newline�read)�cls�is_piperrrr?qszCommandLineTool.pass_from_pipecCs|d|�d��S)z#Strip one last newline, if present.N�
)�endswith)�strrrrrDwsz"CommandLineTool.strip_last_newlineN)�__name__�
__module__�__qualname__rr/r'r4r6r8r*r(r5�classmethodr?�staticmethodrDrrrrr	
s&
r	cCs&|durtjdd�}t�}|�|�S)zMain command line interface.Nr)r9r+r	r/)r+�clirrr�main}s
rQ�__main__r7)�__doc__r@rr9�rrrrrrr	rQrK�exitrrrr�<module>s
p
�
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY