Skip to content

Commit

Permalink
Add support for plain-text Chrome passwords on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
alxchk committed May 23, 2017
1 parent 5433fbd commit 579477c
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Linux/lazagne/config/manageModules.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# browsers
from lazagne.softwares.browsers.mozilla import Mozilla
from lazagne.softwares.browsers.opera import Opera
from lazagne.softwares.browsers.chrome import Chrome
# sysadmin
from lazagne.softwares.sysadmin.filezilla import Filezilla
from lazagne.softwares.sysadmin.env_variable import Env_variable
Expand Down Expand Up @@ -58,6 +59,7 @@ def get_modules():
Jitsi(),
Mozilla(),
Opera(),
Chrome(),
Pidgin(),
Shadow(),
Aws(),
Expand Down
56 changes: 56 additions & 0 deletions Linux/lazagne/softwares/browsers/chrome.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# For non-keyring storage

from lazagne.config.constant import *
from lazagne.config.write_output import print_debug
from lazagne.config.moduleInfo import ModuleInfo
from lazagne.config import homes

import sqlite3
import tempfile

class Chrome(ModuleInfo):
def __init__(self):
options = {'command': '-C', 'action': 'store_true', 'dest': 'chrome', 'help': 'chrome'}
ModuleInfo.__init__(self, 'chrome', 'browsers', options)

def get_paths(self):
return homes.get(file=[
'.config/google-chrome/Default/Login Data',
'.config/chromium/Default/Login Data'
])

def get_logins(self, path):
try:
conn = sqlite3.connect(path)
except:
return

cursor = conn.cursor()

try:
cursor.execute('SELECT origin_url,username_value,password_value FROM logins')
for url, user, password in cursor:
print url, user, password
yield {
'URL': url,
'Login': user,
'Password': password
}
except:
pass

finally:
cursor.close()
conn.close()

def run(self, software_name = None):
all_passwords = []
for path in self.get_paths():
with tempfile.NamedTemporaryFile() as tmp:
with open(path) as infile:
tmp.write(infile.read())

for pw in self.get_logins(tmp.name):
all_passwords.append(pw)

return all_passwords

0 comments on commit 579477c

Please sign in to comment.