CasperSecurity

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

o

���a��	@s�ddlZddlmZddlmZddlmZddlmZm	Z	e	��.Z
zddlmZddlm
Z
e
jWneyGddlZddl
Z
e
jYnwWd�n1sRwYe�e�ZGd	d
�d
�ZGdd�de�ZGd
d�de�ZdS)�N�)�
properties)�KeyringBackend)�SimpleCredential)�PasswordDeleteError�ExceptionRaisedContext)�
pywintypes)�	win32credc@seZdZddd�Zdd�ZdS)�PersistenceNcCst|dtj�S)N�_persist)�getattrr	�CRED_PERSIST_ENTERPRISE)�self�keyring�type�r�:/usr/lib/python3/dist-packages/keyring/backends/Windows.py�__get__szPersistence.__get__cCs8t|t�rd|�dd���}tt|�}t|d|�dS)z�
        Set the persistence value on the Keyring. Value may be
        one of the win32cred.CRED_PERSIST_* constants or a
        string representing one of those constants. For example,
        'local machine' or 'session'.
        �
CRED_PERSIST_� �_rN)�
isinstance�str�replace�upperrr	�setattr)rr�value�attrrrr�__set__ s

zPersistence.__set__)N)�__name__�
__module__�__qualname__rrrrrrr
s
r
c@seZdZedd��ZdS)�DecodingCredentialcCs@|d}z|�d�WSty|�d�}t�d�|YSw)zM
        Attempt to decode the credential blob as UTF-16 then UTF-8.
        �CredentialBlobzutf-16zutf-8zkRetrieved an UTF-8 encoded credential. Please be aware that this library only writes credentials in UTF-16.)�decode�UnicodeDecodeError�log�warning)r�cred�decoded_cred_utf8rrrr.s
��zDecodingCredential.valueN)rr r!�propertyrrrrrr"-sr"c@sleZdZdZe�Zejedd���Z	e
dd��Zdd�Zdd	�Z
d
d�Zdd
�Zdd�Zdd�Zdd�ZdS)�WinVaultKeyringaf
    WinVaultKeyring stores encrypted passwords using the Windows Credential
    Manager.

    Requires pywin32

    This backend does some gymnastics to simulate multi-user support,
    which WinVault doesn't support natively. See
    https://github.com/jaraco/keyring/issues/47#issuecomment-75763152
    for details on the implementation, but here's the gist:

    Passwords are stored under the service name unless there is a collision
    (another password with the same service name but different user name),
    in which case the previous password is moved into a compound name:
    {username}@{service}
    cCstrtd��dS)zA
        If available, the preferred backend on Windows.
        zRequires Windows and pywin32�)�missing_deps�RuntimeError)�clsrrr�prioritySszWinVaultKeyring.prioritycCs|�d|��S)N�@r)�username�servicerrr�_compound_name]szWinVaultKeyring._compound_namecCs:|�|�}|r
|d|kr|�|�||��}|sdS|jS�N�UserName)�
_get_passwordr4r�rr3r2�resrrr�get_passwordas
zWinVaultKeyring.get_passwordc
CsZz
tjtj|d�}Wt|�Stjy,}z|jdkr'|jdkr'WYd}~dS�d}~ww)N��Type�
TargetName��CredRead)r	r?�CRED_TYPE_GENERICr�error�winerror�funcnamer")r�targetr9�errrr7ks����zWinVaultKeyring._get_passwordcCsH|�|�}|r|d}|�||�}|�|||j�|�||t|��dSr5)r7r4�
_set_passwordrr)rr3r2�password�existing_pw�existing_usernamerDrrr�set_passwordvs
�zWinVaultKeyring.set_passwordcCs(ttj|||d|jd�}t�|d�dS)NzStored using python-keyring)r<r=r6r#�Comment�Persistr)�dictr	r@�persist�	CredWrite)rrDr2rG�
credentialrrrrF�s�zWinVaultKeyring._set_passwordcCsV|�||�}d}||fD]}|�|�}|r"|d|kr"d}|�|�q|s)t|��dS)NFr6T)r4r7�_delete_passwordr)rr3r2�compound�deletedrDrHrrr�delete_password�s

��zWinVaultKeyring.delete_passwordc
CsVztjtj|d�WdStjy*}z|jdkr%|jdkr%WYd}~dS�d}~ww)Nr;r>�
CredDelete)r	rUr@rrArBrC)rrDrErrrrQ�s��z WinVaultKeyring._delete_passwordcCs@d}|r
|�|�||��}|s|�|�}|sdSt|d|j�Sr5)r7r4rrr8rrr�get_credential�s
zWinVaultKeyring.get_credentialN)rr r!�__doc__r
rNr�
ClassProperty�classmethodr0�staticmethodr4r:r7rJrFrTrQrVrrrrr+?s


r+)�logging�utilr�backendr�credentialsr�errorsrrr-�win32ctypes.pywin32rr	r�ImportError�	getLoggerr&r
rMr"r+rrrr�<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