Last active
April 19, 2020 15:27
-
-
Save MinmoTech/0fbd36a8c852d4cbe62a9b5380740072 to your computer and use it in GitHub Desktop.
Lastpass to gopass export script. Export lastpass database as csv and put it next to the script. Then execute.
This file contains 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 python | |
import csv | |
from itertools import islice | |
import os | |
with open('lastpass_export.csv', newline='') as f: | |
reader = csv.reader(f) | |
for row in islice(reader, 1, None): | |
url = row[0] | |
username = row[1] | |
password = row[2] | |
comment = row[3] | |
name = row[4] | |
grouping = row[5] | |
if url == "http://sn": | |
input = f"""{password} | |
comment: {comment} | |
username: {username}""" | |
else: | |
input = f"""{password} | |
comment: {comment} | |
url: {url} | |
username: {username}""" | |
if username: | |
command = f'echo -e "{input}" | gopass insert Account/{name}/{username}' | |
elif grouping: | |
command = f'echo -e "{input}" | gopass insert Notes/{grouping}/{name}' | |
else: | |
command = f'echo -e "{input}" | gopass insert Notes/{name}' | |
os.system(command) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment