Created
December 27, 2018 17:54
-
-
Save mdarse/f61a95758520c49297fc7ce0a18a896f to your computer and use it in GitHub Desktop.
Converts Firefox passwords export to 1Password compatible CSV
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
#!/usr/bin/env python3 | |
import csv | |
import sys | |
from urllib.parse import urlparse | |
# This expects a CSV export from https://github.com/kspearrin/ff-password-exporter | |
# This outputs 1Password compatible CSV | |
# see https://support.1password.com/create-csv-files/ | |
output = csv.writer(sys.stdout) | |
for row in csv.DictReader(sys.stdin): | |
# FireFox does not keep a title on logins, we derive it from the hostname | |
title = urlparse(row['hostname']).netloc | |
if title.startswith('www.'): | |
title = title[4:] | |
output.writerow(( | |
title, | |
row['hostname'], | |
row['username'], | |
row['password'] | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment