Minor patch (proper exit code-ing)

This commit is contained in:
Miroslav Stampar 2020-05-13 12:39:37 +02:00
parent 0b93311ef2
commit 01edcbf71d
2 changed files with 7 additions and 3 deletions

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
from thirdparty.six import unichr as _unichr from thirdparty.six import unichr as _unichr
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.4.5.15" VERSION = "1.4.5.16"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} 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) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

View File

@ -238,6 +238,8 @@ def main():
errMsg = getSafeExString(ex) errMsg = getSafeExString(ex)
logger.critical(errMsg) logger.critical(errMsg)
os._exitcode = 1
raise SystemExit raise SystemExit
except KeyboardInterrupt: except KeyboardInterrupt:
@ -249,8 +251,8 @@ def main():
errMsg = "exit" errMsg = "exit"
logger.error(errMsg) logger.error(errMsg)
except SystemExit: except SystemExit as ex:
pass os._exitcode = ex.code or 0
except: except:
print() print()
@ -258,6 +260,8 @@ def main():
excMsg = traceback.format_exc() excMsg = traceback.format_exc()
valid = checkIntegrity() valid = checkIntegrity()
os._exitcode = 255
if any(_ in excMsg for _ in ("MemoryError", "Cannot allocate memory")): if any(_ in excMsg for _ in ("MemoryError", "Cannot allocate memory")):
errMsg = "memory exhaustion detected" errMsg = "memory exhaustion detected"
logger.critical(errMsg) logger.critical(errMsg)