1717
1818from lib .core .common import checkDeprecatedOptions
1919from lib .core .common import checkSystemEncoding
20+ from lib .core .common import dataToStdout
2021from lib .core .common import expandMnemonics
2122from lib .core .common import getUnicode
2223from lib .core .data import cmdLineOptions
@@ -862,13 +863,13 @@ def _(self, *args):
862863 continue
863864 elif command .lower () == "clear" :
864865 clearHistory ()
865- print "[i] history cleared"
866+ dataToStdout ( "[i] history cleared\n " )
866867 saveHistory (AUTOCOMPLETE_TYPE .SQLMAP )
867868 elif command .lower () in ("x" , "q" , "exit" , "quit" ):
868869 raise SqlmapShellQuitException
869870 elif command [0 ] != '-' :
870- print "[!] invalid option(s) provided"
871- print "[i] proper example: '-u http://www.site.com/vuln.php?id=1 --banner'"
871+ dataToStdout ( "[!] invalid option(s) provided\n " )
872+ dataToStdout ( "[i] proper example: '-u http://www.site.com/vuln.php?id=1 --banner'\n " )
872873 else :
873874 saveHistory (AUTOCOMPLETE_TYPE .SQLMAP )
874875 loadHistory (AUTOCOMPLETE_TYPE .SQLMAP )
@@ -885,7 +886,8 @@ def _(self, *args):
885886 if argv [i ] == "-hh" :
886887 argv [i ] = "-h"
887888 elif re .search (r"\A-\w=.+" , argv [i ]):
888- print "[!] potentially miswritten (illegal '=') short option detected ('%s')" % argv [i ]
889+ dataToStdout ("[!] potentially miswritten (illegal '=') short option detected ('%s')\n " % argv [i ])
890+ raise SystemExit
889891 elif argv [i ] == "-H" :
890892 if i + 1 < len (argv ):
891893 extraHeaders .append (argv [i + 1 ])
@@ -910,11 +912,11 @@ def _(self, *args):
910912 try :
911913 (args , _ ) = parser .parse_args (argv )
912914 except UnicodeEncodeError , ex :
913- print "\n [!] %s" % ex .object .encode ("unicode-escape" )
915+ dataToStdout ( "\n [!] %s\n " % ex .object .encode ("unicode-escape" ) )
914916 raise SystemExit
915917 except SystemExit :
916918 if "-h" in argv and not advancedHelp :
917- print "\n [!] to see full list of options run with '-hh'"
919+ dataToStdout ( "\n [!] to see full list of options run with '-hh'\n " )
918920 raise
919921
920922 if extraHeaders :
@@ -946,7 +948,7 @@ def _(self, *args):
946948 except SystemExit :
947949 # Protection against Windows dummy double clicking
948950 if IS_WIN :
949- print "\n Press Enter to continue..." ,
951+ dataToStdout ( "\n Press Enter to continue..." )
950952 raw_input ()
951953 raise
952954
0 commit comments