From f80e3f22ce7b41ddb041cd36cae416a7276d543c Mon Sep 17 00:00:00 2001 From: Joe Testa Date: Tue, 7 Jul 2020 16:31:44 -0400 Subject: [PATCH] Now returns -1 when an uncaught exception is found. --- ssh-audit.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ssh-audit.py b/ssh-audit.py index fbd484b..0154d78 100755 --- a/ssh-audit.py +++ b/ssh-audit.py @@ -51,6 +51,7 @@ PROGRAM_RETVAL_FAILURE = 3 PROGRAM_RETVAL_WARNING = 2 PROGRAM_RETVAL_CONNECTION_ERROR = 1 PROGRAM_RETVAL_GOOD = 0 +PROGRAM_RETVAL_UNKNOWN_ERROR = -1 try: # pragma: nocover from colorama import init as colorama_init @@ -3516,5 +3517,12 @@ def main() -> int: if __name__ == '__main__': # pragma: nocover - exit_code = main() + exit_code = PROGRAM_RETVAL_GOOD + + try: + exit_code = main() + except Exception: + exit_code = PROGRAM_RETVAL_UNKNOWN_ERROR + print(traceback.format_exc()) + sys.exit(exit_code)