Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 854a551

Browse files
committed
Fix for an Issue #588
1 parent 9b4b070 commit 854a551

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

lib/utils/api.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ def init(self):
104104
class 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):

0 commit comments

Comments
 (0)