@@ -751,7 +751,7 @@ def cmdLineParser(argv=None):
751751 miscellaneous .add_argument ("--results-file" , dest = "resultsFile" ,
752752 help = "Location of CSV results file in multiple targets mode" )
753753
754- miscellaneous .add_argument ("--sqlmap- shell" , dest = "sqlmapShell " , action = "store_true" ,
754+ miscellaneous .add_argument ("--shell" , dest = "shell " , action = "store_true" ,
755755 help = "Prompt for an interactive sqlmap shell" )
756756
757757 miscellaneous .add_argument ("--tmp-dir" , dest = "tmpDir" ,
@@ -894,7 +894,7 @@ def _format_action_invocation(self, action):
894894
895895 raise SqlmapSilentQuitException
896896
897- elif "--sqlmap- shell" in argv :
897+ elif "--shell" in argv :
898898 _createHomeDirectories ()
899899
900900 parser .usage = ""
@@ -907,14 +907,17 @@ def _format_action_invocation(self, action):
907907
908908 while True :
909909 command = None
910+ prompt = "sqlmap > "
910911
911912 try :
912913 # Note: in Python2 command should not be converted to Unicode before passing to shlex (Reference: https://bugs.python.org/issue1170)
913- command = _input ("sqlmap-shell> " ).strip ()
914+ command = _input (prompt ).strip ()
914915 except (KeyboardInterrupt , EOFError ):
915916 print ()
916917 raise SqlmapShellQuitException
917918
919+ command = re .sub (r"(?i)\Anew\s+" , "" , command or "" )
920+
918921 if not command :
919922 continue
920923 elif command .lower () == "clear" :
@@ -924,8 +927,9 @@ def _format_action_invocation(self, action):
924927 elif command .lower () in ("x" , "q" , "exit" , "quit" ):
925928 raise SqlmapShellQuitException
926929 elif command [0 ] != '-' :
927- dataToStdout ("[!] invalid option(s) provided\n " )
928- dataToStdout ("[i] proper example: '-u http://www.site.com/vuln.php?id=1 --banner'\n " )
930+ if not re .search (r"(?i)\A(\?|help)\Z" , command ):
931+ dataToStdout ("[!] invalid option(s) provided\n " )
932+ dataToStdout ("[i] valid example: '-u http://www.site.com/vuln.php?id=1 --banner'\n " )
929933 else :
930934 saveHistory (AUTOCOMPLETE_TYPE .SQLMAP )
931935 loadHistory (AUTOCOMPLETE_TYPE .SQLMAP )
@@ -1057,7 +1061,7 @@ def _format_action_invocation(self, action):
10571061 args .stdinPipe = None
10581062
10591063 if not any ((args .direct , args .url , args .logFile , args .bulkFile , args .googleDork , args .configFile , args .requestFile , args .updateAll , args .smokeTest , args .vulnTest , args .bedTest , args .fuzzTest , args .wizard , args .dependencies , args .purge , args .listTampers , args .hashFile , args .stdinPipe )):
1060- errMsg = "missing a mandatory option (-d, -u, -l, -m, -r, -g, -c, --list-tampers , --wizard , --update, --purge or --dependencies). "
1064+ errMsg = "missing a mandatory option (-d, -u, -l, -m, -r, -g, -c, --wizard , --shell , --update, --purge, --list-tampers or --dependencies). "
10611065 errMsg += "Use -h for basic and -hh for advanced help\n "
10621066 parser .error (errMsg )
10631067
0 commit comments