KeyPass icon indicating copy to clipboard operation
KeyPass copied to clipboard

Import from and Export to csv/json file

Open rahaaatul opened this issue 1 year ago • 14 comments

Description

I can't restore my existing passwords from Bitwarden with one click.

Solution

I'd like an option to restore passwords from other major password storing apps like Bitwarden and also export to the same format, so we could restore it to the other password managers.

You could do it by doing:

  • Import from .CSV/.JSON file.
  • Export to .CSV/.JSON file

Example: CSV format:

folder,favorite,type,name,notes,fields,login_uri,login_username,login_password,login_totp

JSON format:

{
  "encrypted": false,
  "folders": [
    {
      "id": "c611ce38-a4ac-4d0c-a156-adab005a4ebf",
      "name": "Online Storage"
    },
    {
      "id": "8e281c4b-8e73-485a-8751-ad350098c30c",
      "name": "Social"
    }
  ],
  "items": [
    {
      "id": "4030542b-a4db-40d5-bc06-ae690081fa8e",
      "organizationId": null,
      "folderId": null,
      "type": 1,
      "name": "Example",
      "notes": null,
      "favorite": false,
      "login": {
        "uris": [
          {
            "match": null,
            "uri": "https://example.com/"
          },
          {
            "match": null,
            "uri": "androidapp://com.example.app"
          }
        ],
        "username": "[email protected]",
        "password": "a-long-boring-password!",
        "totp": null
      },
      "collectionIds": null
    }
  ]
}

rahaaatul avatar Aug 09 '23 06:08 rahaaatul

Can you please send a sample csv too

yogeshpaliyal avatar Aug 09 '23 08:08 yogeshpaliyal

Can you please send a sample csv too

Sorry, did not check the inbox in days! Sure here is the csv and JSON format with a screenshot of Bitwarden:

Screenshot

Screenshot_2023_0815_015035

CSV Format

,,login,Example,note-example,"custom-field-text: custom-text
custom-field-hidden: custom-field
custome-field-boolean: true
custom-field-linked: ","uri-example,uri-example-2",username,password,totp-example

JSON Format


    {
      "id": "6b87d50b-3ca9-44bc-bbd4-b05e0146937e",
      "organizationId": null,
      "folderId": null,
      "type": 1,
      "name": "Example",
      "notes": "note-example",
      "favorite": false,
      "fields": [
        {
          "name": "custom-field-text",
          "value": "custom-text",
          "type": 0
        },
        {
          "name": "custom-field-hidden",
          "value": "custom-field",
          "type": 1
        },
        {
          "name": "custome-field-boolean",
          "value": "true",
          "type": 2
        },
        {
          "name": "custom-field-linked",
          "value": null,
          "type": 3
        }
      ],
      "login": {
        "uris": [
          {
            "match": null,
            "uri": "uri-example"
          },
          {
            "match": null,
            "uri": "uri-example-2"
          }
        ],
        "username": "username",
        "password": "password",
        "totp": "totp-example"
      },
      "collectionIds": null
    },

I hope these helps. Again, sorry for the late reply @yogeshpaliyal .

rahaaatul avatar Aug 14 '23 19:08 rahaaatul

Hi @yogeshpaliyal, I would like to work on this issue. Can you please assign it to me?

divyampahujaa avatar Oct 12 '23 02:10 divyampahujaa

Sure

yogeshpaliyal avatar Oct 12 '23 06:10 yogeshpaliyal

@divyampahujaa Are you working on this?

yogeshpaliyal avatar Oct 28 '23 05:10 yogeshpaliyal

@yogeshpaliyal Busy with university exams for the next couple of weeks. I will work on it afterwards :)

divyampahujaa avatar Oct 28 '23 12:10 divyampahujaa

Cool, all the best for the exams.

yogeshpaliyal avatar Oct 28 '23 12:10 yogeshpaliyal

@yogeshpaliyal Busy with university exams for the next couple of weeks. I will work on it afterwards :)

Are you working on this?

rahaaatul avatar Mar 14 '24 10:03 rahaaatul

No, I am not working

yogeshpaliyal avatar Mar 14 '24 10:03 yogeshpaliyal

Hi @yogeshpaliyal , can I work on this issue?

HimanshuC22 avatar Mar 15 '24 12:03 HimanshuC22

@HimanshuC22 sure, then I'll assign this to you. Cc @rahaaatul

yogeshpaliyal avatar Mar 15 '24 13:03 yogeshpaliyal

I was confronted with this dilemma today when I looked for a compatible app to work on my Mac/Linux/Windows boxes. The ability to import/export to a Keepass compatible format from/to Keypass seems like it would expand KeyPass's adoption. At the very least, a CSV File. I've attached a couple of example exports (csv and xml) from KeepassXC. examples.zip

deanaba avatar Apr 06 '24 20:04 deanaba

@deanaba Support for KeePassXC csv has been added in #828 Thanks for sharing this CSV

yogeshpaliyal avatar Apr 07 '24 11:04 yogeshpaliyal

Google password csv format uses the name,url,username,password,note fields

Convert the bitwarden json to a compatible csv

  • Json export from bitwarden
  • Name the file bitwarden.json
  • create a script.py file and python script.py it.
import json
import csv

# Load Bitwarden JSON file
with open('bitwarden.json', 'r') as file:
    data = json.load(file)

# Prepare CSV data
csv_data = []
for item in data.get('items', []):
    name = item.get('name', '')
    login = item.get('login', {})
    
    # Check if 'uris' is a list and not empty
    uris = login.get('uris', [])
    if uris and isinstance(uris, list):
        url = uris[0].get('uri', '')
    else:
        url = ''

    username = login.get('username', '')
    password = login.get('password', '')
    note = item.get('notes', '')

    csv_data.append([name, url, username, password, note])

# Write CSV file
with open('google_takeout_export.csv', 'w', newline='', encoding='utf-8') as file:
    writer = csv.writer(file)
    writer.writerow(['name', 'url', 'username', 'password', 'note'])  # CSV header
    writer.writerows(csv_data)

print("Conversion completed successfully.")

A google_takeout_export.csv file will be created use that file in keypass using the google option.

Btw keypass has so potential but its useless without auto fill .

ippocratis avatar Aug 05 '24 12:08 ippocratis