File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7777from lib .core .exception import sqlmapUnsupportedDBMSException
7878from lib .core .exception import sqlmapUserQuitException
7979from lib .core .optiondict import optDict
80+ from lib .core .purge import purge
8081from lib .core .settings import CODECS_LIST_PAGE
8182from lib .core .settings import CRAWL_EXCLUDE_EXTENSIONS
8283from lib .core .settings import DEFAULT_GET_POST_DELIMITER
@@ -1372,6 +1373,17 @@ class _(unicode): pass
13721373 threadData = getCurrentThreadData ()
13731374 threadData .reset ()
13741375
1376+ def __purgeOutput ():
1377+ """
1378+ Safely removes (purges) output directory.
1379+ """
1380+
1381+ if conf .purgeOutput and os .path .isdir (paths .SQLMAP_OUTPUT_PATH ):
1382+ infoMsg = "purging content of output directory ('%s')" % paths .SQLMAP_OUTPUT_PATH
1383+ logger .info (infoMsg )
1384+
1385+ purge (paths .SQLMAP_OUTPUT_PATH )
1386+
13751387def __setConfAttributes ():
13761388 """
13771389 This function set some needed attributes into the configuration
@@ -1945,6 +1957,7 @@ def init(inputOptions=AttribDict(), overrideOptions=False):
19451957 __saveCmdline ()
19461958 __setRequestFromFile ()
19471959 __cleanupOptions ()
1960+ __purgeOutput ()
19481961 __checkDependencies ()
19491962 __basicOptionValidation ()
19501963 __setTorProxySettings ()
Original file line number Diff line number Diff line change @@ -596,6 +596,10 @@ def cmdLineParser():
596596 action = "store_true" ,
597597 help = "Display page rank (PR) for Google dork results" )
598598
599+ miscellaneous .add_option ("--purge-output" , dest = "purgeOutput" ,
600+ action = "store_true" ,
601+ help = "Safely remove all content from output directory" )
602+
599603 miscellaneous .add_option ("--smart" , dest = "smart" ,
600604 action = "store_true" ,
601605 help = "Conduct through tests only if positive heuristic(s)" )
You can’t perform that action at this time.
0 commit comments