From e9fee2d937ff41907f0a13ae2c2ecb273edcc359 Mon Sep 17 00:00:00 2001 From: desaster Date: Thu, 24 Jun 2010 23:12:40 +0000 Subject: [PATCH] Added a simple tool for editing data/pass.db git-svn-id: https://kippo.googlecode.com/svn/trunk@142 951d7100-d841-11de-b865-b3884708a8e2 --- utils/passdb.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 utils/passdb.py diff --git a/utils/passdb.py b/utils/passdb.py new file mode 100755 index 00000000..1ddfc645 --- /dev/null +++ b/utils/passdb.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import anydbm, sys, os + +if __name__ == '__main__': + if len(sys.argv) < 3 or \ + (sys.argv[2] in ('add', 'remove') and len(sys.argv) < 4): + print 'Usage: %s [password]' % \ + os.path.basename(sys.argv[0]) + sys.exit(1) + db = anydbm.open(sys.argv[1], 'c') + if sys.argv[2] == 'list': + for password in db: + print password + elif sys.argv[2] == 'add': + db[sys.argv[3]] = None + elif sys.argv[2] == 'remove': + del db[sys.argv[3]] + else: + print 'Unknown option: %s' % (sys.argv[2],) + db.close() + +# vim: set ft=python sw=4 et: