Skip to content

Instantly share code, notes, and snippets.

@mdarse
Created December 27, 2018 17:54
Show Gist options
  • Save mdarse/f61a95758520c49297fc7ce0a18a896f to your computer and use it in GitHub Desktop.
Save mdarse/f61a95758520c49297fc7ce0a18a896f to your computer and use it in GitHub Desktop.
Converts Firefox passwords export to 1Password compatible CSV
#!/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