Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install kptool

How to install kptool

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install kptool
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.1dev Available View build log
Windows (64-bit)
0.1dev Available View build log
Mac OS X (10.5+)
0.1dev Available View build log
Linux (32-bit)
0.1dev Available View build log
Linux (64-bit)
0.1dev Available View build log
 
License
GPL v2
Dependencies
Lastest release
version 0.1dev on Jan 5th, 2011

What's this

KeePass version 1 database file access tool that includes access module.

Currently, support search the entries or groups as the command line tool.

How to Use

% python kptool.py -f <kdbfilepath> <searchword>

Building and installation

% python setup.py install

Testing

% python setup.py test

Requirement

  • Python 2.6 or later
  • pyCrypto
  • argparse

KeePassdb module API

Constructor(kdbfilepath, masterpassword)

Create DB from KeePass DB file path and Master password.

>>> from kptool.keepassdb import keepassdb
>>> password = "Hogehoge"
>>> k = keepassdb.KeepassDBv1("tests/keepass-test.kdb", password)
get_groups()

Get groups.

>>> for g in k.get_groups():
...   if ('groups' in g):
...     "%s %s in %s" % (g['title'], g['group_id'], g['groups'])
...   else:
...     "%s %s" % (g['title'], g['group_id'])
'Group1 2877859699'
'SubGroup1 1203768070 in 2877859699'
'Group2 2251441873'
get_entries()

Get entries. Note: KeepassDB has a history. get_entries() get all entries include history. Since that, entries that have same title may be acquired.

>>> for e in k.get_entries():
...   print "%s %s %s" % (e['title'], e['username'], e['created'])
Entry2 entry2 2010-10-01 22:00:51
SubGroup1 gr 2010-10-01 22:00:29
Entry1 test 2010-09-26 13:17:55
日本語です sub 2010-10-01 21:59:33
get_entries_from_groupid(groupid)

Get entries from groupid. Groupid should be Integer.

>>> for e in k.get_entries_from_groupid(2877859699):
...   e['title']
'Entry1'
find_groups(searchword)

Find groups that has <searchword> in title or id.

>>> for g in k.find_groups("up1"):
...   g['title']
'Group1'
'SubGroup1'
find_entries(searchword)

Find entries that has <searchword> in title, url, comment or username.

>>> for e in k.find_entries("Ent"):
...   e['title']
'Entry2'
'Entry1'
clear()

Clears any currently loaded groups and entries in the database.

>>> k.clear()
>>> k.get_entries()
[]
>>> k.get_groups()
[]
Entry Field Lists
id:entry id. String.
group_id:group id. Integer.
icon:icon Integer.
title:title. ASCII or UTF-8
url:url
username:username
password:password
comment:comment. ASCII or UTF-8.
created:created date. Datetime object.
modifed:modified date. Datetime object.
accessed:accessed date. Datetime object.
expires:expires date. Datetime object. if "never", shows 2999-12-28 23:59:59.
bin_desc:
binary:
Group Field Lists
group_id:group id. Integer.
title:title
icon:icon
level:level. start from 0.
comment:comment.

BUGS

  • Only Rijndael is supported.
  • Only passkeys are supported (no key files).
  • Only read methods is supported.

TODO

  • Write methods.
  • KeePass db version 2 support.

License

GPL version2

Acknowledgement

Knowledge about the KeePass DB v1 format was gleaned from the source code of keepassx-0.4.3 and File::KeePass in the CPAN.

KeePassX 0.4.3 bears the copyright of

Copyright (C) 2005-2008 Tarek Saidi <tarek.saidi@arcor.de> Copyright (C) 2007-2009 Felix Geyer <debfx-keepassx {at} fobos.de>

File::KeePass bears the copyright of

Paul Seamons <paul at seamons dot com>

Subscribe to package updates

Last updated Jan 5th, 2011

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.