亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁技術文章
文章詳情頁

python 獲取谷歌瀏覽器保存的密碼

瀏覽:3日期:2022-06-30 11:06:41

由于谷歌瀏覽器80以后版本采用了新的加密方式,所以記錄在這里

# -*- coding:utf-8 -*-import osimport jsonimport base64import sqlite3from win32crypt import CryptUnprotectDatafrom cryptography.hazmat.primitives.ciphers.aead import AESGCM# pip install pywin32# pip install cryptography# 文檔:https://source.chromium.org/chromium/chromium/src/+/master:components/os_crypt/os_crypt_win.cc?q=OSCrypt&ss=chromiumclass Chrome: def __init__(self): self.local_state = os.environ[’LOCALAPPDATA’] + r’GoogleChromeUser DataLocal State’ self.cookie_path = os.environ[’LOCALAPPDATA’] + r'GoogleChromeUser DataDefaultLogin Data' def get_key(self): with open(self.local_state, ’r’, encoding=’utf-8’) as f: base64_encrypted_key = json.load(f)[’os_crypt’][’encrypted_key’] encrypted_key_with_header = base64.b64decode(base64_encrypted_key) # 去掉開頭的DPAPI encrypted_key = encrypted_key_with_header[5:] key_ = CryptUnprotectData(encrypted_key, None, None, None, 0)[1] return key_ @staticmethod def decrypt_string(key, secret, salt=None): ''' 解密 ''' # 去掉’v10’ nonce, cipher_bytes = secret[3:15], secret[15:] aes_gcm = AESGCM(key) return aes_gcm.decrypt(nonce, cipher_bytes, salt).decode(’utf-8’) @staticmethod def encrypt_string(key, data, salt=None): ''' 加密 ''' aes_gcm = AESGCM(key) prefix = 'v10'.encode('utf-8') # 隨機生成12位字符串,拼接'v10' 共15位 nonce = os.urandom(12) cipher_bytes = data.encode('utf-8') return prefix + nonce + aes_gcm.encrypt(nonce, cipher_bytes, salt) def get_password(self, host): sql = f'select username_value,password_value from logins where signon_realm =’{host}’;' with sqlite3.connect(self.cookie_path) as conn: cu = conn.cursor() res = cu.execute(sql).fetchall() cu.close() result = [] key = self.get_key() for name, encrypted_value in res:if encrypted_value[0:3] == b’v10’ or encrypted_value[0:3] == b’v11’: password = self.decrypt_string(key, encrypted_value)else: password = CryptUnprotectData(encrypted_value)[1].decode()result.append({’user_name’: name, ’password’: password}) return result def set_password(self, host, username, password): key = self.get_key() encrypt_secret = self.encrypt_string(key, password) sq = f'''update logins set password_value=x’{encrypt_secret.hex()}’ where signon_realm =’{host}’ and username_value=’{username}’;''' with sqlite3.connect(self.cookie_path) as conn: cu = conn.cursor() cu.execute(sq) conn.commit()if __name__ == ’__main__’: a = Chrome() aa = a.get_password('https://baidu.com') print(aa)

以上就是python 獲取谷歌瀏覽器保存的密碼的詳細內容,更多關于python 獲取瀏覽器密碼的資料請關注好吧啦網其它相關文章!

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 狠狠色丁香婷婷综合最新地址 | 国产精品亚洲片在线观看麻豆 | 黄色综合网 | 亚洲欧美一区二区三区 | 国产在线不卡免费播放 | 久久99精品视频在线在线观看 | 美女扣下面流白浆丝袜 | 丁香婷婷亚洲六月综合色 | 一级特黄性色生活片一区二区 | 成人免费无毒在线观看网站 | 国产精品第一区在线观看 | 国产精品亚洲四区在线观看 | 波多久久夜色精品国产 | 久久 91 | 青青国产成人久久激情91麻豆 | 日本狠狠干 | 91短视频版在线观看www | 日韩不卡视频在线 | 一区二区三区网站在线免费线观看 | 国产视频自拍偷拍 | 国产成人香蕉在线视频fuz | 高清中文字幕在线 | 91香蕉视频在线看 | 五月色综合婷婷综合俺来也 | 久久久99精品免费观看精品 | 黄色福利在线观看 | 瑟妃19禁福利视频在线看mp4 | 国产超级碰碰在线公开视频 | 久爱青草视频在线观看 | 91精品视频网 | 国产亚洲毛片在线 | 日韩精品中文字幕在线 | 亚洲欧美视频一区 | 欧美精品大片 | 视频一区二区三区欧美日韩 | 特一级黄色录像 | 国产区视频在线 | 免费精品在线观看 | 黑人狂躁日本妞 | 免费一级淫片aa | 久操视频网站 |