我正试图从“登录数据”sqlite文件中解密我的chrome密码。我遵循了这个教程:https://ohyicong.medium.com/how-to-hack-chrome-password-with-python-1bedc167be3d 代码如下所示:
import sqlite3
from sqlite3.dbapi2 import Cursor
from Cryptodome.Cipher import AES
#The encrypt_key i got from "Local State" file
secret_key="<My Secret Key>"
#My "Login Data" file copied to a file called "login.db"
conn = sqlite3.connect("login.db")
cursor = conn.cursor()
cursor.execute("SELECT action_url, username_value, password_value FROM logins")
for index,login in enumerate(cursor.fetchall()):
url = login[0]
username = login[1]
ciphertext= login[2]
print("Url:",url)
print("Username",username)
print("Cipher Text",ciphertext)
initialisation_vector = ciphertext[3:15]
encrypted_password = ciphertext[15:-16]
cipher = AES.new(secret_key, AES.MODE_GCM, initialisation_vector)
decrypted_pass = cipher.decrypt(encrypted_password)
decrypted_pass = decrypted_pass.decode()
print(decrypted_pass)
这就是我在python2.7和python3中遇到的错误
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (356 bytes)
我多次验证我复制了正确的密钥,但仍然存在此错误。请帮我修一下
Chrome中的密钥是base-64编码的,并且有一个固定的前缀文本“DPAPI”。您必须解码base-64:
然后他们剪下那个头球:
这应该被AES构造函数正确地接受
编辑:如果您查看您引用的文章的结尾,您将看到作者在GitHub(https://github.com/ohyicong/decrypt-chrome-passwords)上实现其方法的链接。如果你仔细查看他的源代码,你会发现他实际上完全按照我上面的建议做了
相关问题 更多 >
编程相关推荐