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

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

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

瀏覽:2日期: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) # 去掉開(kāi)頭的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') # 隨機(jī)生成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 獲取谷歌瀏覽器保存的密碼的詳細(xì)內(nèi)容,更多關(guān)于python 獲取瀏覽器密碼的資料請(qǐng)關(guān)注好吧啦網(wǎng)其它相關(guān)文章!

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 精品免费看 | 成人无高清96免费 | 麻豆剧场 | 成人三级做爰在线观看男女 | 亚洲精品国产经典一区二区 | 啪啪自拍视频 | 日韩一级一欧美一级国产 | 黄色片免费在线观看视频 | 天天操夜夜草 | 全部费免一级毛片不收费 | 最新国产精品 | 久久国产精品只做精品 | 午夜精品久视频在线观看 | 成人午夜视频在线观 | 日韩黑寡妇一级毛片国语对白 | 亚洲色图欧美一区 | 亚洲成人77777| 性色毛片免费视频 | 女性潮高免费高清视频 | 模特尤妮丝凹凸福利视频 | 欧美一区二区三区大片 | 国产美女自拍 | 欧美a一级片| 国产高清美女一级毛片久久 | 欧美成人手机在线视频 | 九九精品99久久久香蕉 | 护士精品一区二区三区 | 国产真实强j视频在线观看 国产真实露脸4p视频 | 美国黄色网址 | 欧美一级特黄aa大片在线观看免费 | 色婷婷激婷婷深爱五月老司机 | 诱人的女邻居bd中文字幕 | 国产午夜精品不卡观看 | 亚洲欧洲视频在线 | 欧美日一区二区三区 | 18hd xxxx国产在线| 一区二区三区 日韩 | 亚洲欧美激情综合第一区 | 精品一区二区三区视频 | 久久久久99精品成人片三人毛片 | 国产一级爱做片免费观看 |