From eabdd27e40c63b0de69965949dab3ee60510d1bb Mon Sep 17 00:00:00 2001 From: Tobias Neitzel Date: Wed, 31 May 2023 10:15:19 +0200 Subject: [PATCH 1/6] Add icon support Credential icons can now be configured and are displayed within rofi. --- qubes-keepass.py | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/qubes-keepass.py b/qubes-keepass.py index 79d35d8..61b6563 100755 --- a/qubes-keepass.py +++ b/qubes-keepass.py @@ -495,8 +495,9 @@ def __init__(self, item: Secret.Item, service: Secret.Service) -> None: self.meta = parse_qube_list(settings.get('meta')) self.qubes = parse_qube_list(settings.get('qubes')) - self.trust = settings.get('trust', None) + self.trust = settings.get('trust') self.timeout = int(settings.get('timeout', Config.get('timeout'))) + self.icon = settings.get('icon') if self.trust is not None: self.trust = int(self.trust) @@ -753,13 +754,22 @@ def __str__(self) -> str: for credential in self.credentials: + line = '' folder = credential.path.parent.name or 'Root' - formatted += lcut(credential.title, Config.getint('title_length')) - formatted += lcut(folder, Config.getint('folder_length')) - formatted += lcut(credential.username, Config.getint('username_length')) - formatted += lcut(credential.url, Config.getint('url_length')) - formatted += '\n' + line += lcut(credential.title, Config.getint('title_length')) + line += lcut(folder, Config.getint('folder_length')) + line += lcut(credential.username, Config.getint('username_length')) + line += lcut(credential.url, Config.getint('url_length')) + + if '-show-icons' in Config.get_rofi_options(): + + if credential.icon is not None: + line += f'\x00icon\x1f{credential.icon}' + + line = ' ' + line + + formatted += line + '\n' return formatted @@ -775,8 +785,13 @@ def display_rofi(self, qube: str = 'Qube') -> (int, Credential): Returns: Credential item selected by the user and exit code ''' + title_length = Config.getint('title_length') + + if '-show-icons' in Config.get_rofi_options(): + title_length += 3 + rofi_mesg = f'Selected credential is copied to {qube}\n\n' - rofi_mesg += lcut('Title', Config.getint('title_length')) + rofi_mesg += lcut('Title', title_length) rofi_mesg += lcut('Folder', Config.getint('folder_length')) rofi_mesg += lcut('Username', Config.getint('username_length')) rofi_mesg += lcut('URL', Config.getint('url_length')) From e2e209bfd27e604d2247a68387a4880e1cd2c606 Mon Sep 17 00:00:00 2001 From: Tobias Neitzel Date: Wed, 31 May 2023 10:22:01 +0200 Subject: [PATCH 2/6] Update README.md Add documentation for the icon option. --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e42146e..1c50e67 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,8 @@ trust = 4 * `qubes` - specifies an allow list of qubes for the credential. The credential can only be copied into the specified qubes * `trust` - specifies the minimum trust level that a qube needs to be able to receive this credential * `meta` - specifies a list of qubes that are only allowed to obtain meta information of the credential (username, url) +* `icon` - specifies the icon for the credential. Can be a default icon name (e.g. `firefox`) or a file system path. To display + icons within *rofi*, you also need to add the `-show-icons` *rofi-option* in your `qubes-keepass.ini` file #### Global Options From 024f98e0cbb8e40afc60bf05982542488f9668df Mon Sep 17 00:00:00 2001 From: Tobias Neitzel <49147108+qtc-de@users.noreply.github.com> Date: Wed, 31 May 2023 21:25:44 +0200 Subject: [PATCH 3/6] Update README.md Replace example image --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1c50e67..6eae4e5 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ which integrates nicely with the isolation and security features of [Qubes OS](h to easily copy credentials to the currently focused Qube, to define allow lists for credentials based on Qube names and to automatically clear the Qubes clipboard after a configurable amount of time. -![qubes-keepass](https://user-images.githubusercontent.com/49147108/206440037-cf2108f8-8033-4574-bdbe-88f7943c1457.png) +![qubes-keepass-example](https://github.com/codewhitesec/qubes-keepass/assets/49147108/9512901f-93f7-4bc4-bd20-951a45000171) + *qubes-keepass* is inspired by [rofi-pass](https://github.com/carnager/rofi-pass) which provides a rofi based frontend for the password manager [pass](https://www.passwordstore.org/). From 91d8f00cf01e1f775fe1558a4657558c326ae5d4 Mon Sep 17 00:00:00 2001 From: Tobias Neitzel Date: Wed, 31 May 2023 21:34:00 +0200 Subject: [PATCH 4/6] Add CHANGELOG.md --- CHANGELOG.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..498a361 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + + +## [1.1.0] - May 31, 2023 + +### Added + +* Add support for using [multiple databases](https://github.com/codewhitesec/qubes-keepass/pull/2) at once +* Add [icon support](https://github.com/codewhitesec/qubes-keepass#configuration) + + +## [1.0.0] - Jan 07, 2023 + +**Initial Release** :tada: From 29e63fc919655a7365ecaa6ff741062b890e22ac Mon Sep 17 00:00:00 2001 From: Tobias Neitzel Date: Wed, 31 May 2023 21:35:18 +0200 Subject: [PATCH 5/6] Bump version number --- qubes-keepass.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qubes-keepass.py b/qubes-keepass.py index 61b6563..13bf77c 100755 --- a/qubes-keepass.py +++ b/qubes-keepass.py @@ -838,7 +838,7 @@ def load(service: Secret.Service) -> CredentialCollection: return CredentialCollection(credentials) -parser = argparse.ArgumentParser(description='''qubes-keepass v1.0.0 - A rofi based KeePassXC frontend for Qubes''') +parser = argparse.ArgumentParser(description='''qubes-keepass v1.1.0 - A rofi based KeePassXC frontend for Qubes''') parser.add_argument('qube', help='qube to copy the credential to') parser.add_argument('--trust-level', type=int, help='numerical trust level of the qube') parser.add_argument('--config', help='path to the configuration file') From 2bec46c901a275595977f5ace09e5d4b7afd2d42 Mon Sep 17 00:00:00 2001 From: Tobias Neitzel Date: Wed, 31 May 2023 21:43:14 +0200 Subject: [PATCH 6/6] Change version format in CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 498a361..eaa53d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [1.1.0] - May 31, 2023 +## v1.1.0 - May 31, 2023 ### Added @@ -14,6 +14,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Add [icon support](https://github.com/codewhitesec/qubes-keepass#configuration) -## [1.0.0] - Jan 07, 2023 +## v1.0.0 - Jan 07, 2023 **Initial Release** :tada: