From 5cc85fc89e33eca8bfdbc4265ba6169164bad761 Mon Sep 17 00:00:00 2001 From: belamu Date: Tue, 5 Nov 2024 22:31:21 +0100 Subject: [PATCH 1/4] fix wrong variable use (password vs. pw) --- sigexport/crypto.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sigexport/crypto.py b/sigexport/crypto.py index dd25b54..a76fe43 100644 --- a/sigexport/crypto.py +++ b/sigexport/crypto.py @@ -57,12 +57,11 @@ def get_key(file: Path, password: Optional[str]) -> str: elif "safeStorageBackend" in data: if data["safeStorageBackend"] == "gnome_libsecret": pw = get_password(PASSWORD_CMD_GNOME, "gnome") # may raise error - pw = get_password(PASSWORD_CMD_KDE, "KDE") # may raise error - return decrypt(password, encrypyed_key, b"v11", 1) + return decrypt(pw, encryted_key, b"v11", 1) elif data["safeStorageBackend"] in [ "gnome_libsecret", "kwallet", "kwallet5", "kwallet6"]: pw = get_password(PASSWORD_CMD_KDE, "KDE") # may raise error - return decrypt(password, encrypyed_key, b"v11", 1) + return decrypt(pw, encryted_key, b"v11", 1) else: secho("Your Signal data key is encrypted, and requires a password.") secho(f"The safe storage backend is {data['safeStorageBackend']}") From 8df318fcf43dab6a6186d06d02db9257734f9213 Mon Sep 17 00:00:00 2001 From: belamu Date: Tue, 5 Nov 2024 22:31:41 +0100 Subject: [PATCH 2/4] fix typo (encrypted_key vs encryted_key) --- sigexport/crypto.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sigexport/crypto.py b/sigexport/crypto.py index a76fe43..2a38d74 100644 --- a/sigexport/crypto.py +++ b/sigexport/crypto.py @@ -39,7 +39,7 @@ def get_key(file: Path, password: Optional[str]) -> str: if "key" in data: return data["key"] elif "encryptedKey" in data: - encrypyed_key = data["encryptedKey"] + encrypted_key = data["encryptedKey"] if sys.platform == "win32": secho( "Signal decryption isn't currently supported on Windows" @@ -48,20 +48,20 @@ def get_key(file: Path, password: Optional[str]) -> str: ) if sys.platform == "darwin": if password: - return decrypt(password, encrypyed_key, b"v10", 1003) + return decrypt(password, encrypted_key, b"v10", 1003) pw = get_password(PASSWORD_CMD_DARWIN, "macOS") # may raise error - return decrypt(pw, encrypyed_key, b"v10", 1003) + return decrypt(pw, encrypted_key, b"v10", 1003) else: # linux if password: - return decrypt(password, encrypyed_key, b"v11", 1) + return decrypt(password, encrypted_key, b"v11", 1) elif "safeStorageBackend" in data: if data["safeStorageBackend"] == "gnome_libsecret": pw = get_password(PASSWORD_CMD_GNOME, "gnome") # may raise error - return decrypt(pw, encryted_key, b"v11", 1) + return decrypt(pw, encrypted_key, b"v11", 1) elif data["safeStorageBackend"] in [ "gnome_libsecret", "kwallet", "kwallet5", "kwallet6"]: pw = get_password(PASSWORD_CMD_KDE, "KDE") # may raise error - return decrypt(pw, encryted_key, b"v11", 1) + return decrypt(pw, encrypted_key, b"v11", 1) else: secho("Your Signal data key is encrypted, and requires a password.") secho(f"The safe storage backend is {data['safeStorageBackend']}") From a6781adf970e4b831b35ad6d07e684b92acc57c8 Mon Sep 17 00:00:00 2001 From: belamu Date: Tue, 5 Nov 2024 22:21:23 +0100 Subject: [PATCH 3/4] fix typo --- sigexport/crypto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sigexport/crypto.py b/sigexport/crypto.py index 2a38d74..60900ef 100644 --- a/sigexport/crypto.py +++ b/sigexport/crypto.py @@ -15,7 +15,7 @@ PASSWORD_CMD_DARWIN = ["security", "find-generic-password", "-ws", "Signal Safe Storage"] PASSWORD_CMD_GNOME = ["secret-tool", "lookup", "application", "Signal"] -PASSWARD_CMD_KDE = ["kwallet-query", "kdewallet", "-f", +PASSWORD_CMD_KDE = ["kwallet-query", "kdewallet", "-f", "Chromium Keys", "-r", "Chromium Safe Storage"] From 35d805f3fd12d9f71b21cb18c62ead783b564936 Mon Sep 17 00:00:00 2001 From: belamu Date: Wed, 6 Nov 2024 16:21:42 +0100 Subject: [PATCH 4/4] correct docstring --- sigexport/crypto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sigexport/crypto.py b/sigexport/crypto.py index 60900ef..b10c97c 100644 --- a/sigexport/crypto.py +++ b/sigexport/crypto.py @@ -89,7 +89,7 @@ def get_password(cmd: list[str], system: str) -> Optional[str]: cmd: shell command as list of words system: Name of the system we are on, for help message. Returns: - password if found, None otherwise + password if found Raises: nondescript error: if no password was found """