Moving from pwsafe to keepassx

June 23, 2011 at 12:50 am Leave a comment

For a while I sued pwsafe to keep passwords. I even went so far as to hack up scripts to make it easier to user.

However it didn’t play very well with some clipboard managers, in particular kupfer – a better version of gnome-do. So I decided it was time to move on so I moved over to keepassx. However their was the problem of copying all my passwords over.

I ended up hacking up a script to create a keepass xml file for this, here is the script

#!/usr/bin/python
import csv
import datetime
import sys
import StringIO

from genshi.template import MarkupTemplate

class Bunch(object):
def __init__(self, **d):
self.__dict__ = d

TEMPLATE = ”’\

Passwords
1

${entry.title}
${entry.username}
${entry.password}

${entry.notes}
1
${now}
${now}
${now}
Never

”’

lines = [l for l in sys.stdin.readlines() if not l.startswith(‘#’)][1:]
dialect = csv.Sniffer().sniff(”.join(lines))

entries = []
for (_id, _group, title, username, password, notes) in csv.reader(lines, dialect=dialect):
entry = Bunch(username=username, title=title,
password=password, notes=notes)
entries.append(entry)

now = datetime.datetime.now()
output = MarkupTemplate(TEMPLATE).generate(entries=entries, now=now).render()

print output

Hopefully this script is short enough that you can read it and understand what it does before running, because if I were you I wouldn’t run random scripts on a password database without understand what they were doing *very* well.

Advertisements

Entry filed under: Uncategorized.

Hierarchical clustering in R Minimal working implementation of a socks 5 proxy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


June 2011
M T W T F S S
« May   Jul »
 12345
6789101112
13141516171819
20212223242526
27282930  

%d bloggers like this: