zoukankan      html  css  js  c++  java
  • 查看谷歌浏览器保存在本地的密码

    # 查看谷歌浏览器保存在本地的密码
    
    import os
    import shutil
    import sqlite3
    
    try:
        import win32crypt
    except ImportError as e:
        os.popen('pip install pywin32')
        import win32crypt
    
    db_file_path = os.path.join(os.environ['LOCALAPPDATA'], r'GoogleChromeUser DataDefaultLogin Data')
    
    tmp_file = os.path.join(os.environ['LOCALAPPDATA'], 'sqlite_file')
    print(tmp_file)
    if os.path.exists(tmp_file):
        os.remove(tmp_file)
    shutil.copyfile(db_file_path, tmp_file)
    
    conn = sqlite3.connect(tmp_file)
    for row in conn.execute('select signon_realm,username_value,password_value from logins'):
        ret = win32crypt.CryptUnprotectData(row[2], None, None, None, 0)
        print('网站:%-50s,用户名:%-20s,密码:%s' % (row[0][:50], row[1], ret[1].decode('gbk')))
    
    conn.close()
    os.remove(tmp_file)
    
  • 相关阅读:
    梯度消失和梯度爆炸
    BN的作用与使用过程
    百面机器学习笔记(二)
    正则表达式
    CSS Sprite
    事件绑定
    拖拽
    oncontextmenu
    鼠标跟随
    鼠标事件
  • 原文地址:https://www.cnblogs.com/ruhai/p/12229757.html
Copyright © 2011-2022 走看看