From 0e728aa73e9dd83721dbf1e593759aa0d30998b1 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 29 Jun 2017 15:33:34 +0200 Subject: [PATCH] Changing default encoding of sys.argv --- lib/core/settings.py | 2 +- lib/parse/cmdline.py | 6 ++++-- txt/checksum.md5 | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 8bca5463b..d9c9c8fb3 100755 --- 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.1.6.18" +VERSION = "1.1.6.19" 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/parse/cmdline.py b/lib/parse/cmdline.py index e02cac62f..e2a618349 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -48,7 +48,8 @@ def cmdLineParser(argv=None): checkSystemEncoding() - _ = getUnicode(os.path.basename(argv[0]), encoding=sys.getfilesystemencoding() or UNICODE_ENCODING) + # Reference: https://stackoverflow.com/a/4012683 (Note: previously used "...sys.getfilesystemencoding() or UNICODE_ENCODING") + _ = getUnicode(os.path.basename(argv[0]), encoding=sys.stdin.encoding) usage = "%s%s [options]" % ("python " if not IS_WIN else "", \ "\"%s\"" % _ if " " in _ else _) @@ -848,8 +849,9 @@ def cmdLineParser(argv=None): advancedHelp = True extraHeaders = [] + # Reference: https://stackoverflow.com/a/4012683 (Note: previously used "...sys.getfilesystemencoding() or UNICODE_ENCODING") for arg in argv: - _.append(getUnicode(arg, encoding=sys.getfilesystemencoding() or UNICODE_ENCODING)) + _.append(getUnicode(arg, encoding=sys.stdin.encoding)) argv = _ checkDeprecatedOptions(argv) diff --git a/txt/checksum.md5 b/txt/checksum.md5 index 65a533e75..bfe3403b4 100644 --- a/txt/checksum.md5 +++ b/txt/checksum.md5 @@ -46,7 +46,7 @@ f1531be15ed98555a9010e2db3c9da75 lib/core/optiondict.py d8e9250f3775119df07e9070eddccd16 lib/core/replication.py 785f86e3f963fa3798f84286a4e83ff2 lib/core/revision.py 40c80b28b3a5819b737a5a17d4565ae9 lib/core/session.py -f36001e7b58e9d0681d21d6b53d0255e lib/core/settings.py +78ecca8a3b388fa4c067560a161b4069 lib/core/settings.py d91291997d2bd2f6028aaf371bf1d3b6 lib/core/shell.py 2ad85c130cc5f2b3701ea85c2f6bbf20 lib/core/subprocessng.py 037e052b288457a8588a297bd8669ae1 lib/core/target.py @@ -57,7 +57,7 @@ ad74fc58fc7214802fd27067bce18dd2 lib/core/unescaper.py 4d13ed693401a498b6d073a2a494bd83 lib/core/wordlist.py 310efc965c862cfbd7b0da5150a5ad36 lib/__init__.py 8c4b04062db2245d9e190b413985202a lib/parse/banner.py -4185a1ed8fbec400dd297474ac89c357 lib/parse/cmdline.py +89c837c3b2cb2853839e127978bed8a6 lib/parse/cmdline.py 3a31657bc38f277d0016ff6d50bde61f lib/parse/configfile.py 14539f1be714d4f1ed042067d63bc50a lib/parse/handler.py 64e5bb3ecbdd75144500588b437ba8da lib/parse/headers.py