From 64dd69c2287a28b426fbdf276d303de916baafc1 Mon Sep 17 00:00:00 2001 From: n1nj4sec Date: Mon, 18 Sep 2017 23:55:35 +0200 Subject: [PATCH] better error messages when errors on credentials.py --- pupy/pupylib/PupyCredentials.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pupy/pupylib/PupyCredentials.py b/pupy/pupylib/PupyCredentials.py index decffc70..fe13a1c8 100644 --- a/pupy/pupylib/PupyCredentials.py +++ b/pupy/pupylib/PupyCredentials.py @@ -170,6 +170,8 @@ class Encryptor(object): ENCRYPTOR = Encryptor.instance +HELP_RESET_MSG='FYI you can reset your credentials by removing crypto/credentials.py but you will have to re-generate your payloads.' + class Credentials(object): SYSTEM_CONFIG = path.join(path.dirname(__file__), '..', 'crypto', 'credentials.py') @@ -193,7 +195,7 @@ class Credentials(object): with open(configfile, 'rb') as creds: content = creds.read() if not content: - raise ValueError('Corrupted file: {}'.format(configfile)) + raise ValueError('Corrupted file: {}\n{}'.format(configfile, HELP_RESET_MSG)) if content.startswith('Salted__'): if not ENCRYPTOR: @@ -207,7 +209,7 @@ class Credentials(object): encryptor.decrypt(StringIO(content), fcontent) except: raise EncryptionError( - 'Invalid password or corrupted data' + 'Invalid password or corrupted data.\n{}'.format(HELP_RESET_MSG) ) content = fcontent.getvalue()