-
-
Save AmmarHaddadi/40af9aac0ae89818173fc0cda6d6253e to your computer and use it in GitHub Desktop.
Decrypt Chrome/Opera Saved Passwords - 2018
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://geekswipe.net/technology/computing/swoop-chrome-passwords-decrypt-with-python/ | |
# https://github.com/karthikeyankc/Swoopy/blob/master/Swoopy.py | |
# INSTALL: https://github.com/mhammond/pywin32/releases | |
import os | |
import sqlite3 | |
import win32crypt | |
#path to user's login data | |
# For Chrome: | |
#data_path = os.path.expanduser('~')+"\AppData\Local\Google\Chrome\User Data\Default" | |
# For Opera: | |
data_path = os.path.expanduser('~')+"\AppData\Roaming\Opera Software\Opera Stable" | |
login_db = os.path.join(data_path, 'Login Data') | |
#db connect and query | |
c = sqlite3.connect(login_db) | |
cursor = c.cursor() | |
select_statement = "SELECT origin_url, username_value, password_value FROM logins" | |
cursor.execute(select_statement) | |
login_data = cursor.fetchall() | |
#URL: credentials dictionary | |
credential = {} | |
#decrytping the password | |
for url, user_name, pwd, in login_data: | |
pwd = win32crypt.CryptUnprotectData(pwd, None, None, None, 0) #This returns a tuple description and the password | |
credential[url] = (user_name, pwd[1]) | |
#writing to a text file (CAUTION: Don't leave this text file around!) | |
#prompt = raw_input("[.] Are you sure you want to write all this sensitive data to a text file? \n[.] or \n[>] ") | |
#if prompt == 'y': | |
with open('pwd.txt', 'w') as f: | |
for url, credentials in credential.iteritems(): | |
if credentials[1]: | |
f.write("\n"+url+"\n"+credentials[0].encode('utf-8')+ " | "+credentials[1]+"\n") | |
else: | |
f.write("\n"+url+"\n"+"USERNAME NOT FOUND | PASSWORD NOT FOUND \n") | |
print "[.] Successfully written to pwd.txt!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment