From accfbf958e8839844f2a51c512ca73d81b728ed7 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 27 Jan 2021 14:01:20 +0100 Subject: [PATCH] Fixes #4560 --- lib/core/settings.py | 2 +- lib/core/target.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 4d7913b31..b7589c90b 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.5.1.40" +VERSION = "1.5.1.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/target.py b/lib/core/target.py index 484d8b835..69f1fa9f9 100644 --- a/lib/core/target.py +++ b/lib/core/target.py @@ -659,7 +659,7 @@ def _createTargetDirs(): try: with openFile(os.path.join(conf.outputPath, "target.txt"), "w+") as f: - f.write(kb.originalUrls.get(conf.url) or conf.url or conf.hostname) + f.write(getUnicode(kb.originalUrls.get(conf.url) or conf.url or conf.hostname)) f.write(" (%s)" % (HTTPMETHOD.POST if conf.data else HTTPMETHOD.GET)) f.write(" # %s" % getUnicode(subprocess.list2cmdline(sys.argv), encoding=sys.stdin.encoding)) if conf.data: @@ -672,6 +672,9 @@ def _createTargetDirs(): errMsg += "to write to the output directory '%s' (%s)" % (paths.SQLMAP_OUTPUT_PATH, getSafeExString(ex)) raise SqlmapMissingPrivileges(errMsg) + except UnicodeError as ex: + warnMsg = "something went wrong while saving target data ('%s')" % getSafeExString(ex) + logger.warn(warnMsg) _createDumpDir() _createFilesDir()