Git Product home page Git Product logo

bitwarden-dl's Introduction

bitwarden-dl

A small Python script which creates an encrypted Bitwarden backup, including all attachments and supporting YubiKeys.

The script creates a json export of your vault, downloads all attachments and than creates an encrypted 7z archive using your Bitwarden's master password.

Why?

Bitwarden's own export function is quick and great, but it doesn't download the attachments for you.

For this reason there is a great project called portwarden which offers import and export features. But it only works with e-mail and password combination. This is a problem when you have your account secured using a YubiKey.

Therefor I wrote this script which uses an API client id and key, which is compatible with YubiKey as 2FA. This script only offers export features though for backup reasons.

Installation

  1. Clone this repo or download the files
  2. Install Python
  3. Install the Bitwarden CLI and make sure it's available in your PATH variable
  4. Install the requirements
    • pip install -r requirements.txt

Usage

  1. Go to bitwarden.com -> Account Settings -> Security -> Keys -> API Key and note your API Key and client id
  2. Run the script in the command line
    • python ./bitwarden-dl.py
  3. Enter the credentials when asked

Arguments

Alternatively, instead of entering the credentials manually, you can pass them as arguments. Please see my thoughts about this below.

  -h, --help           show this help message and exit
  --id ID              Your API client ID
  --secret SECRET      Your API client secret
  --password PASSWORD  Your Bitwarden master password

Thoughts about security

  • All your vault content will be stored in temp files unencrypted during the process. Only use this script on computers you trust and ideally use disc encryption.
  • The script stores your credentials in environment variables during its runtime. They could potentially be read out from other programs.
  • When passing the credentials as arguments, this should only be done by loading the credentials from a secrets vault, that way they won't land in your command line history. Something like the Apple Keychain, Powershell SecretManagement or a Linux alternative.

Portwarden didn't work for me since I use a Yubikey.

So I wrote a Python script which creates encrypted backups including attachments. To log in an API token is used, that way it works also with Yubikeys or any other form of 2FA.

bitwarden-dl's People

Contributors

henningbunk avatar

Stargazers

Manoj Chandrasekaran avatar Matthew Hugley avatar silo avatar  avatar Nick Ryan avatar Lorenzo Faccini avatar  avatar peroksid5 avatar  avatar Mohamed Ks avatar  avatar Pharcyde#0394 avatar nitrohorse avatar

Watchers

 avatar

bitwarden-dl's Issues

Error after logging in

When running i get this Error below

python ./bitwarden-dl.py
Please enter your Bitwarden API client ID:
Please enter your API client secret:
Please enter your Bitwarden master password:
Logging into your vault...
Traceback (most recent call last):
  File "C:\Users\username\Desktop\bitwarden-dl-main\bitwarden-dl.py", line 224, in <module>
    main()
  File "C:\Users\username\Desktop\bitwarden-dl-main\bitwarden-dl.py", line 17, in main
    bw = Bitwarden(id, secret, password)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\Desktop\bitwarden-dl-main\bitwarden-dl.py", line 127, in __init__
    subprocess.check_output([
  File "C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 548, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\username\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 1538, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [WinError 2] The system cannot find the file specified

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.