pass2csv


Namepass2csv JSON
Version 1.1.1 PyPI version JSON
download
home_page
SummaryExport pass(1), "the standard unix password manager", to CSV
upload_time2024-01-27 18:26:46
maintainer
docs_urlNone
author
requires_python>=3.6
license
keywords csv export pass2csv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pass2csv

pass2csv is a tool that exports a
[pass(1)](https://www.passwordstore.org/) password store to a CSV. It
can export whole stores, subdirectories of a store, and single password
files. It can use regexp patterns to find and group data after the first
line of each password into additional CSV columns, as well as exclude
data from the export.

Source is available [at GitHub](https://github.com/reinefjord/pass2csv),
and the package is published to the
[Python Package Index](https://pypi.org/project/pass2csv/).

You can install the package with [pipx](https://pypa.github.io/pipx/)
(recommended):

    pipx install pass2csv

or with pip:

    python3 -m pip install --user pass2csv


## Usage

```
$ pass2csv --help
usage: pass2csv [-h] [-b path] [-g executable] [-a]
                [--encodings encodings] [-e pattern] [-f name pattern]
                [-l name pattern] [--version]
                STOREPATH OUTFILE

positional arguments:
  STOREPATH             path to the password-store to export
  OUTFILE               file to write exported data to, use - for stdout

options:
  -h, --help            show this help message and exit
  -b path, --base path  path to use as base for grouping passwords
  -g executable, --gpg executable
                        path to the gpg binary you wish to use (default:
                        'gpg')
  -a, --use-agent       ask gpg to use its auth agent
  --encodings encodings
                        comma-separated text encodings to try, in order,
                        when decoding gpg output (default: 'utf-8')
  -e pattern, --exclude pattern
                        regexp for lines which should not be exported, can
                        be specified multiple times
  -f name pattern, --get-field name pattern
                        a name and a regexp, the part of the line matching
                        the regexp will be removed and the remaining line
                        will be added to a field with the chosen name.
                        only one match per password, matching stops after
                        the first match
  -l name pattern, --get-line name pattern
                        a name and a regexp for which all lines that match
                        are included in a field with the chosen name
  --version             show program's version number and exit
```


### Format

The output format is

    Group(/),Title,Password,[custom fields...],Notes

You may add custom fields with `--get-field` or `--get-line`. You supply
a *name* for the field and a regexp *pattern*. The field name is used for
the header of the output CSV and to group multiple patterns for the same
field; you may specify multiple patterns for the same field by
specifying `--get-field` or`--get-line` multiple times with the same
name. Regexp patterns are case-insensitive.


### Example usage

```
$ gpg -d ~/.password-store/sites/example/login.gpg
password123
---
username: user_name
email user@example.com
url:example.com
Some note

$ pass2csv ~/.password-store - \
    --exclude '^---$' \
    --get-field Username '(username|email):?' \
    --get-field URL 'url:?'

"Group(/)","Title","Password","URL","Username","Notes"
"sites/example","login","password123","example.com","user_name","email user@example.com

Some note"
```


### Grouping

The group is relative to the path, or the `--base` if given.
Given the password `~/.password-store/sites/example/login.gpg`:

    $ pass2csv ~/.password-store/sites
        # Password will have group "example"

    $ pass2csv ~/.password-store/sites --base ~/.password-store
        # Password will have group "sites/example"


## gpg-agent password timeout

If your private key is protected by a password, `gpg` will ask for it
with the `pinentry` program if you haven't set it to something else. If
using `gpg2` or the `-a` option with `gpg`, by default, the password is
cached for 10 minutes but the timer is reset when using a key. After 2
hours the cache will be cleared even if it has been accessed recently.

You can set these values in your `~/.gnupg/gpg-agent.conf`:

```
default-cache-ttl 600
max-cache-ttl 7200
```


## Development

Create a virtual environment:

    python3 -m venv venv

Activate the environment:

    . venv/bin/activate

Now you may either use `pip` directly to install the dependencies, or
you can install `pip-tools`. The latter is recommended.


### pip

    pip install -r requirements.txt


### pip-tools

[pip-tools](https://github.com/jazzband/pip-tools) can keep your virtual
environment in sync with the `requirements.txt` file, as well as
compiling a new `requirements.txt` when adding/removing a dependency in
`requirements.in`.

It is recommended that pip-tools is installed within the virtual
environment.

    pip install pip-tools
    pip-compile  # only necessary when adding/removing a dependency
    pip-sync


### Packaging

See [Python Packaging User Guide](https://packaging.python.org/tutorials/packaging-projects/) for detailed info.

0. `pip-sync requirements.txt dev-requirements.txt`
1. Increment `__version__` in `pass2csv.py`.
2. `rm -rf dist/* && python3 -m build`
4. `python3 -m twine upload dist/*`

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pass2csv",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "Rupus Reinefjord <rupus@reinefjord.net>",
    "keywords": "csv,export,pass2csv",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/1b/53/a762f51e5ae59e84296bcc28094e2f670227bd7bfcbd4e3653dd74f85ad5/pass2csv-1.1.1.tar.gz",
    "platform": null,
    "description": "# pass2csv\n\npass2csv is a tool that exports a\n[pass(1)](https://www.passwordstore.org/) password store to a CSV. It\ncan export whole stores, subdirectories of a store, and single password\nfiles. It can use regexp patterns to find and group data after the first\nline of each password into additional CSV columns, as well as exclude\ndata from the export.\n\nSource is available [at GitHub](https://github.com/reinefjord/pass2csv),\nand the package is published to the\n[Python Package Index](https://pypi.org/project/pass2csv/).\n\nYou can install the package with [pipx](https://pypa.github.io/pipx/)\n(recommended):\n\n    pipx install pass2csv\n\nor with pip:\n\n    python3 -m pip install --user pass2csv\n\n\n## Usage\n\n```\n$ pass2csv --help\nusage: pass2csv [-h] [-b path] [-g executable] [-a]\n                [--encodings encodings] [-e pattern] [-f name pattern]\n                [-l name pattern] [--version]\n                STOREPATH OUTFILE\n\npositional arguments:\n  STOREPATH             path to the password-store to export\n  OUTFILE               file to write exported data to, use - for stdout\n\noptions:\n  -h, --help            show this help message and exit\n  -b path, --base path  path to use as base for grouping passwords\n  -g executable, --gpg executable\n                        path to the gpg binary you wish to use (default:\n                        'gpg')\n  -a, --use-agent       ask gpg to use its auth agent\n  --encodings encodings\n                        comma-separated text encodings to try, in order,\n                        when decoding gpg output (default: 'utf-8')\n  -e pattern, --exclude pattern\n                        regexp for lines which should not be exported, can\n                        be specified multiple times\n  -f name pattern, --get-field name pattern\n                        a name and a regexp, the part of the line matching\n                        the regexp will be removed and the remaining line\n                        will be added to a field with the chosen name.\n                        only one match per password, matching stops after\n                        the first match\n  -l name pattern, --get-line name pattern\n                        a name and a regexp for which all lines that match\n                        are included in a field with the chosen name\n  --version             show program's version number and exit\n```\n\n\n### Format\n\nThe output format is\n\n    Group(/),Title,Password,[custom fields...],Notes\n\nYou may add custom fields with `--get-field` or `--get-line`. You supply\na *name* for the field and a regexp *pattern*. The field name is used for\nthe header of the output CSV and to group multiple patterns for the same\nfield; you may specify multiple patterns for the same field by\nspecifying `--get-field` or`--get-line` multiple times with the same\nname. Regexp patterns are case-insensitive.\n\n\n### Example usage\n\n```\n$ gpg -d ~/.password-store/sites/example/login.gpg\npassword123\n---\nusername: user_name\nemail user@example.com\nurl:example.com\nSome note\n\n$ pass2csv ~/.password-store - \\\n    --exclude '^---$' \\\n    --get-field Username '(username|email):?' \\\n    --get-field URL 'url:?'\n\n\"Group(/)\",\"Title\",\"Password\",\"URL\",\"Username\",\"Notes\"\n\"sites/example\",\"login\",\"password123\",\"example.com\",\"user_name\",\"email user@example.com\n\nSome note\"\n```\n\n\n### Grouping\n\nThe group is relative to the path, or the `--base` if given.\nGiven the password `~/.password-store/sites/example/login.gpg`:\n\n    $ pass2csv ~/.password-store/sites\n        # Password will have group \"example\"\n\n    $ pass2csv ~/.password-store/sites --base ~/.password-store\n        # Password will have group \"sites/example\"\n\n\n## gpg-agent password timeout\n\nIf your private key is protected by a password, `gpg` will ask for it\nwith the `pinentry` program if you haven't set it to something else. If\nusing `gpg2` or the `-a` option with `gpg`, by default, the password is\ncached for 10 minutes but the timer is reset when using a key. After 2\nhours the cache will be cleared even if it has been accessed recently.\n\nYou can set these values in your `~/.gnupg/gpg-agent.conf`:\n\n```\ndefault-cache-ttl 600\nmax-cache-ttl 7200\n```\n\n\n## Development\n\nCreate a virtual environment:\n\n    python3 -m venv venv\n\nActivate the environment:\n\n    . venv/bin/activate\n\nNow you may either use `pip` directly to install the dependencies, or\nyou can install `pip-tools`. The latter is recommended.\n\n\n### pip\n\n    pip install -r requirements.txt\n\n\n### pip-tools\n\n[pip-tools](https://github.com/jazzband/pip-tools) can keep your virtual\nenvironment in sync with the `requirements.txt` file, as well as\ncompiling a new `requirements.txt` when adding/removing a dependency in\n`requirements.in`.\n\nIt is recommended that pip-tools is installed within the virtual\nenvironment.\n\n    pip install pip-tools\n    pip-compile  # only necessary when adding/removing a dependency\n    pip-sync\n\n\n### Packaging\n\nSee [Python Packaging User Guide](https://packaging.python.org/tutorials/packaging-projects/) for detailed info.\n\n0. `pip-sync requirements.txt dev-requirements.txt`\n1. Increment `__version__` in `pass2csv.py`.\n2. `rm -rf dist/* && python3 -m build`\n4. `python3 -m twine upload dist/*`\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Export pass(1), \"the standard unix password manager\", to CSV",
    "version": "1.1.1",
    "project_urls": {
        "Changelog": "https://github.com/reinefjord/pass2csv/releases",
        "Homepage": "https://github.com/reinefjord/pass2csv"
    },
    "split_keywords": [
        "csv",
        "export",
        "pass2csv"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "322661c22740b33dc3ff409eb8a298ff8b292633f815be6ad85f0e5df0d77997",
                "md5": "cd3ea0f52ab54a93505b30a3d228c804",
                "sha256": "533f6ae2c1124ff3b7a5922d27ed853f7f62f09e8e51b9d2adf55d9dd7b0cb86"
            },
            "downloads": -1,
            "filename": "pass2csv-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cd3ea0f52ab54a93505b30a3d228c804",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 7055,
            "upload_time": "2024-01-27T18:26:44",
            "upload_time_iso_8601": "2024-01-27T18:26:44.132571Z",
            "url": "https://files.pythonhosted.org/packages/32/26/61c22740b33dc3ff409eb8a298ff8b292633f815be6ad85f0e5df0d77997/pass2csv-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b53a762f51e5ae59e84296bcc28094e2f670227bd7bfcbd4e3653dd74f85ad5",
                "md5": "526bf79d42e3510690c0e190fb549964",
                "sha256": "a7bafecc36a42b2fcdf916f101f19ab6f9180832918794f7a30a1852b1c9e4dd"
            },
            "downloads": -1,
            "filename": "pass2csv-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "526bf79d42e3510690c0e190fb549964",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6661,
            "upload_time": "2024-01-27T18:26:46",
            "upload_time_iso_8601": "2024-01-27T18:26:46.193710Z",
            "url": "https://files.pythonhosted.org/packages/1b/53/a762f51e5ae59e84296bcc28094e2f670227bd7bfcbd4e3653dd74f85ad5/pass2csv-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-27 18:26:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "reinefjord",
    "github_project": "pass2csv",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "pass2csv"
}
        
Elapsed time: 0.70328s