/usr/share/pass/pwsafe2pass.py is in pass 1.7.1-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #!/usr/bin/env python3
# Copyright (C) 2017 Sam Mason <sam@samason.uk>. All Rights Reserved.
# This file is licensed under the GPLv2+. Please see COPYING for more information.
import sys
import subprocess
import pandas as pd
# assumes STDIN is generated via File=>Export from the Mac version of
# pwsafe, available from https://pwsafe.info/
df = pd.read_table(sys.stdin)
df.sort_values(['Group/Title','Username'], inplace=True)
tr = {
ord('.'): '/',
ord('ยป'): '.'
}
for i,row in df.iterrows():
na = row.notnull()
path = 'pwsafe/{}'.format(row['Group/Title'].strip().translate(tr))
value = '{}\n'.format(row['Password'])
if na['Username']:
path = '{}/{}'.format(path,row['Username'].strip())
if na['e-mail']:
value = 'email: {}\n'.format(value,row['e-mail'].strip())
if na['Notes']:
value = '\n{}\n'.format(value, row['Notes'].strip())
with subprocess.Popen(['pass','add','-m',path],stdin=subprocess.PIPE) as proc:
proc.communicate(value.encode('utf8'))
if proc.returncode:
print('failure with {}, returned {}'.format(
path, proc.returncode))
|