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)
    
  • 相关阅读:
    webpack 入门(1)入口(entry)出口(output
    npm 常用使用命令
    typora快捷键
    一些思考
    SED LEARN NOTE
    常用网站工具整理
    DFTC
    Notion使用技巧
    BASH LEARN NOTE
    STBC公式
  • 原文地址:https://www.cnblogs.com/ruhai/p/12229757.html
Copyright © 2011-2022 走看看