File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,6 +104,7 @@ def init(self):
104104class Task (object ):
105105 def __init__ (self , taskid ):
106106 self .process = None
107+ self .temporary_directory = False
107108 self .output_directory = None
108109 self .options = None
109110 self ._original_options = None
@@ -144,12 +145,23 @@ def reset_options(self):
144145 self .options = AttribDict (self ._original_options )
145146
146147 def set_output_directory (self ):
148+ if self .get_option ("oDir" ):
149+ if os .path .isdir (self .get_option ("oDir" )):
150+ self .output_directory = self .get_option ("oDir" )
151+ else :
152+ try :
153+ os .makedirs (self .get_option ("oDir" ))
154+ self .output_directory = self .get_option ("oDir" )
155+ except OSError :
156+ pass
157+
147158 if not self .output_directory or not os .path .isdir (self .output_directory ):
148159 self .output_directory = tempfile .mkdtemp (prefix = "sqlmapoutput-" )
160+ self .temporary_directory = True
149161 self .set_option ("oDir" , self .output_directory )
150162
151163 def clean_filesystem (self ):
152- if self .output_directory :
164+ if self .output_directory and self . temporary_directory :
153165 shutil .rmtree (self .output_directory )
154166
155167 def engine_start (self ):
You can’t perform that action at this time.
0 commit comments