Giter VIP home page Giter VIP logo

kp2bw's Introduction

KP2BW - KeePass 2.x to Bitwarden Converter

This tool helps to convert existing KeePass databases to Bitwarden accounts. It provides the following advantages compared to the importer by the bitwarden project:

  • Import the all the data without having it ever touching the disk in unencrypted form . Note: as attachments must be stored on disk prior to upload, those files will be on the disk during the upload phase. The files are removed from disk after uploading.
  • Resolve KeePass reference entries(username and password only) in a "Bitwarden" way. For each entry with a reference field, the following happens:
    • If username and password are identical to the referenced entry, the url field will be added to the already existing entry
    • Otherwise, a new entry is created
  • Importing custom properties from KeePass. The properties will be stored as text custom field in the corresponding Bitwarden item. If the property value is longer than 10,000 chars, it will be uploaded as attachment (Bitwarden limitation)
  • Importing attachments from KeePass
  • Importing notes longer than 10,000 chars. Notes can't be longer than this. The notes will be imported as an attachment named notes.txt.
  • Idempotent import: Entries won't be duplicated when running the import multiple times.
  • Nested folders supported: If you have nested folder in KeePass, kp2bw will recreate the same folder structure in Bitwarden for you.
  • Importing of the entries one by one, it is slower but it will prevent bitwarden db query max time exceeded errors for bigger KeePass databases
  • Full UTF-8 support
  • Multi OS support: Works on Windows, macOS, & Linux.

Installation

  1. choose either one of the installation methods below

Install using the pre built whl file

  1. Make sure you've installed python 3 and pip on your system.
  2. Download the newest whl release from the releases
  3. Install kp2bw via pip:
pip install kp2bw-1.1-py3-none-any.whl

Install from source

  1. Make sure you've installed python 3 and pip on your system.
  2. Clone / download this repository and enter the directory.
  3. Create a new python venv and activate it
python3 -m venv venv/kp2bw

Windows:
.env\kp2bw\Scripts\activate

Linux:
source venv/kp2bw/bin/activate

pip install .
  1. pip install .

Usage

First, make sure you install the Bitwarden CLI tool on your system (https://help.bitwarden.com/article/cli/). After installing, set up the client:

If you use a on premise installation, set your url like this:

bw config server https://your-domain.com/

Now, you have to log into your account once:

bw login username

After that, you can use the kp2bw.py tool to import the data. This file is located in the kp2bw folder. Execute it using:

kp2bw passwords.kdbx

The help text of the tool is listed below:

usage: kp2bw [-h] [-kppw KP_PW] [-kpkf KP_KEYFILE] [-bwpw BW_PW] [-bworg org-name] [-y] [-v] keepass_file

KeePass 2.x to Bitwarden converter by @jampe

positional arguments:
  keepass_file      Path to your KeePass 2.x db.

optional arguments:
  -h, --help        show this help message and exit
  -kppw KP_PW       KeePass db password
  -kpkf KP_KEYFILE  KeePass db key file
  -bwpw BW_PW       Bitwarden Password
  -bworg            Bitwarden organization (name)
  -y                Skips the confirm bw installation question
  -v                Verbose output

Packaging

Note: Update version first

python3 -m venv venv/kp2bw &&\
source venv/kp2bw/bin/activate &&\
pip install . && pip install wheel &&\
python3 setup.py bdist_wheel

Troubleshooting

Invalid master password error on bw unlock

DEBUG: -- Executing command: bw unlock My?Master>>Password123 --raw
DEBUG:   |- Output: b'Invalid master password.'
DEBUG: -- Executing command: bw sync --session 'Invalid master password.'

The solution is to encapsulate the master password in double quotes (when you're typing it in at the password prompt), then the bw unlock command will run successfully and sync will continue. Thanks @readysteadywhoa for reporting this and providing a solution!

kp2bw's People

Contributors

jampe avatar fashberg avatar mcfisch avatar hwo-wd avatar kamko avatar chilinot avatar pwood avatar contrun avatar nestyxx avatar simondubrulle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.