Skip to content

Instantly share code, notes, and snippets.

@mohamedadaly
mohamedadaly / bw_export_kp.py
Last active April 14, 2024 03:57
Export Bitwarden to KeePass 2 XML format
#!/usr/bin/python
from __future__ import print_function
import base64
import commands
import json
import sys
import uuid
import xmltodict
# Export data from Bitwarden to import into KeePass 2
# Logic:
# - list folders and items and cat them together into two objects
# - add the two objects into one with . | add with .items and .folders
# - loop on items with .items[] as $i
# - for each $i, loop on folders with .folders and select the right folder
# with that id (basically a left join)
# - generate the object with required fields
# - create a comma separated line from each object, including the header at the beginning