Skip to main content

This is a command line tool to export and import passwords from/to pass (https://www.passwordstore.org/).

Project description

pass-export

This is a command line tool to export and import passwords from/to pass. The passwords are exported to symmetrically encrypted files so they are independent of your private key. You can use these exported files for making backups or to copy them to another computer.

$ pass
Password Store
├── bar
└── foo
$ pass-export
Please insert a password to encrypt the exported files: 
Please reenter the password: 
exported-passwords_2022-08-05/bar.gpg
exported-passwords_2022-08-05/foo.gpg

You can decrypt a password with

$ gpg -d exported-passwords_2022-08-05/foo.gpg

You can copy the exported passwords to a new computer and import them into a new password store

$ gpg --quick-gen-key pass default encrypt never
$ pass init pass
$ pass-import exported-passwords_2022-08-05
Please insert password to decrypt exported-passwords_2022-08-05/bar.gpg: 
imported exported-passwords_2022-08-05/bar.gpg
imported exported-passwords_2022-08-05/foo.gpg

Installation

You can install pass-export and pass-import via pip/pipx

$ pipx install pass-export

But since this is just one module you do not need to install it. You can just download and execute it. In that case you need to specify "export" or "import" as an additional first argument:

$ wget -O pass-export-import.py 'https://gitlab.com/erzo/pass-export/-/raw/master/src/pass_export/main.py'
$ python pass-export-import.py export

Requirements

This program relies on the following other programs which are called via subprocess:

  • gpg to decrypt and encrypt the passwords
  • gpgconf to restart the gpg-agent (I am temporarily changing ~/.gnupg/gpg-agent.conf so that even if you have configured gpg securely you do not need to reinsert your password for every single password.)
  • shred to remove a temporary file in which I shortly kept the password for the exported files so that you do not need to reenter it for every single password. The assumptions that shred is based upon are not valid for SSDs. Therefore I am writing the file to the path indicated by XDG_RUNTIME_DIR, hoping that it will stay in RAM instead of getting written to an SSD.

Running the tests

tox is configured to not download packages every time you run it so you can use it wen you have no internet connection, too. Instead it takes it's dependencies from the directory .package-store. This can be initialized with

$ ./release.sh --test

Afterwards you can continue to use that command or run tox directly:

tox

tox, however, is very slow. So you may prefer to run mypy and pytest manually. (The venv has been setup by release.sh.)

. venv/bin/activate
$ mypy src/pass_export/ tests/
$ pytest

License

This work is free. You can use, copy, modify, and/or distribute it under the terms of the BSD Zero Clause License, see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pass-export-1.0.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

pass_export-1.0.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file pass-export-1.0.0.tar.gz.

File metadata

  • Download URL: pass-export-1.0.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for pass-export-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b2de00e444198d28d34a4a3fa89970597127237a35d5e1c48a3115074a6a4a50
MD5 d1404e419bc86ba8d14d664dae5e46c4
BLAKE2b-256 468273a268566067f05961d73d4a6741f4e8f50abe241be8d31ce7e9e8d084dc

See more details on using hashes here.

File details

Details for the file pass_export-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pass_export-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be129afdb16efa724fb4d9448d70a1037f3f292b869ffefb78dbab4821b2de1c
MD5 31ecef0a5f0d2517830c3558e6df1dfb
BLAKE2b-256 7e94e53552779962c85b08b78f7cf9f1396a9e144f72a2d7e78c6e73f3e9ae65

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page