{"id":13721913,"url":"https://github.com/libkeepass/libkeepass","last_synced_at":"2026-03-12T20:12:40.802Z","repository":{"id":15031330,"uuid":"17757150","full_name":"libkeepass/libkeepass","owner":"libkeepass","description":"Python module to read KeePass 1.x/KeePassX (v3) and KeePass 2.x (v4) files","archived":false,"fork":false,"pushed_at":"2020-10-03T04:47:34.000Z","size":552,"stargazers_count":103,"open_issues_count":0,"forks_count":30,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-12-21T11:54:08.388Z","etag":null,"topics":["keepass","keepassx","keepassxc","library"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/libkeepass.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-14T19:11:55.000Z","updated_at":"2025-12-08T18:58:03.000Z","dependencies_parsed_at":"2022-09-09T13:22:27.993Z","dependency_job_id":null,"html_url":"https://github.com/libkeepass/libkeepass","commit_stats":null,"previous_names":["phpwutz/libkeepass"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/libkeepass/libkeepass","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libkeepass%2Flibkeepass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libkeepass%2Flibkeepass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libkeepass%2Flibkeepass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libkeepass%2Flibkeepass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libkeepass","download_url":"https://codeload.github.com/libkeepass/libkeepass/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libkeepass%2Flibkeepass/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30441857,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T14:34:45.044Z","status":"ssl_error","status_checked_at":"2026-03-12T14:09:33.793Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["keepass","keepassx","keepassxc","library"],"created_at":"2024-08-03T01:01:22.706Z","updated_at":"2026-03-12T20:12:40.774Z","avatar_url":"https://github.com/libkeepass.png","language":"Python","readme":"libkeepass\n==========\n\n**This library has been deprecated by** `pykeepass`_\n\nLow-level Python (2.7/3.x) module to read KeePass 1.x/KeePassX (.kdb) and KeePass 2.x (.kdbx v3)\nfiles.\n\nSee `pykeepass`_ or `kppy`_ for higher level database access and editing.\n\n.. _`pykeepass`: https://github.com/libkeepass/pykeepass\n.. _`kppy`: https://github.com/raymontag/kppy\n\nWarning\n-------\n\nThis code makes no attempt to secure its memory.\n\nDependencies\n-------------\n\n- `pycryptodome`_\n- lxml\n\n.. _`pycryptodome`: https://github.com/Legrandin/pycryptodome\n\n\nKeePass 1.x support\n-------------------\n\nThe v3 reader will parse the v3 binary format and put groups into the \"groups\"\nattribute, and entries into the \"entries\" attribute. The special icon entry is\nparsed and icons can be accessed via the \"icons\" attribute. Other special\nentries are not parsed and seen as regular entries.\n\nOnly passwords are supported.\n\nNo write support.\n\nKeePass 2.x support\n-------------------\n\n(Note: no support for KDBX v4 files)\n\nThe v4 reader can output the decrypted XML document that file format is based\non. It is also available as parsed objectified element tree.\n\nThe password elements in the XML document are protected in addition to the AES\nencryption of the whole database. Switching between clear text and protected is\npossible.\n\nPasswords and key-file protection is supported.\n\nCompressed and uncompressed files are supported.\n\nThere is basic \"save as\" write support. When writing the KeePass2 file, the\nelement tree is protected, serialized, compressed and encrypted according to the\nsettings in the file header and written to a stream.\n\nChaCha20 database encryption is supported.  However its worth noting that\npycryptodome version 3.6.1 and earlier does not support 12-bytes nonces for\nChaCha20, which we require.  Future versions of pycryptodome do support 12-byte\nnonces.  So if you're using 3.6.1 or earlier, decrypting a ChaCha20 encrypted\ndatabase will raise an exception.  Decrypting AES and Twofish encrypted\ndatabases will work as normal.\n\nCurrently the Argon2 key derivation algorithm and ChaCha20 protected passwords\nare unsupported.\n\nMerging/Synchronizing databases is also supported.  Currently only the\nsynchronize and \"overwrite if newer\" modes are supported. \n\nMerging\n-------\n\nCurrently 3 merge modes are supported:\n\n* **OVERWRITE_IF_NEWER** -- Entries are updated if there is a newer one in the\n  KDB being merged with and the previous entry is added to the entry history.\n  No Entry relocations nor deletions are done.\n* **SYNCHRONIZE** -- This mode should be equivalent to the official keepass\n  *synchronize*, which does and `OVERWRITE_IF_NEWER`, Entry relocations, and\n  deletions.\n* **SYNCHRONIZE_3WAY** -- This mode is similar to `SYNCHRONIZE`, except that\n  corresponding Entries are merged on a per field basis.  This is desirable if\n  Entries in both the source and destination merge KDBs have diverged from\n  their common ancestor.\n\nSee `samples/merge.py`_ for an example of merging two KDBs in libkeepass.  Keep\nin mind that merging modifies the KDB being merged into.  So make a copy if\nyou need the original.\n\n.. _`samples/merge.py`: samples/merge.py\n\nExamples\n--------\n\n.. code:: python\n\n   import libkeepass\n\n   filename = \"input.kdbx\"\n   with libkeepass.open(filename, password='secret', keyfile='keyfile.key') as kdb:\n       # print parsed element tree as xml\n       print(kdb.pretty_print())\n\n       # re-encrypt the password fields\n       kdb.protect()\n       print(kdb.pretty_print())\n\n       # or use kdb.obj_root to access the element tree\n       kdb.obj_root.findall('.//Entry')\n\n       # change the master password before writing\n       kdb.clear_credentials()\n       kdb.add_credentials(password=\"m04r_s3cr37\")\n\n       # disable compression\n       kdb.set_compression(0)\n\n       # write to a new file\n       with open('output', 'wb') as output:\n           kdb.write_to(output)\n           \n   # Alternatively, read a kdb4 file protected\n   with libkeepass.open(filename, password='secret', keyfile='keyfile.key', unprotect=False) as kdb:\n       # print parsed element tree as xml\n       print(kdb.pretty_print())\n\n       # decrypt the password fields\n       kdb.unprotect()\n       print(kdb.pretty_print())\n\nTools\n-------\n\n**kdbdiff** - Diff two keepass files\n\nCurrently the two file arguments can be KDB v3 or v4 databases or KDB v4\nxml file. KDB v3 xml files can be supported natively once an importer is\nwritten that creates a KDB3File from the v3 xml.\nNOTE: This does a diff based on the entry name and path. So entries that\nare moved will show up as added and deleted, even though the entries may be\nidentical other than their path.\n\nTools\n-------\n\n**shell** -- Basic command line shell to view a keepass database\n\n**kdbutil** -- Utility to manipulate keepass databases with the following subcommands:\n\n* **convert4** -- Convert a KDB v3 database to v4 format.  This is better than\n  keepassx's (current) importer because it keeps entry uuids unique\n  across multiple conversions of the same KDB v3 database.\n\n* **dump** -- Dump the inner xml of the keepass database.\n  WARNING: This will print passwords in clear-text.\n\n* **shell** -- another simple shell for manipulating keepass database files.\n\n\nTesting\n-------\n\nMake a virtualenv and install the requirements (or install through pip). Then run the tests script\n\n.. code:: bash\n\n   pip install -e .\n   python -m tests\n\nReferences\n----------\n\nBrett Viren's `code`_ was a starting point and some of his code is being\nre-used unchanged\n\n\nFor v4 support reading the `original Keepass2 C#`_ source was used as inspiration\n\nKeepass 2.x uses Salsa20 to protect data in XML. Currently `puresalsa20`_ is used and included.\n\n\nFor v3 read support, code was copied with some enhancements from WAKAYAMA\nShirou's `kptool`_.\n\n.. _`original Keepass2 C#`: http://keepass.info\n.. _`code`: https://github.com/brettviren/python-keepass\n.. _`puresalsa20`: http://www.tiac.net/~sw/2010/02/PureSalsa20/index.html\n.. _`kptool`: https://github.com/shirou/kptool)\n\nThanks to them and all others who came before are in order.\n\nContributors\n------------\n- fdemmer\n- phpwutz\n- nvamilichev\n- crass\n- pschmitt\n- evidlo\n","funding_links":[],"categories":["API libraries","Credentials"],"sub_categories":["Other clients","WebServers"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibkeepass%2Flibkeepass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibkeepass%2Flibkeepass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibkeepass%2Flibkeepass/lists"}