Giter Club home page Giter Club logo

enpass-cli's Introduction

enpass-cli

A commandline utility for the Enpass password manager.

Installation

Go get yourself a compiled binary from the releases page.

CLI Usage

$ # set an alias to easily reuse
$ alias enp="enpasscli -vault=/my-vault-dir/ -sort"

$ # list anything containing 'twitter' (without password)
$ enp list twitter

$ # show passwords of 'enpass.com'
$ enp show enpass.com

$ # copy password of 'reddit.com' entry to clipboard
$ enp copy reddit.com

$ # print password of 'github.com' to stdout, useful for scripting 
$ password=$(enp pass github.com)

Commands

Name Description
list FILTER List vault entries matching FILTER without password
show FILTER List vault entries matching FILTER with password
copy FILTER Copy the password of a vault entry matching FILTER to the clipboard
pass FILTER Print the password of a vaulty entry matching FILTER to stdout
dryrun Opens the vault without reading anything from it
version Print the version
help Print the help text

Flags

Name Description
-vault=PATH Path to your Enpass vault
-keyfile=PATH Path to your Enpass vault keyfile
-type=TYPE The type of your card (password, ...)
-log=LEVEL The log level from debug (5) to error (1)
-nonInteractive Disable prompts and fail instead
-pin Enable Quick Unlock using a PIN
-and Combines filters with AND instead of default OR
-sort Sort the output by title and username of the list and show command
-trashed Show trashed items in the list and show command
-clipboardPrimary Use primary X selection instead of clipboard for the copy command

Development

# to run it from code
% go run ./cmd/... -vault=foo list

# to build it yourself
% make build
% ./enpass-cli -vault=foo list

Testing Code

$ go test -v $(go list ./... | grep -v /vendor/)

Using the library

See the documentation on pkg.go.dev.

enpass-cli's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar eugenmayer avatar hazcod avatar jabofh avatar jmastr avatar k8scat avatar kwbmm avatar msladek avatar nmaupu avatar v-braun avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

enpass-cli's Issues

Support One-time code type

When type is set to -type="One-time Code", nothing is returned.

This should have 2 use cases though:

  1. return the secret behind the OTP
  2. return the OTP code and probably skip the auth for this

example:

$ enp -type="One-time Code" show <filter>
INFO[0003] > title: <filter-match>  login: XXX  cat.: XXX  OTP: otpauth://totp/XXX?secret=XXX&issuer=XXX
INFO[0003] > title: <filter-match>  login: XXX  cat.: XXX  OTP: XXX
$ enp otp <filter>
INFO[0003] > title: <filter-match> OTP: 123456
INFO[0003] > title: <filter-match> OTP: 234567
$ enp otp -title <title> # Exact single match otherwise error
123456

No support for cloud synced vaults?

Trying out some basic commands works on a primary, local vault but doing the same on Dropbox or OneDrive connected vaults just gives me

ERRO[0002] could not open vault                          error="could not connect to database: file is not a database"

Are those really not supported or am I missing something?

Return just the secret without any additional logging

Hello!

I'm looking for functionality similar to secret=$(pass amazon.com) so the secret can be used in scripts. From what I've seen such functionality doesn't exist or I haven't found it but it would be really useful!

Thanks and keep up the good work!

Enpass 6.x compatibility

Hi,

Thanks for your work on this. I noticed in the README you mentioned that you were looking for a new maintainer. I'd be willing to pitch in there, and would also like to help with the 6.x compatibility. Let me know how to proceed.

Thanks!

Alternative Product

In the description you mention that you do not use enpass any longer. Did you find something similar which supports CLI interface? It so, would be nice to link it in the description as well.
Thank you for your efforts!

Unable to use on Linux.

The issue that I get is an "Invalid Password" error.

So with the code I added with my forks, I removed the import statement from pysqlcipher3 because it didn't work on Linux. The original import statement worked just fine on OS X.

This was the original statement:
from pysqlcipher3 import dbapi2 as sqlite

I changed it to:
from sqlite3 import dbapi2 as sqlite

Which fixed the issue described here of 'pysqlcipher3 module not found': Install Issues

However, I can't seem to decrypt the file on Linux. This is the output of the error that I get:
sqlite3.DatabaseError: file is not a database which results in an "Invalid Password" notification due to the try/except statement.

I tried using the original code from your commit history before my forks but that won't work as I keep running into the 'pysqlcipher3 module not found'.

Any ideas on knowing how to fix this on Linux? I have only tested on Ubuntu and Kali Linux. I have not tried the program on any non-Debian based Linux distros yet.

Broken cross-compilation

The release workflow seems to miss some dependencies to be able to cross-compile to e.g. freebsd.

Suggestion

Hi,

Thanks for the repository, It's really a need for enpass.

I was wondering, is it possible to add a list command? If there's a list command then this tool will have a wide ranged of applications which can be used. e.g. Alfred workflow.

Unknown driver "sqlite3" (forgotten import?)

So, I just downloaded release 1.0.1 for linux-amd64, and after getting it to point properly to my vault path, of $HOME/Documents/Enpass/Vaults/primary, it gave me this error:

FATA[0003] could not open vault error="could not open v: could not open database: sql: unknown driver "sqlite3" (forgotten import?)"

BTW, really glad you came back to work on this. And it seems like golang might be the way to go with this. ๐Ÿ‘

Help

Need power now red dot haha

.enpass file should not be stored in script path

in getCards() and CardCompleter(), it's trying to open getScriptPath() + '/.enpass' for write. If pass.py were installed to /usr/bin or /usr/local/bin, this would fail to work because of permissions.

Instead it should be using either $HOME/.enpass_cli, or even better $XDG_CONFIG_HOME with default to $HOME/.config, appending enpass_cli/config to the result of the former, and of course, automatically creating the directories up as needed.

Reference: https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

enpasscli should have a default type

I know, that the usage on the frontpage says to specify -type=password, but people are lazy / do not read the help.

I'd suggest to use type password as default, so that this:

ubuntu :: ~ % enpasscli -vault ~/go/src/github.com/hazcod/enpass-cli/test/ list
Enter master password: 
INFO[0003] > title: mylogin  login: myusername  cat. : login 
INFO[0003] > title: mylogin  login: myusername  cat. : login 
INFO[0003] > title: mylogin  login: myusername  cat. : login 
INFO[0003] > title: mylogin  login: myusername  cat. : login 
INFO[0003] > title: mylogin  login: myusername  cat. : login 
INFO[0003] > title: mylogin  login: myusername  cat. : login 
INFO[0003] > title: mylogin  login: myusername  cat. : login 
INFO[0003] > title: mylogin  login: myusername  cat. : login 
INFO[0003] > title: mylogin  login: myusername  cat. : login 

does not happen (the vault contains one entry)

Permission denied during installation

Output of python -m pip install -r requirements.txt:

Requirement already satisfied: pycrypto in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 1))
Collecting pysqlcipher3 (from -r requirements.txt (line 2))
  Using cached pysqlcipher3-1.0.2.tar.gz
Collecting argcomplete (from -r requirements.txt (line 3))
  Using cached argcomplete-1.9.2-py2.py3-none-any.whl
Installing collected packages: pysqlcipher3, argcomplete
  Running setup.py install for pysqlcipher3: started
    Running setup.py install for pysqlcipher3: finished with status 'done'
Exception:
Traceback (most recent call last):
  File "/home/user/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/user/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/home/user/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/home/user/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/home/user/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/home/user/.local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/home/user/.local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/home/user/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/argcomplete'

BTW, I believe that sqlcipher-dev is called libsqlcipher-dev on Debian distros, might be worth pointing out in the README.

Password should be cleared from clipboard after time threshold

Similarly to how the desktop GUI handles it, when copying the password from the Enpass wallet, the CLI should clear the password from the clipboard after, say, 30 seconds so the password does not remain in the user's clipboard. I keep having to run xsel -bc after copying my passwords and it would be nice if the CLI could handle this. Maybe the process could fork to the background and set the clipboard to a space or null character then terminate.

Fails to build on macOS

Running this command fails on macOS 10.15.7

CGO_ENABLED=1 go build -v -ldflags='-w -s -extldflags "-static -linkmode=external" -X main.version=1.0.2' ./cmd/enpasscli/main.go
golang.org/x/crypto/pbkdf2
golang.org/x/net/context
golang.org/x/sys/unix
github.com/atotto/clipboard
github.com/pkg/errors
github.com/miquella/ask
github.com/mutecomm/go-sqlcipher
github.com/sirupsen/logrus
github.com/hazcod/enpass-cli/pkg/enpass
command-line-arguments
# command-line-arguments
/usr/local/Cellar/go/1.15.7/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

installation issues

I've installed enpass-cli but got this error

โˆด ./pass.py --help
Traceback (most recent call last):
  File "./pass.py", line 4, in <module>
    from pysqlcipher3 import dbapi2 as sqlite
ImportError: No module named 'pysqlcipher3'

Do not know how to proceed. Can you help me?

Pass master password as parameter

A great improvement would be to be able to pass the master password as a parameter to be able to directly unlock the vault

e.g.:

enpasscli -vault=/xxxxxxxxxxxxx/Vaults/primary -masterpass <PASSWORD> list

could not decrypt data: cipher: message authentication failed

Hi!

enpass-cli is mostly working fine for me. I'm using the current App Store version of Enpass (macOS 6.8.1 (1060)).

Unfortunately, some of the items fail to decrypt:
% enp -log debug show 'redacted'
DEBU[0000] checking provided vault paths
DEBU[0000] loading vault info
DEBU[0000] vault info loaded vault_name=Standard vault_version=6
DEBU[0000] initialized paths db_path=vault.enpassdb info_path=vault.json
DEBU[0000] PIN disabled
Enter master password:
DEBU[0003] generating database key
DEBU[0003] generating master password
DEBU[0003] not using keyfile
DEBU[0003] extracting salt from database
DEBU[0003] deriving decryption key
DEBU[0003] opening encrypted database
DEBU[0003] opened vault
ERRO[0004] could not decrypt redacted error="could not decrypt data: cipher: message authentication failed"
DEBU[0004] closed vault error=""

Distinct exit code for invalid master password

Hey there, firstly thanks a lot for the tool, it is very helpful when working mostly with CLI.

I recently noticed while incorporating enpasscli in some bash scripts that all non-successful exits return 1, e.g. when unable to copy because the card wasn't found:

$ enp copy asdf || echo "Exit code: $?"
Enter master password: <VALID>
FATA[0004] card not found                               
Exit code: 1

However it would be useful to have distinct exit code for providing an invalid master password. Currently it also returns 1:

$ enp copy asdf || echo "Exit code: $?"
Enter master password: <INVALID>
FATA[0001] could not retrieve cards                      error="could not retrieve cards from database: file is not a database"
Exit code: 1

Now I'm not at all familiar with golang, but if I'm not mistaken we'd simply need to add e.g. os.Exit(2) in the error checks after getting the entries from the vault. I guess that'd be sufficient for my needs at least.

WDYT?

Support Biometrics on MacOS

One of my favorite things about Enpass is the ability to quickly unlock my vaults with my fingerprint on my Mac. What are the chances of supporting that?

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.