From 0c44b02765f6b623af819b7deb2d232ce22996a4 Mon Sep 17 00:00:00 2001 From: Sniffleupagus <129890632+Sniffleupagus@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:06:38 -0800 Subject: [PATCH] Move self._view_on_starting() outside of loading keys exception When _view_on_starting is inside the try:except:, any display errors, especially from misconfigured plugins, will trigger the exception and delete RSA keys unnecessarily. By moving _view_on_starting after the except: clause, only errors during key loading will lead to deleted keys. view errors will silently fail. Signed-off-by: Sniffleupagus <129890632+Sniffleupagus@users.noreply.github.com> --- pwnagotchi/identity.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pwnagotchi/identity.py b/pwnagotchi/identity.py index 0ac5935f..f553b08d 100644 --- a/pwnagotchi/identity.py +++ b/pwnagotchi/identity.py @@ -50,10 +50,6 @@ class KeyPair(object): with open(self.fingerprint_path, 'w+t') as fp: fp.write(self.fingerprint) - # no exception, keys loaded correctly. - self._view.on_starting() - return - except Exception as e: # if we're here, loading the keys broke something ... logging.exception("error loading keys, maybe corrupted, deleting and regenerating ...") @@ -63,6 +59,9 @@ class KeyPair(object): except: pass + # no exception, keys loaded correctly. + self._view.on_starting() + return def sign(self, message): hasher = SHA256.new(message.encode("ascii")) signer = PKCS1_PSS.new(self.priv_key, saltLen=16)