kpxcpc

command module
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2025 License: MIT Imports: 13 Imported by: 0

README

kpxcpc

A non-featureful KeePassXC-proxy command line client.

Same as browser extension, it retrieves passwords from an unlocked DB. Unlike secret-tool, it doesn't require you to set KeePassXC to be your secret service (there can only be one).

Installation

If you have Go set up, you can do

go install github.com/junkblocker/kpxcpc@latest

Obviously, you may want to review the code first :^)

There's also a PKGBUILD for Arch-based systems.

Usage

Usage of kpxcpc:
  -associate
        associate and print association info to stdout in json format
  -fmt string
        format string for entry fields: name - %n, login - %l, pass - %p,
          uuid - %u, custom fields - %F:fieldname
           (default "%p")
  -identity string
        set identity file (default "~/.local/share/kpxcpc/identity.json")
  -json
        print json
  -nounlock
        do not trigger DB unlock prompt
  -socket string
        path to keepassxc-proxy socket
  -totp
        get TOTP

To delimit entries with null-character, use \x00 instead of \0.

Custom entry fields need to have a name in the following format: KPH: myfield (with a space between prefix and field name) to be available through keepassxc-proxy. To refer to them in kpxcpc format string, use %F:myfield (without a space).

Example:

$ kpxcpc 'http://google.com'
pwAJWsXs2HcDvz5HM4mk3ub@7rdP7473n7y5i9

$ kpxcpc -fmt 'pass: %p\n' 'http://google.com'
pass: pwAJWsXs2HcDvz5HM4mk3ub@7rdP7473n7y5i9

$ kpxcpc -fmt 'pass: %p\nmyfield: %F:myfieldname\n' 'http://google.com'
pass: pwAJWsXs2HcDvz5HM4mk3ub@7rdP7473n7y5i9
myfield: hello world

$ kpxcpc -json 'http://google.com'
[{"login":"elon","name":"google","password":"pwAJWsXs2HcDvz5HM4mk3ub@7rdP7473n7y5i9","uuid":"d1e6cba53ad04e8fb23f2991c160ce5a","stringFields":[{"KPH: myfieldname":"hello world"}]}]

$ kpxcpc -totp 0851580ae78549e3be60949e908a040e
C2PHR

Security

Association info is stored in plaintext in ~/.local/share/kpxcpc/identity.json. If you want, you can manage the storage of association info manually:

  • use -associate to associate once and print identity json to stdout,
  • use -identity - to read identity json from stdin.

Still, if you use the browser extension, it's probably not too hard to retrieve association info from your browser profile.

$ kpxcpc -associate
{"id":"example","idKey":"tli3pJmrVwLEyfGcf29LzAKvNyAJaigu"}

$ echo '{"id":"example","idKey":"tli3pJmrVwLEyfGcf29LzAKvNyAJaigu"}' | kpxcpc -identity - 'https://google.com'
pwAJWsXs2HcDvz5HM4mk3ub@7rdP7473n7y5i9

Documentation

Overview

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis
The MIT License (MIT)
The MIT License (MIT)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL