Created
December 20, 2023 10:10
-
-
Save oprietop/9730bb47efe79634014a135dd83816c2 to your computer and use it in GitHub Desktop.
Format firefox exported passwords for Keepass
This file contains hidden or 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
import datetime | |
def epoch2date(e): | |
return datetime.datetime.fromtimestamp(int(e)/1000).strftime('%Y/%m/%d %H:%M:%S') | |
file1 = open('logins.csv', 'r') | |
lines = file1.readlines() | |
if lines: | |
print('"url","username","password","formActionOrigin","guid","timeCreated","timeLastUsed","timePasswordChanged"') | |
for line in lines[1:]: | |
list = line.replace(",,", ",").rstrip().strip('"').split('","') | |
list[5] = epoch2date(list[5]) | |
list[6] = epoch2date(list[6]) | |
list[7] = epoch2date(list[7]) | |
print('"{}"'.format('","'.join(list))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment