Skip to content

About

This Python script compares two KeePassXC databases (.kdbx files) and logs differences in entries, such as usernames and passwords. It uses the pykeepass library to read the databases and click for command-line argument parsing.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

KeePass Database Comparator

This Python script compares two KeePassXC databases (.kdbx files) and logs differences in entries, such as usernames and passwords. It uses the pykeepass library to read the databases and click for command-line argument parsing.

Features

  • Compares entries by title, username, and password.
  • Identifies entries unique to each database.
  • Handles entries with missing titles (None).
  • Provides detailed logging with timestamps.
  • Securely prompts for passwords without displaying them.

Prerequisites

  • Python 3.6 or higher installed.
  • Access to two KeePassXC .kdbx files and their respective passwords.

Setup

1. Create a Virtual Environment

To isolate dependencies, create and activate a virtual environment:

On Linux/macOS:

python3 -m venv venv
source venv/bin/activate

On Windows:

python -m venv venv
venv\Scripts\activate

Once activated, your terminal prompt should indicate the virtual environment (e.g., (venv)).

2. Install Dependencies

Install the required Python packages:

pip install pykeepass click

3. Make the Script Executable (Optional, Linux/macOS)

If you want to run the script directly:

chmod +x compare_keepass.py

Usage

Run the script with paths to the two .kdbx files as arguments. You will be prompted to enter the passwords securely.

Basic Example

python compare_keepass.py --db1-path ./database1.kdbx --db2-path ./database2.kdbx

OR (if executable):

./compare_keepass.py --db1-path ./database1.kdbx --db2-path ./database2.kdbx

You’ll be prompted for passwords:

db1-password: [hidden input]
db2-password: [hidden input]

Verbose Mode

For detailed debugging output:

python compare_keepass.py --db1-path ./database1.kdbx --db2-path ./database2.kdbx --verbose

Notes

  • Ensure the .kdbx files are accessible and readable.
  • The script does not modify the databases; it only reads them.
  • Entries without titles are excluded from comparison but logged as warnings.

Troubleshooting

  • Invalid password error: Double-check the passwords for each database.
  • File not found: Verify the file paths are correct.
  • Module not found: Ensure dependencies are installed in the active virtual environment.

About

This Python script compares two KeePassXC databases (.kdbx files) and logs differences in entries, such as usernames and passwords. It uses the pykeepass library to read the databases and click for command-line argument parsing.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages