ruhai
# 查看谷歌浏览器保存在本地的密码

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)

分类:

技术点:

相关文章:

  • 2021-06-21
  • 2021-07-03
  • 2021-10-05
  • 2021-11-18
  • 2021-07-03
  • 2021-06-20
  • 2021-06-30
  • 2021-12-03
猜你喜欢
  • 2021-06-19
  • 2022-01-29
  • 2021-09-25
  • 2021-12-03
  • 2021-08-03
  • 2021-12-23
相关资源
相似解决方案