@@ -786,31 +786,17 @@ def _(self, *args):
786786
787787 checkDeprecatedOptions (argv )
788788
789- # Hide non-basic options in basic help case
790- for i in xrange (len (sys .argv )):
791- if sys .argv [i ] == "-hh" :
792- sys .argv [i ] = "-h"
793- elif sys .argv [i ] == "--version" :
794- print VERSION_STRING
795- raise SystemExit
796- elif sys .argv [i ] == "--sqlmap-shell" :
797- prompt = True
798- elif sys .argv [i ] == "-h" :
799- advancedHelp = False
800- for group in parser .option_groups [:]:
801- found = False
802- for option in group .option_list :
803- if option .dest not in BASIC_HELP_ITEMS :
804- option .help = SUPPRESS_HELP
805- else :
806- found = True
807- if not found :
808- parser .option_groups .remove (group )
789+ prompt = "--sqlmap-shell" in argv
809790
810791 if prompt :
811792 cmdLineOptions .sqlmapShell = True
812793
813794 _ = ["x" , "q" , "exit" , "quit" , "clear" ]
795+
796+ for option in parser .option_list :
797+ _ .extend (option ._long_opts )
798+ _ .extend (option ._short_opts )
799+
814800 for group in parser .option_groups :
815801 for option in group .option_list :
816802 _ .extend (option ._long_opts )
@@ -846,10 +832,29 @@ def _(self, *args):
846832 for arg in shlex .split (command ):
847833 argv .append (getUnicode (arg , system = True ))
848834
835+ # Hide non-basic options in basic help case
836+ for i in xrange (len (argv )):
837+ if argv [i ] == "-hh" :
838+ argv [i ] = "-h"
839+ elif argv [i ] == "--version" :
840+ print VERSION_STRING
841+ raise SystemExit
842+ elif argv [i ] == "-h" :
843+ advancedHelp = False
844+ for group in parser .option_groups [:]:
845+ found = False
846+ for option in group .option_list :
847+ if option .dest not in BASIC_HELP_ITEMS :
848+ option .help = SUPPRESS_HELP
849+ else :
850+ found = True
851+ if not found :
852+ parser .option_groups .remove (group )
853+
849854 try :
850855 (args , _ ) = parser .parse_args (argv )
851856 except SystemExit :
852- if "-h" in sys . argv and not advancedHelp :
857+ if "-h" in argv and not advancedHelp :
853858 print "\n [!] to see full list of options run with '-hh'"
854859 raise
855860
0 commit comments