Hi, I have worked on a kedpm migration script, which will probably also work with fpm. I couldn't make the fpm2pass script work with the kedpm database (although they are supposed to be compatible). I believe the problem is the script assumes the database is already decrypted.
So I just started from scratch, and in python. The result pretty good I believe, and I was able to migrate my database, and it keeps the file hierarchy and everything. Note that this depends on the new, fixed up, export format of kedpm that I just released in kedpm 1.0.
#! /usr/bin/python
# to double-check your import worked:
# grep Path passwords | sed 's#^Path: ##;s/$/.gpg/' | sort > listpaths
# (cd ~/.password-store/ ; find -type f ) | sort | diff -u - listpaths
import re
import fileinput
import sys # for exit
import subprocess
def insert(d):
path = d['Path']
del d['Path']
print "inserting " + path
content = d['Password'] + "\n"
del d['Password']
for k, v in d.iteritems():
content += "%s: %s\n" % (k, v)
del d
cmd = ["pass", "insert", "--force", "--multiline", path]
process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate(content)
retcode = process.wait()
if retcode:
print 'command "%s" failed with exit code %d: %s' % (" ".join(cmd), retcode, stdout + stderr)
sys.exit(1);
d = None
for line in fileinput.input():
if line == "\n":
continue
match = re.match("(\w+): (.*)$", line)
if match:
if match.group(1) == 'Path':
if d is not None:
insert(d)
else:
d = {}
d[match.group(1)] = match.group(2)
#print "found field: %s => %s" % (match.group(1), match.group(2))
else:
print "warning: no match found on line: *%s*" % line
if d is not None:
insert(d)
Please consider adding the attached file to the contrib
directory. Thanks!
A.
PS: I am not subscribed to the list, but I do follow it through gmane
now.
--
Le monochrome, c'est pour ceux qui s'intéressent (encore) au contenu.
Usenet dans ces conditions, c'est comme le web avec lynx, on prend
trop conscience du vide, c'est déprimant.
- JLC dans le Guide du linuxien pervers:
"Coup de cafard..."
pgpu1Ut5hGIG1.pgp
Description: PGP signature
_______________________________________________ Password-Store mailing list [email protected] http://lists.zx2c4.com/listinfo.cgi/password-store-zx2c4.com
