Skip to content

Instantly share code, notes, and snippets.

@MinmoTech
Last active April 19, 2020 15:27
Show Gist options
  • Select an option

  • Save MinmoTech/0fbd36a8c852d4cbe62a9b5380740072 to your computer and use it in GitHub Desktop.

Select an option

Save MinmoTech/0fbd36a8c852d4cbe62a9b5380740072 to your computer and use it in GitHub Desktop.

Revisions

  1. Julius Dehner revised this gist Apr 19, 2020. 1 changed file with 9 additions and 5 deletions.
    14 changes: 9 additions & 5 deletions lastpass2gopass.py
    Original file line number Diff line number Diff line change
    @@ -13,11 +13,15 @@
    comment = row[3]
    name = row[4]
    grouping = row[5]
    input = f"""{password}
    comment: {comment}
    url: {url}
    username: {username}
    line 3"""
    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}'
  2. Julius Dehner created this gist Apr 17, 2020.
    28 changes: 28 additions & 0 deletions lastpass2gopass.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    #!/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]
    input = f"""{password}
    comment: {comment}
    url: {url}
    username: {username}
    line 3"""

    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)