国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

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

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

瀏覽:6日期: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 獲取瀏覽器密碼的資料請關注好吧啦網(wǎng)其它相關文章!

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 在线国产网站 | 欧美色网在线 | 久久久久久久久久综合情日本 | 国产欧美日韩综合精品无毒 | 成人自拍网站 | 一级做a爱片久久蜜桃 | 成人做爰视频www在线观看 | 精品免费久久 | 久久精品视频16 | 亚洲精品99久久久久中文字幕 | 免费一级欧美大片视频在线 | www.久久综合 | 中文字幕精品在线观看 | 91久久国产露脸精品 | 久久精品爱| se94se最新网站 | 亚洲国内精品 | 性刺激免费视频观看在线观看 | a毛片免费观看完整 | 国产美女精品视频免费观看 | 国产高清一区二区三区视频 | 操美国女人 | 国产精品美女久久久久网站 | 精品国产96亚洲一区二区三区 | 中文字幕乱码中文乱码51精品 | 国产成人精品视频一区 | 特级淫片日本高清视频 | 99热在线获取最新地址 | 欧美叫床戏做爰无遮挡 | 欧美特黄一级高清免费的香蕉 | 国产女人毛片 | 北条麻妃在线一区二区 | 亲子乱子伦xxxx | 最新在线步兵区 | 欧美性猛交xxxxbbb | 二区久久国产乱子伦免费精品 | 精品国产96亚洲一区二区三区 | 99在线观看免费视频 | 可以看的毛片网站 | 亚洲精品二区 | 草久久久 |