From ea4f2e6ac140495e0cafffd60f7ac78efff6b6c2 Mon Sep 17 00:00:00 2001 From: plonibarploni <44826203+plonibarploni@users.noreply.github.com> Date: Wed, 13 Feb 2019 07:41:44 +0000 Subject: [PATCH] fix python2 error On python2, attempting to read from the database would result in the error `database disk image is malformed`. --- Linux/lazagne/softwares/browsers/chrome.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Linux/lazagne/softwares/browsers/chrome.py b/Linux/lazagne/softwares/browsers/chrome.py index f1d334fb..7c8268d5 100644 --- a/Linux/lazagne/softwares/browsers/chrome.py +++ b/Linux/lazagne/softwares/browsers/chrome.py @@ -47,16 +47,16 @@ def get_passwords(self, path): finally: cursor.close() conn.close() + os.remove(path) def run(self): all_passwords = [] for path in self.get_paths(): - with tempfile.NamedTemporaryFile() as tmp: - with open(path, 'rb') as infile: - tmp.write(infile.read()) + tmp = u'/tmp/chrome.db' + copyfile(path, tmp) - for pw in self.get_passwords(tmp.name): - all_passwords.append(pw) + for pw in self.get_passwords(tmp): + all_passwords.append(pw) return all_passwords