From a4fdbf1343ca2805c91a2669f4f0fad4236f9433 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 30 Oct 2018 11:13:09 +0100 Subject: [PATCH] Patch related to the #3348 --- lib/core/settings.py | 2 +- lib/core/shell.py | 45 +++++++++++++++++++++++--------------------- txt/checksum.md5 | 4 ++-- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 049c275a8..20013c7f4 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import DBMS_DIRECTORY_NAME from lib.core.enums import OS # sqlmap version (...) -VERSION = "1.2.10.40" +VERSION = "1.2.10.41" 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/lib/core/shell.py b/lib/core/shell.py index 7eeef4ee5..d9fb4f590 100644 --- a/lib/core/shell.py +++ b/lib/core/shell.py @@ -53,30 +53,33 @@ def clearHistory(): readline.clear_history() def saveHistory(completion=None): - if not readlineAvailable(): - return - - if completion == AUTOCOMPLETE_TYPE.SQL: - historyPath = paths.SQL_SHELL_HISTORY - elif completion == AUTOCOMPLETE_TYPE.OS: - historyPath = paths.OS_SHELL_HISTORY - elif completion == AUTOCOMPLETE_TYPE.API: - historyPath = paths.API_SHELL_HISTORY - else: - historyPath = paths.SQLMAP_SHELL_HISTORY - try: - with open(historyPath, "w+"): + if not readlineAvailable(): + return + + if completion == AUTOCOMPLETE_TYPE.SQL: + historyPath = paths.SQL_SHELL_HISTORY + elif completion == AUTOCOMPLETE_TYPE.OS: + historyPath = paths.OS_SHELL_HISTORY + elif completion == AUTOCOMPLETE_TYPE.API: + historyPath = paths.API_SHELL_HISTORY + else: + historyPath = paths.SQLMAP_SHELL_HISTORY + + try: + with open(historyPath, "w+"): + pass + except: pass - except: - pass - readline.set_history_length(MAX_HISTORY_LENGTH) - try: - readline.write_history_file(historyPath) - except IOError, msg: - warnMsg = "there was a problem writing the history file '%s' (%s)" % (historyPath, msg) - logger.warn(warnMsg) + readline.set_history_length(MAX_HISTORY_LENGTH) + try: + readline.write_history_file(historyPath) + except IOError, msg: + warnMsg = "there was a problem writing the history file '%s' (%s)" % (historyPath, msg) + logger.warn(warnMsg) + except KeyboardInterrupt: + pass def loadHistory(completion=None): if not readlineAvailable(): diff --git a/txt/checksum.md5 b/txt/checksum.md5 index bb2d1fb64..3a2d3b80e 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -49,8 +49,8 @@ c8c386d644d57c659d74542f5f57f632 lib/core/patch.py 0c3eef46bdbf87e29a3f95f90240d192 lib/core/replication.py a7db43859b61569b601b97f187dd31c5 lib/core/revision.py fcb74fcc9577523524659ec49e2e964b lib/core/session.py -c0109f21b79e9867dede075afad9167f lib/core/settings.py -dd68a9d02fccb4fa1428b20e15b0db5d lib/core/shell.py +ffe74b003e5ac912c6be33956d9245db lib/core/settings.py +a971ce157d04de96ba6e710d3d38a9a8 lib/core/shell.py a7edc9250d13af36ac0108f259859c19 lib/core/subprocessng.py 721198b5be72c8015a02acb116532a1f lib/core/target.py 72d499ca8d792e90a1ebfb2ad2341a51 lib/core/testing.py