标签:__ 浏览器 Python encrypted self value Chrome key
使用Python破解谷歌Chrome浏览器存储密码
目前,谷歌浏览器80以后版本改进了用户存储在本机密码的加密方式,以往的破解密码方法不可行了!以下是博主测试可行的破解方法。
采用Python,安装两个包pywin32和cryptography,可以使用pip install pywin32, pip install cryptography。具体破解代码如下:
import os,json,base64,sqlite3
from win32crypt import CryptUnprotectData
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
class Chrome:
def __init__(self):
self.local_state = os.environ['LOCALAPPDATA'] + r'\Google\Chrome\User Data\Local State'
self.cookie_path = os.environ['LOCALAPPDATA'] + r"\Google\Chrome\User Data\Default\Login 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)
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):
nonce, cipher_bytes = secret[3:15], secret[15:]
aes_gcm = AESGCM(key)
return aes_gcm.decrypt(nonce, cipher_bytes, salt).decode('utf-8')
def get_password(self):
sql = "select username_value,password_value,signon_realm from logins"
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,website in res:
if encrypted_value[0:3] == b'v10' or encrypted_value[0:3] == b'v11':
passwd = self.decrypt_string(key, encrypted_value)
else:
passwd = CryptUnprotectData(encrypted_value)[1].decode()
print('网站:{},用户名:{},密码:{}'.format(website,name, passwd))
if __name__ == '__main__':
c = Chrome()
c.get_password()
祝大家破解愉快!
标签:__,浏览器,Python,encrypted,self,value,Chrome,key 来源: https://blog.csdn.net/czyujian/article/details/116656392
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。