Giter Site home page Giter Site logo

keepmenu's Introduction

Keepmenu

PyPI - Python Version PyPI GitHub contributors

Fully featured Bemenu/Dmenu/Wmenu/Fuzzel/Rofi//Wofi/Yofi frontend for autotype and managing of Keepass databases.

Inspired in part by Passhole, but more dmenu and less command line focused.

Installation

pip install --user keepmenu

Ensure ~/.local/bin is in your $PATH. Run keepmenu and enter your database path, keyfile path, and password.

For full installation documention see the [installation docs][docs/install.md].

Full Documentation

Installation - Configuration - Usage

Requirements

  1. Python 3.7+
  2. Pykeepass >= 4.0.0 and pynput
  3. Bemenu, Dmenu, Wmenu, Fuzzel, Rofi, Wofi, or Yofi
  4. xsel or wl-copy
  5. (optional) Pinentry
  6. (optional) xdotool (for X), ydotool or wtype(for Wayland), dotool (X or Wayland).

Features

  • Supports .kdbx databases, not .kdb.
  • Auto-type username and/or password on selection. Select to clipboard if desired (clears clipboard after 30s).
  • Background process allows selectable time-out for locking the database.
  • Multiple databases can be unlocked and switched on the fly.
  • Use a custom Keepass 2.x style auto-type sequence.
  • Type, view or edit any field.
  • Open the URL in the default web browser.
  • Edit notes using terminal or gui editor.
  • Add and Delete entries.
  • Add, delete, rename and move groups.
  • Hide selected groups from the default and 'View/Type Individual entries' views.
  • Configure the characters and groups of characters used during password generation.
  • Optional Pinentry support for secure passphrase entry.
  • Keepass field references are supported.
  • Display and manage expired passwords.
  • Add, edit and type TOTP codes.
  • Add, edit, type and delete custom attributes.

License

  • GPLv3

Usage

keepmenu [-h] [-a AUTOTYPE] [-c CONF_FILE] [-C] [-d DATABASE] [-k KEY_FILE] [-t]

  • Run keepmenu or bind to keystroke combination.
  • Enter database path on first run.
  • Start typing to match entries.
  • Configure config.ini as desired.
  • More detailed usage information.

Tests

To run tests in a venv: make test

Development

  • To install keepmenu in a venv: make

  • Build man page from Markdown source: make man

  • Using hatch:

    • hatch shell: provies venv with editable installation.
    • hatch build && hatch publish: build and publish to Pypi.
  • Using nix:

    • nix develop path:.: Provides development shell with all dependencies. Edit and run similar to pip install -e . or hatch shell.

keepmenu's People

Contributors

aclindsa avatar anguye21 avatar aravinda0 avatar asimonen avatar bdeshi avatar br-olf avatar bwidawsk avatar das-s avatar elg3a avatar elmir-b avatar firecat53 avatar jampe avatar junker avatar mgoral avatar mraethel avatar psvenk avatar the-compiler avatar vaygr 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

keepmenu's Issues

IndexError: list index out of range

Hi I've installed keepmenu in my system because I think it is a great idea, but I am having problems running it.

Distro: Ubuntu 17.10 x64 updated.

What happens:

  1. type keepmenu in a terminal
  2. dmenu opens with a blue background and white foreground label entries
  3. start typing in dmenu, nothing happens neither in dmenu nor terminal output
  4. type something that actually may exist in the database, press enter:
Traceback (most recent call last):
  File "/usr/local/bin/keepmenu", line 279, in <module>
    run()
  File "/usr/local/bin/keepmenu", line 263, in run
    keepass = open_database([i for i in databases if i[0] == sel.strip()][0])
IndexError: list index out of range

What could be happening?

can't make it to work with rofi

Hi there,

it's really helpful the tool very appreciated. I'm a rofi user but can't make it to work with the example in the .ini you leave. I've tried many different things but I get this error:

`└──╼ $ cat ~/.config/keepmenu/config.ini
[dmenu]
dmenu_command = rofi -width 30

[dmenu_passphrase]
nf = #222222
nb = #222222
rofi_obscure = True

[database]
database_1 = /path/to/mydb.kdbx
pw_cache_period_min = 180
autotype_default = {USERNAME}{TAB}{PASSWORD}{ENTER}
`

I've tried calling as the belo without success:
keepmenu
rofi -modi "keepass:keepmenu" -show keepass -run-command 'keepmenu'

Would it be please possible on how to properly setup ?

Thanks in advace,
Julio

Fine-grained control over password generation

Hey all,

is there interest for a more fine-grained control over the password generation?

On some sites, especially non-english ones, there are specific requirements for the special characters used in the password. The current implementation only allows to pick all or none.

I think it would be preferable to be able to set those via the config file or even in rofi/dmenu. I'd help with the implementation as well if my python skills are up to the task.

Wayland autotype not possible

I'm currently using Sway and was hoping to be able to use keepmenu to input passwords, however it looks like it's impossible to use autotype on wayland since autotype is currently implemented using PyUserInput, which uses xlib, which can't pass through to wayland even when using dmenu-wayland.

Would it be possible to switch from using PyUserInput to something a bit friendlier to different display server protocols, such as evemu which works on both wayland and x11? Here's a quick tutorial that has a pretty straightforward example, and I believe it could be pretty simple to swap in, although I haven't looked through how keepmenu currently does things to know how easy it really would be.

Edit: After a bit more looking another possibility would be ydotool

Thanks!

Unable to use password with %

 ~/.config/keepmenu | keepmenu ed   
Traceback (most recent call last):
  File "/home/varac/.local/bin/keepmenu", line 1206, in <module>
    MANAGER = client()
  File "/home/varac/.local/bin/keepmenu", line 1032, in client
    mgr.connect()
  File "/usr/lib/python3.6/multiprocessing/managers.py", line 489, in connect
    conn = Client(self._address, authkey=self._authkey)
  File "/usr/lib/python3.6/multiprocessing/connection.py", line 487, in Client
    c = SocketClient(address)
  File "/usr/lib/python3.6/multiprocessing/connection.py", line 614, in SocketClient
    s.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/varac/.local/bin/keepmenu", line 1210, in <module>
    run()
  File "/home/varac/.local/bin/keepmenu", line 1195, in run
    dmenu = DmenuRunner(server)
  File "/home/varac/.local/bin/keepmenu", line 1045, in __init__
    self.database = get_database()
  File "/home/varac/.local/bin/keepmenu", line 252, in get_database
    args = CONF.items('database')
  File "/usr/lib/python3.6/configparser.py", line 858, in items
    return [(option, value_getter(option)) for option in d.keys()]
  File "/usr/lib/python3.6/configparser.py", line 858, in <listcomp>
    return [(option, value_getter(option)) for option in d.keys()]
  File "/usr/lib/python3.6/configparser.py", line 855, in <lambda>
    section, option, d[option], d)
  File "/usr/lib/python3.6/configparser.py", line 394, in before_get
    self._interpolate_some(parser, option, L, value, section, defaults, 1)
  File "/usr/lib/python3.6/configparser.py", line 444, in _interpolate_some
    "found: %r" % (rest,))
configparser.InterpolationSyntaxError: '%' must be followed by '%' or '(', found: '% ………'

Escaping the % with %% doesn't work neither, I get a ChecksumError then:

construct.core.ChecksumError: wrong checksum, read b'eccea587b10f3bb2e662a0f4c3e033a0dc85a73eafbac3cde82a42d455457f3d', computed b'0de2bf47f1955770e7c9663067938a7f88b21b74aa18365c768210da34452ddf'

(My password also contains brackets and spaces, not sure if this is related).

Also, one small documentation issue: Please document if it is possible/advised to use quotes for passwords which spaces, or if the quotes would be considered part of the password.

[request] Update AUR package

There was a problem you solved last year, about entries being typed twice. I would like to have it solved also when I install the package from AUR. Could you please make an update there when you get some time?

Already thankful!

Config parser crashes

Hello I encountered the following error and can not start keepmenu any longer.
It occurred after my home partition ran out of space but my config is unaltered under .config/keepmenu/config.ini
I freed some space and tried reinstalling keepmenu. Also a system reboot didn't help.

% keepmenu                      
Traceback (most recent call last):
  File "/usr/lib/python3.8/configparser.py", line 789, in get
    value = d[option]
  File "/usr/lib/python3.8/collections/__init__.py", line 898, in __getitem__
    return self.__missing__(key)            # support subclasses that define __missing__
  File "/usr/lib/python3.8/collections/__init__.py", line 890, in __missing__
    raise KeyError(key)
KeyError: 'port'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/keepmenu", line 1421, in <module>
    MANAGER = client()
  File "/usr/bin/keepmenu", line 1231, in client
    port, auth = get_auth()
  File "/usr/bin/keepmenu", line 174, in get_auth
    port = int(auth.get('DEFAULT', 'port'))
  File "/usr/lib/python3.8/configparser.py", line 792, in get
    raise NoOptionError(option, section)
configparser.NoOptionError: No option 'port' in section: 'DEFAULT'

[Feature Request] Feedback

It would be nice to have feedback for some incorrect actions. For example, if we enter the wrong passphrase, it should give some sort of message like "Incorrect Passphrase" rather than saying nothing and immediately exiting. This should also apply when the user has incorrectly configured settings (syntax errors and what not).

[Request] support direct bind to view?

hi again

I wonder if its possible to add a switch (ie keepmenu -d?) to launch keepmenu direct into view mode without first pressing `view/type individual entries'

for me i view alot of info in entries throughout the day and it could make life just a tad easier :D

thx

Z

Obscure password entry in 'Edit Entries' mode?

How hard is it to add a feature to obscure the password for an entry when you go into 'Edit Entries' mode so it's not visible by default? For instance, if you were forced to navigate to the Password entry itself and hit Enter to be able to view it. Perhaps this could be a config option if folks wouldn't want that behavior by default?

keepmenu crashing

Am I missing a python package?
Installed from aur

Traceback (most recent call last):
  File "/usr/bin/keepmenu", line 937, in <module>
    MANAGER = client()
  File "/usr/bin/keepmenu", line 755, in client
    mgr.connect()
  File "/usr/lib/python3.6/multiprocessing/managers.py", line 489, in connect
    conn = Client(self._address, authkey=self._authkey)
  File "/usr/lib/python3.6/multiprocessing/connection.py", line 487, in Client
    c = SocketClient(address)
  File "/usr/lib/python3.6/multiprocessing/connection.py", line 614, in SocketClient
    s.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/keepmenu", line 941, in <module>
    run()
  File "/usr/bin/keepmenu", line 926, in run
    dmenu = DmenuRunner(server)
  File "/usr/bin/keepmenu", line 768, in __init__
    self.database = get_database()
  File "/usr/bin/keepmenu", line 280, in get_database
    db_l[-1] = get_passphrase()
  File "/usr/bin/keepmenu", line 344, in get_passphrase
    password = dmenu_cmd(0, "Passphrase")
  File "/usr/bin/keepmenu", line 220, in dmenu_cmd
    extras = (["-" + str(k), str(v)] for (k, v) in args_dict.items())
UnboundLocalError: local variable 'args_dict' referenced before assignment```

'future' module not found

Recently when I was using keepmenu, I noticed that it just refused to start. When I ran keepmenu directly in my terminal, it said:

  File "/usr/bin/keepmenu", line 26, in <module>
    from pykeepass import PyKeePass
  File "/usr/lib/python3.7/site-packages/pykeepass/__init__.py", line 2, in <module>
    from .pykeepass import PyKeePass
  File "/usr/lib/python3.7/site-packages/pykeepass/pykeepass.py", line 8, in <module>
    from future.utils import python_2_unicode_compatible
ModuleNotFoundError: No module named 'future'

I have no idea why this happened. I can only guess that I updated my Arch system via sudo pacman -Syu and that might have updated PyKeepass in some way? I updated my system again via yay -Syu (for the AUR), but that didn't seem to update keepmenu. In any case, I found the solution already: I just need to install the future package via pip3 install --user future. However, I am concerned that I had to go out of my way to install something just so keepmenu wouldn't break. I would imagine Arch's package manager would have managed the dependencies for me.

I just wanted to let you know. Perhaps this dependency issue can be worked out?

AutoType keyboard layout

Hey, I'm using a German keyboard layout (de-latin1-nodeadkeys) and keepmenu is auto-typing my usernames and passwords wrong.

An email address like [email protected] is entered as user"domain.com. The " on a German keyboard is typed as [shift]+[2], that's the location where @ is on an american layout IIRC.

I didn't find a related setting in the config.ini, is it possible to use keepmenu with a German keyboard layout?

Make dmenu_command work with `sh -c "dmenu (...)"` and other non-dmenu commands that end up running dmenu

Hi there! I was looking around for dmenu-based keepass interfaces and found this,
which looks like exactly what I was looking for; but I have an issue with keepmenu.

The issue for is on how dmenu_cmd
parses dmenu_command. For some context, I want to set the font size by hostname.
The ini configuration file format does not support this, so I thought that
i'd just set it in dmenu_command. So, I tried something like this:

dmenu_command = sh -c 'dmenu -fn "$([ "$(hostname)" = "machine1" ] && {echo font1; exit; }; [ "$(hostname)" = "machine2" ] && {echo font2; exit; }; echo fallback)"'

This works in the command line, but not in dmenu_command.
I tried this with various quoting patterns, but to no avail. I took a look at
the code, and found out that dmenu_cmd blindly assumes that the first part
of dmenu_command is dmenu or rofi.
This is rather unintuitive and makes it impossible to do what I wanted.

I therefore suggest that dmenu_cmd see dmenu_command as magic and not parse it,
and rather only do a substitution with some magic string to insert arguments
like ´-l´, allowing the user to place the magic string where appropriate.
If you don't want to make this magic string mandatory, then it would be possible
to assume that it'll work by appending the args to dmenu_command.

I'm aware that it's possible to write a wrapper script to dmenu, but making
a file for something that can be done inline sounds like a script that shouldn't be.

autotype confuses "_" and "—"

I'm new to i3 so maybe this is just a configuration problem. If so, sorry for cluttering the bugtracker.

When I'm performing an autotype with keepmenu any "_" is replaced with "—" and I'm unable to login.

I'm using arch and have installed keepmenu from AUR.

In my i3 config I set my keymap to neo using:

exec setxkbmap de neo

Furthermore I'm using dmenu_command = /usr/bin/rofi in the config.ini

some usability requests

Thx for this great app

I have some requests to make keepmenu work similarly to rofi-pass which is very advanced

  1. dont hit enter by default? again for security reasons
  2. establish a standard for autotype sequences similar to rofi-pass perhaps?
  3. a way to type certain fields, like password only or username onlye.g. useful for git prompts

thx so much!

Z

pykeepass_cache library

I've been working on a library that transparently wraps pykeepass and temporarily holds a database open in a background process. I thought it might be useful for keepmenu.

Also any feedback would be appreciated.

Keepmenu crashes after entering Autotype sequence

After specifying an Autotype sequence for a particular entry ({PASSWORD}), keepmenu just crashed. I wasn't able to relaunch it either by calling keepmenu in the terminal. I was only able to use keepmenu again after logging out and logging back in. (EDIT: I have to reboot my computer entirely, actually) This happens every time I try to change the autotype sequence for an entry. This is very similar to issue #23.

System: Arch Linux (Linux LTS: 4.19.31-1)
Window Manager: i3-gaps
Config:

[dmenu]
dmenu_command = rofi -config ~/main/configs/rofi -dmenu -normal-window 
l = 12

[database]
pw_cache_period_min = 5
gui_editor = vscodium --extensions-dir ~/main/configs/vscode/extensions -w
type_library = xdotool
autotype_default = {USERNAME}{TAB}{PASSWORD}{ENTER}
database_1 = ~/main/configs/passwords.kdbx

Error: 'bytes' object has no attribute 'encode' after typing password

Hello!

I get the following error after typing my password in keepmenu: Error: 'bytes' object has no attribute 'encode'

For what it's worth, it has worked in the past with the same config file.

I use it with rofi.

Distro: Arch Linux
Installed python-keepmenu-git r88.b0f7532-1 from AUR.
Relevant package versions:
rofi-1.5.2-1
python-3.7.2-3
python-pykeepass-3.0.2-2
python-pyuserinput-git-r260.1502266119.ac2d4c7-1
xdotool 3.20160805.1-2

I have sent my config file and strace output to you by email, as I'd rather not have them available publicly.

Thanks for your great work!

Have option for maximum lines instead of fixed number of lines

When specifying the number of lines with the l option, the menu seems to have a fixed number of lines no matter what, even when there are only 1 or 2 options to choose from (e.g. when specifying whether to manually enter or generate password or enter the passphrase). This doesn't look too good because it wastes space. It would be better if the option was changed to be a max lines option, so that the menus are only as big as they need to be, but also not exceeding a certain number.

EDIT:

OS: Arch Linux 64-bit
Kernel: 4.19 LTS
Keepmenu version: python-keepmenu-git r8.7418838-1 (AUR)

Config:

[dmenu]
dmenu_command = rofi -config ~/main/configs/rofi -dmenu -normal-window 
l = 12

[database]
pw_cache_period_min = 5
editor = vscodium
type_library = pyuserinput
autotype_default = {PASSWORD}
database_1 = ~/main/configs/passwords.kdbx 

Screenshot of asking me for the passphrase

I tried modifying the lines parameter in my rofi config file, but didn't seem to affect the interface for my keepmenu window.

Add "create database" feature

I really like keepmenu because it does pretty much everything I want with my KeePass database. However, the only thing that keeps me from using it as my sole KeePass desktop client is the fact that it cannot create or manage databases (to my knowledge). For example, if the database file specified in the config file doesn't exist, then keepmenu should prompt you to create it and insert the relevant info (master password, etc.). I would like for there to be some way to create and manage databases so I can use this as my sole desktop client for KeePass.

Show attributes

It appears I'm not able to autofill, copy or view (protected) attributes.
Is this something that can be supported?

Autotype doesn't work about a quarter of the time

When using Qutebrowser, I noticed that autotyping my password failed about a fourth of the time; Sometimes the password had most of its characters turned uppercase, while also turning characters such as 2 into @ and 0 into ). For example: 2example43 -> @Example43. It seems like the autotyping mechanism thinks that the Shift key is held down or the CAPS lock is on, even though it actually isn't when I am autotyping it. Interestingly enough, this is only a problem inside Qutebrowser.

However, I also noticed that when I did have CAPS lock on or held down the Shift key, the same result occurred everywhere.

I'm wondering if there is a fix for this problem or perhaps maybe there is something wrong with Qutebrowser in how it somehow thinks that the Shift key is down or the CAPS lock key is on.

System: Arch Linux, Linux Version: 4.19 LTS, using i3 Window Manager and Qutebrowser
Invoking keepmenu by: Using i3 keybinding (alt+shift+space)

Keepmenu Config:

[dmenu]
dmenu_command = rofi -config ~/main/configs/rofi -dmenu -normal-window
l = 12

[database]
pw_cache_period_min = 5
gui_editor = vscodium
type_library = pyuserinput
autotype_default = {PASSWORD}
database_1 = ~/main/configs/passwords.kdbx

Connection refused error on launch

Hi,
First thank you for your tool, I can't use it yet, but it looks like a really nice piece of software. The reason why I can't use it is because jwhen running keepmenu just after typing my database password I get the following error:

Process DmenuRunner-2:
Traceback (most recent call last):
  File "/usr/bin/keepmenu", line 932, in <module>
    MANAGER = client()
  File "/usr/bin/keepmenu", line 758, in client
    mgr.connect()
  File "/usr/lib/python3.7/multiprocessing/managers.py", line 512, in connect
    conn = Client(self._address, authkey=self._authkey)
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 492, in Client
    c = SocketClient(address)
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 619, in SocketClient
    s.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/bin/keepmenu", line 788, in run
    self.dmenu_run()
  File "/usr/bin/keepmenu", line 833, in dmenu_run
    sel = view_all_entries(options, [i for i in self.kpo.entries if not
  File "/usr/lib/python3.7/site-packages/pykeepass/pykeepass.py", line 73, in entries
    return self.find_entries_by_title('.*', regex=True)
  File "/usr/lib/python3.7/site-packages/pykeepass/pykeepass.py", line 292, in find_entries_by_title
    first=first
  File "/usr/lib/python3.7/site-packages/pykeepass/pykeepass.py", line 272, in find_entries
    res = self._find(keys_xp, **kwargs)
  File "/usr/lib/python3.7/site-packages/pykeepass/pykeepass.py", line 159, in _find
    res = self._xpath(xp, tree=group._element if group else None)
  File "/usr/lib/python3.7/site-packages/pykeepass/pykeepass.py", line 85, in _xpath
    tree = self.kdb.tree
AttributeError: 'KDB3Reader' object has no attribute 'tree'

I am using archlinux and installed keepmenu directly thanks to your aur package. Do you have an idea of what is going wrong with my setup?

multiple Databases

Is it possible to have multiple databases loaded parallel? I always have to kill the deamon and load the other DB, it would be nice to just be able to search them both. Is that possible and I just missed how?

Ability to specify password command with parameter

I have stored my keepass masterpasswords in pass, and use gpg-agent.
I'd like to retrieve my passwords like this:

database_1 = ~/…
password_cmd = /usr/local/bin/gopass keepass-pw1
database_2 = ~/…
password_cmd = /usr/local/bin/gopass keepass-pw2
…

This would ease the usage of keepmenu a alot for me. Thx for this awesome app !

a way to remember password/key for a user defined time?

Been using keepmenu over the last few days and really love it

but it seems that each time i launch it i have to enter again my password/key

is it possible to remember the password for X minutes (or user defined period) so i dont have to re-enter the password 20 times an hour :D

thx!

Z

How do I use keepmenu to copy password to clipboard ?

When I run keepmenu and select the wanted entry, keepmenu won't copy the password to the clipboard.
Instead, it will output the USERNAMEPASSWORD together, without a seperator.

How do I use keepmenu to only copy the password to the clipboard ?

Editing empty passwords

It seems like when I attempt to edit empty passwords (i.e. the entry has already been created, but is empty), keepmenu crashes. I looked at the code in edit_entry, but I don't think I understand why

if field == 'password':
    sel = kp_entry.password

is above

edit_b = sel.encode(ENC) + b"\n"

... so I'm creating this issue instead!

The sel.encode(ENC) is the line it's crashing on because sel is None.

[request] Lock the database after user configurable timeout

Leaving the database open in memory can have security implications. Most KeePass clients allow to lock the database after a configurable timeout.

I would really like to be able to configure a user defined timeout after which the database needs to be reopened before use. I think many other users would also be interested in this feature.

Add and use as rofi mod

Is there a way to integrate keepmenu into a rofi mod script?
For this to work I'd need keepmenu to have a command to list all entries from the already logged in database, and further more start to autotype when for example the exact name of an entry is given.

The outcome would be to autotype directly from within rofi.

[request] allow for environment variables in config

I would like to include environment variables in the config.ini file. I often find myself adding a bunch of long filepaths or complicated variables that might change in the future, so this would be really convenient for me.

For example:

[some_section]
main_folder = $HOME/main
mountain_picture = $WALLPAPERS/mountain.jpg

I already have an idea of how you could accomplish this. Basically, you could just subclass BasicInterpolation and just expand the variables before the value is accessed:

import configparser, os
class EnvInterpolation(configparser.BasicInterpolation):

    def before_get(self, parser, section, option, value, defaults):
        return os.path.expandvars(value)

And then you would just initialize the config parser as:

parser = configparser.ConfigParser(interpolation=EnvInterpolation())

You could even subclass ExtendedInterpolation if you want the user to access variables from other sections (although the interpolation syntax is a bit different). I would really appreciate if you did this.

Have inactive timeout instead of just fixed timeout

I think it would be really helpful if keepmenu would remember the password for a period of time after last accessing keepmenu rather than a fixed amount of time as it is right now. I find myself running into situations where I am constantly using keepmenu in a 5 min period only to find myself faced with another master password prompt even though I was using it a second ago. This breaks my concentration. I could just increase the cache time period right now, but I don't think that's ideal.

For example:
inactive_timeout=1
If it's been 1 minute since you last accessed keepmenu, then ask for the master password again.

License issues

pykeepass is GPL3 so I think keepmenu should be, too.

I personally don't really care, but I thought you should know.

Special Characters are wrong

I added an entry (via keepasx2) to my database, where the pasword ist ???. Keepmenu does output &&& in that case.

I also tried other special characters and they all get transformed into other special characters.

Error: 'bytes' object has no attribute 'encode'

System: Arch Linux 4.19 LTS

Every time I try to open keepmenu (edit: after typing in my database password), I get the error message stating 'bytes' object has no attribute 'encode'. This happened after I recently updated my version of keepmenu to the latest version (r97.6634843-1 from AUR). I haven't updated in quite some time. Not quite sure what is causing this issue.

I have already tried uninstalling it and then reinstalling it via pip. (pip3 install --user keepmenu). Then I edited the config file to change the database path to my database. I had the exact same error with that config.

Add KeeAgent (SSH keys) support

Hi @firecat53,

first off: I found this little gem while looking for Keepass-based autotyping solutions that work on wayland, and I was blown away. Keepmenu is amazing! Thank you very much for sharing it! :)

There is only one feature I found missing for me so far: I still have to open KeepassXC in the background in order for my SSH-Keys to be added to my ssh-agent session. It'd be great if keepmenu could do this part, too.

In order to avoid appearing like a total freeloader, I've had a look into how the SSH Agent protocol and the KeeAgent settings work and come up with my own little prototype to deal with them. I've checked them in over at: https://github.com/mfrischknecht/python-keeagent

There are some caveats with this prototype so far, but on the whole, it seems to work. Since I had problems with pycryptodome (and pycrypto itself is hopelessly out of date), pyca/cryptography to me seemed like the best library option to deal with the key files. It can't deal with ed25519 keys (yet), but I have my hopes up that this will change soon. However, the dependency on pyca/cryptography would mean that python 3.2 and 3.3 wouldn't be supported anymore. Also, I've only tested the KeeAgent code on Keepass databases of version 4.x (created by KeepassXC) so far, but for those, it seems to work nicely. Also, so far, my prototype is read-only for those entries.

I've also found this site which details the option to store binaries in the 'inner header' of Keepass databases, but I haven't been able to figure out how to access that one so far.

Would you consider integrating KeeAgent-functionality into keepmenu anyway? If so, should I attempt to prepare a pull request for that?

Cheers,
Manuel

Setting empty Notes field

If I attempt to remove a Notes field via opening it in an editor and fully deleting it, keepmenu stops responding and I get:

Process DmenuRunner-2:
Traceback (most recent call last):
  File "/usr/bin/keepmenu", line 1258, in <module>
    MANAGER = client()
  File "/usr/bin/keepmenu", line 1071, in client
    mgr.connect()
  File "/usr/lib/python3.7/multiprocessing/managers.py", line 512, in connect
    conn = Client(self._address, authkey=self._authkey)
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 492, in Client
    c = SocketClient(address)
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 619, in SocketClient
    s.connect(address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/usr/bin/keepmenu", line 1106, in run
    self.dmenu_run()
  File "/usr/bin/keepmenu", line 1181, in dmenu_run
    edit = edit_entry(self.kpo, entry)
  File "/usr/bin/keepmenu", line 1008, in edit_entry
    setattr(kp_entry, field, sel)
  File "/usr/lib/python3.7/site-packages/pykeepass/entry.py", line 159, in notes
    return self._set_string_field('Notes', value)
  File "/usr/lib/python3.7/site-packages/pykeepass/entry.py", line 91, in _set_string_field
    self._element.append(E.String(E.Key(key), E.Value(value)))
  File "src/lxml/builder.py", line 226, in lxml.builder.ElementMaker.__call__
TypeError: bad argument type: NoneType(None)

If I'm reading the pykeepass source code right, it doesn't look like it supports either setting the notes field to None or deleting it entirely.

Autotype setting from KeePass

Hey, cool stuff.
First Question, am I missing something or is the default autotype behaviour always username tab password? Set Autotype sequence from within KeePass doesn't seem to have an effect.

Can't use notes field

For some reason, whenever I try to edit the notes field of a particular entry, not only does the editor (which I chose as gui_editor = vscodium ) not show up, but keepmenu exits and doesn't come back until after I reboot my machine. I keep trying to invoke keepmenu via a keybinding, but it refuses to show up. I typed "keepmenu" in the terminal it seems to immediately terminate without showing any output. I tried to kill the keepmenu daemon via pkill keepmenu, which had no effect, which means it probably stopped running. I even tried tried uninstalling and then reinstalling keepmenu, but I still can't open it. Again, it took a reboot to get it to start working again. This is rather frustrating, and I hope that this bug can be fixed.

System: Arch Linux, Linux Version: 4.19 LTS, using i3 Window Manager
Invoking keepmenu by: Using i3 keybinding (alt+shift+space)

Keepmenu Config:

[dmenu]
dmenu_command = rofi -config ~/main/configs/rofi -dmenu -normal-window 
l = 12

[database]
pw_cache_period_min = 5
gui_editor = vscodium
type_library = pyuserinput
autotype_default = {PASSWORD}
database_1 = ~/main/configs/passwords.kdbx

Stop daemon when password expires?

Maybe daemon should just stop when password expires? Instead of adding option to kill daemon with list of databases. Need to think on this.

View/Type individual entries inputs entry twice

Hello! I'm using Arch Linux and installed keepmenu from AUR. Standard inserting ("username\tpassword") is working fine, but when I try to type individual entries with keepmenu, they are input twice.

I recently formated my system (and I'm still using Arch), but the problem persists (it has never worked well for me).

Am I missing something?

By the way, thank you, It's nice that I can access my password in the way you've implemented keepmenu!

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.