@@ -916,9 +916,15 @@ def _format_action_invocation(self, action):
916916 except ValueError as ex :
917917 raise SqlmapSyntaxException ("something went wrong during command line parsing ('%s')" % getSafeExString (ex ))
918918
919+ longOptions = set (re .findall (r"\-\-([^= ]+?)=" , parser .format_help ()))
920+ longSwitches = set (re .findall (r"\-\-([^= ]+?)\s" , parser .format_help ()))
921+
919922 for i in xrange (len (argv )):
920- longOptions = set (re .findall (r"\-\-([^= ]+?)=" , parser .format_help ()))
921- longSwitches = set (re .findall (r"\-\-([^= ]+?)\s" , parser .format_help ()))
923+ argv [i ] = re .sub (u"\A\u2212 +" , lambda match : '-' * len (match .group (0 )), argv [i ])
924+
925+ # Reference: https://unicode-table.com/en/sets/quotation-marks/
926+ 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 " )
927+
922928 if argv [i ] == "-hh" :
923929 argv [i ] = "-h"
924930 elif i == 1 and re .search (r"\A(http|www\.|\w[\w.-]+\.\w{2,})" , argv [i ]) is not None :
@@ -929,9 +935,6 @@ def _format_action_invocation(self, action):
929935 elif len (argv [i ]) > 1 and u"\uff0c " in argv [i ].split ('=' , 1 )[- 1 ]:
930936 dataToStdout ("[!] copy-pasting illegal (non-console) comma characters from Internet is illegal (%s)\n " % argv [i ])
931937 raise SystemExit
932- elif len (argv [i ]) > 1 and ord (argv [i ][0 ]) == 0x2212 :
933- dataToStdout ("[!] copy-pasting illegal (non-console) minus characters from Internet is illegal (%s)\n " % argv [i ])
934- raise SystemExit
935938 elif re .search (r"\A-\w=.+" , argv [i ]):
936939 dataToStdout ("[!] potentially miswritten (illegal '=') short option detected ('%s')\n " % argv [i ])
937940 raise SystemExit
0 commit comments