CasperSecurity

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

o

���a��@s�ddlmZddlZddlmZddlmZddlmZddl	m
Z
mZmZm
Z
zddlZddlmZWney=Yn	eyEYnwe�e�ZGdd	�d	e�ZdS)
�)�closingN�)�
properties)�KeyringBackend)�SimpleCredential)�	InitError�PasswordDeleteError�ExceptionRaisedContext�
KeyringLockedc@sVeZdZdZdZejedd���Zdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�ZdS)�KeyringzSecret Service KeyringzPython keyring libraryc
Cs�t��}tjWd�n1swY|rtd��tjdkr%td��z$tt����}t�|�s6td��Wd�WdS1sBwYWdStj	y\}ztd|��d}~ww)NzSecretStorage required)�rz#SecretStorage 3.2 or newer requiredzJThe Secret Service daemon is neither running nor activatable through D-Busz&Unable to initialize SecretService: %s�)
r	�
secretstorage�__name__�RuntimeError�__version_tuple__r�	dbus_init�check_service_availability�
exceptions�SecretStorageException)�cls�exc�
connection�e�r�@/usr/lib/python3/dist-packages/keyring/backends/SecretService.py�prioritys,�

�������zKeyring.priorityc
Cs|t��}zt|d�rt�||j�}nt�|�}Wntjy+}ztd|��d}~ww|�	�r<|�
�|�	�r<td��|S)z�If self.preferred_collection contains a D-Bus path,
        the collection at that address is returned. Otherwise,
        the default collection is returned.
        �preferred_collectionz$Failed to create the collection: %s.Nz Failed to unlock the collection!)rr�hasattr�
Collectionr�get_default_collectionrrr�	is_locked�unlockr
)�self�bus�
collectionrrrr�get_preferred_collection3s

���z Keyring.get_preferred_collectioncCs&t|d�r	|��|��rtd��dS)Nr"zFailed to unlock the item!)rr"r!r
)r#�itemrrrr"Fs

�zKeyring.unlockcCsz|��}t|j��*|�||d��}|D]}|�|�|���d�Wd�SWd�dS1s6wYdS)z,Get password of the username for the service��username�service�utf-8N)r&rr�search_itemsr"�
get_secret�decode�r#r*r)r%�itemsr'rrr�get_passwordLs
�"�zKeyring.get_passwordcCsd|��}|j||d�}d�||�}t|j��|j|||dd�Wd�dS1s+wYdS)z,Set password for the username of the service)�applicationr*r)zPassword for '{}' on '{}'T)�replaceN)r&�appid�formatrr�create_item)r#r*r)�passwordr%�
attributes�labelrrr�set_passwordUs�"�zKeyring.set_passwordcCsr|��}t|j��$|�||d��}|D]}|��Wd�SWd�td��1s0wYtd��)z/Delete the stored password (only the first one)r(NzNo such password!)r&rrr,�deleterr/rrr�delete_passwordas
�
��zKeyring.delete_passwordcCs�d|i}|r
||d<|��}t|j��1|�|�}|D] }|�|�|���d�}t||���	d��Wd�SWd�dS1sGwYdS)aYGets the first username and password for a service.
        Returns a Credential instance

        The username can be omitted, but if there is one, it will use get_password
        and return a SimpleCredential containing  the username and password
        Otherwise, it will return the first username and password combo that it finds.
        r*r)r+N)
r&rrr,r"�get_attributes�getrr-r.)r#r*r)�queryr%r0r'rrr�get_credentialjs	

�"�zKeyring.get_credentialN)r�
__module__�__qualname__�__doc__r4r�
ClassProperty�classmethodrr&r"r1r:r<r@rrrrrs		r)�
contextlibr�logging�utilr�backendr�credentialsr�errorsrrr	r
r�secretstorage.exceptionsr�ImportError�AttributeError�	getLoggerr�logrrrrr�<module>s �

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