Coder Social home page Coder Social logo

pbkhrv / ulauncher-keepassxc Goto Github PK

View Code? Open in Web Editor NEW
19.0 3.0 13.0 123 KB

Ulauncher extension to quickly search a KeePassXC password manager database

License: MIT License

Python 96.41% Shell 0.19% Makefile 3.41%
ulauncher ulauncher-extension ulauncher-extensions keepassxc

ulauncher-keepassxc's Introduction

ulauncher-keepassxc

A Ulauncher extension to search your KeePassXC password manager database and copy passwords to the clipboard.

Features

  • Quickly search through the database entries by name, and copy passwords/usernames/URLs to the clipboard
  • Work with any file (.kdbx etc) that can be accessed by the KeePassXC itself via the keepassxc-cli command line tool
  • Support files locked with a passphrase. The extension asks for the passphrase and stores it in memory for a configurable amount of time
  • Doesn't require the KeePassXC app to be running

Requirements

  • Install a recent version of KeePassXC (tested with 2.4.3, 2.5.0 and 2.6.6)
  • Make sure you can execute keepassxc-cli in a terminal without errors

Installation

Open Ulauncher preferences window -> Extensions -> "Add extension" and paste the following url:

https://github.com/pbkhrv/ulauncher-keepassxc

Configuration

  • Password database location: path to the password database file that you want to access through Ulauncher. This is the only preference that you need to set before you can use the extension.

  • Inactivity lock timeout: forces you to re-enter the passphrase after you haven't used the extension for a while. By default it's set to 600 seconds (10 minutes). If you'd rather not re-enter it, you can set the value to 0, but that's probably not a great idea. NOTE: The cached passphrase is only stored in memory, so you'll need to re-enter it if you reboot your computer or restart Ulauncher.

Usage

Open Ulauncher and type in "kp " to start the extension. If your password database is locked with a passphrase, it'll ask you to enter it:

Unlock Database

Once unlocked, search the database for Github logins:

Search

Look at the Github work entry:

Entry details

Troubleshooting

Why doesn't the passphrase window come to the foreground when it's asking me to unlock the database?

Please install wmctrl - it's a utility that ulauncher-keepassxc calls to "activate" the passphrase window and bring it to the top:

Ubuntu and Debian

sudo apt-get install wmctrl

Development

I use the following tools while working on this extension:

  • Black code formatter
  • pytest
  • pylint with the flake8 plugin
  • mypy static type checker

You can install them in one shot (except for Black - that's up to you) by running:

pip install -r scripts/requirements.txt

Check PEP8 compliance, perform static type analysis and run unit tests:

make test

Backup the "production" version of the extension and symlink the development version into Ulauncher's extension directory:

make symlink

Quit Ulauncher. Then run it in debug mode:

make run_ul

Run extension in the terminal, connect it to Ulauncher in debug mode:

make run

(if that doesn't work, check the connection string URL printed out by Ulauncher and modify the Makefile accordingly.)

Unlink the development version of the extension from Ulauncher and replace it with whatever was there before:

make unlink

Contributions

Issues and pull requests are welcome!

Inspiration and thanks

I loved Alfred on MacOS, and now I love Ulauncher on Linux. The Python API is a joy to work with.

Thanks to pass-ulauncher for the overall structure and for teaching me a few things about the API. I aaaalmost switched away from KeePassXC to pass: the standard unix password manager because of it.

The Noun Project for the icons - there's nothing else quite like it.

Finally, thanks to KeePassXC on Linux and KyPass on iOS.

License

MIT license. See LICENSE file for details.

ulauncher-keepassxc's People

Contributors

pbkhrv avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

ulauncher-keepassxc's Issues

Ability to generate and save a new password

Simplest workflow:

  • User enters "kp new entry title"
  • Ext displays search results and "Generate and save password / Create 'new entry title'"
  • User selects "Generate..." and presses Enter
  • Ext runs keepassxc-cli add -g database_path "new entry title"
  • Ext copies the new password to the clipboard

(Password length and generation options can be made configurable, passed as CLI options)

One downside of this approach is that there's not a straightforward way to specify username or URL for the new entry. There might be a ulauncher-centric solution for that, need to think about it.

Multiple databases

It would be great to be able to handle multiple databases (maybe each of them which a dedicated search string configured).

Use fuzzy search instead of whatever "keepasxc-cli locate" does

Doing our own searching of entry names requires having fast access to the full list of entries stored in a particular database. How?

  • Option 1: run "keepassxc-cli ls" every time, parse the output, run regex on it
  • Option 2: run "keepassxc-cli ls" periodically, maintain the entry list in memory and search through that instead

The Plan:

  • Implement and test option 1 for speed and responsiveness
  • IF option 1 proves to be too slow, implement option 2

Option 2 implementation:

  • Run "ls" when database is unlocked
  • Run "ls" whenever database file changes - launch a separate monitor thread when extension starts up and use pyinotify to watch the database file for changes
  • Compile a regex based on query, then call .search on it: "gith wor" -> r"gith.*?wor"

error searching keepass database

In the last few days I started having a problem searching my keepass database using the keepass search extension. I attached a screenshot of the error message. The error is resolved after changing "locate" to "search" on line 127 of keepassxc_db.py file.
I apologize for not using the proper formatting, as I'm not a coder. Just want to let the creator know so the change can be made if needed
ulauncher-keepass-search extension error message screenshot
.

Can't find the database file, no matter what

I've tried moving my kdbx, I've tried renaming it, I've tried creating a symlink with the default name. No matter what I do, I get "cannot find the database file."

We could troubleshoot this, but it seems more sensible to suggest a file chooser.

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.