From 01edcbf71d92ec141c3327ee257dd8412e7e9cde Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 13 May 2020 12:39:37 +0200 Subject: [PATCH] Minor patch (proper exit code-ing) --- lib/core/settings.py | 2 +- sqlmap.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 2c84cf7c8..b0e53c77a 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -18,7 +18,7 @@ from lib.core.enums import OS from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.4.5.15" +VERSION = "1.4.5.16" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) diff --git a/sqlmap.py b/sqlmap.py index 57ef3ebef..bab9ff774 100755 --- a/sqlmap.py +++ b/sqlmap.py @@ -238,6 +238,8 @@ def main(): errMsg = getSafeExString(ex) logger.critical(errMsg) + os._exitcode = 1 + raise SystemExit except KeyboardInterrupt: @@ -249,8 +251,8 @@ def main(): errMsg = "exit" logger.error(errMsg) - except SystemExit: - pass + except SystemExit as ex: + os._exitcode = ex.code or 0 except: print() @@ -258,6 +260,8 @@ def main(): excMsg = traceback.format_exc() valid = checkIntegrity() + os._exitcode = 255 + if any(_ in excMsg for _ in ("MemoryError", "Cannot allocate memory")): errMsg = "memory exhaustion detected" logger.critical(errMsg)