Skip to content

Commit

Permalink
fix python2 error
Browse files Browse the repository at this point in the history
On python2, attempting to read from the database would result in the error `database disk image is malformed`.
  • Loading branch information
plonibarploni authored Feb 13, 2019
1 parent 4ecef7f commit ea4f2e6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Linux/lazagne/softwares/browsers/chrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ea4f2e6

Please sign in to comment.