查看谷歌瀏覽器保存在本地的密碼


# 查看谷歌瀏覽器保存在本地的密碼

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'Google\Chrome\User Data\Default\Login 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)


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM