Windows.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:keyrings.alt 作者: jaraco 项目源码 文件源码
def get_password(self, service, username):
        """Get password of the username for the service
        """
        try:
            # fetch the password
            key = r'Software\%s\Keyring' % service
            hkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key)
            password_saved = winreg.QueryValueEx(hkey, username)[0]
            password_base64 = password_saved.encode('ascii')
            # decode with base64
            password_encrypted = base64.decodestring(password_base64)
            # decrypted the password
            password = _win_crypto.decrypt(password_encrypted).decode('utf-8')
        except EnvironmentError:
            password = None
        return password
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号