From 7b49c469063fb8136ec1928931d68c46873afd08 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 14 May 2020 17:48:07 +0200 Subject: [PATCH] Commit as a thank you for the donation --- lib/core/settings.py | 2 +- lib/parse/cmdline.py | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 06c3054cb..f79654175 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.21" +VERSION = "1.4.5.22" 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 143484aec..e3229f74f 100644 --- a/lib/parse/cmdline.py +++ b/lib/parse/cmdline.py @@ -916,9 +916,15 @@ def cmdLineParser(argv=None): except ValueError as ex: raise SqlmapSyntaxException("something went wrong during command line parsing ('%s')" % getSafeExString(ex)) + longOptions = set(re.findall(r"\-\-([^= ]+?)=", parser.format_help())) + longSwitches = set(re.findall(r"\-\-([^= ]+?)\s", parser.format_help())) + for i in xrange(len(argv)): - longOptions = set(re.findall(r"\-\-([^= ]+?)=", parser.format_help())) - longSwitches = set(re.findall(r"\-\-([^= ]+?)\s", parser.format_help())) + argv[i] = re.sub(u"\A\u2212+", lambda match: '-' * len(match.group(0)), argv[i]) + + # Reference: https://unicode-table.com/en/sets/quotation-marks/ + argv[i] = argv[i].strip(u"\u00AB\u2039\u00BB\u203A\u201E\u201C\u201F\u201D\u2019\u0022\u275D\u275E\u276E\u276F\u2E42\u301D\u301E\u301F\uFF02\u201A\u2018\u201B\u275B\u275C") + if argv[i] == "-hh": argv[i] = "-h" elif i == 1 and re.search(r"\A(http|www\.|\w[\w.-]+\.\w{2,})", argv[i]) is not None: @@ -929,9 +935,6 @@ def cmdLineParser(argv=None): elif len(argv[i]) > 1 and u"\uff0c" in argv[i].split('=', 1)[-1]: dataToStdout("[!] copy-pasting illegal (non-console) comma characters from Internet is illegal (%s)\n" % argv[i]) raise SystemExit - elif len(argv[i]) > 1 and ord(argv[i][0]) == 0x2212: - dataToStdout("[!] copy-pasting illegal (non-console) minus characters from Internet is illegal (%s)\n" % argv[i]) - raise SystemExit elif re.search(r"\A-\w=.+", argv[i]): dataToStdout("[!] potentially miswritten (illegal '=') short option detected ('%s')\n" % argv[i]) raise SystemExit