I am trying to decrypt my chrome passwords from the "Login Data" sqlite file. I followed this tutorial: https://ohyicong.medium.com/how-to-hack-chrome-password-with-python-1bedc167be3d The code is shown here:
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)
This is the error that i'm getting in both python2.7 and python3
raise ValueError("Incorrect AES key length (%d bytes)" % len(key))
ValueError: Incorrect AES key length (356 bytes)
I verified i copied the correct secret_key multiple times, I'm still getting this error. Please help me fix this