@@ -103,7 +103,6 @@ def init(self):
103103class Task (object ):
104104 def __init__ (self , taskid ):
105105 self .process = None
106- self .temporary_directory = False
107106 self .output_directory = None
108107 self .options = None
109108 self ._original_options = None
@@ -143,26 +142,6 @@ def get_options(self):
143142 def reset_options (self ):
144143 self .options = AttribDict (self ._original_options )
145144
146- def set_output_directory (self ):
147- if self .get_option ("outputDir" ):
148- if os .path .isdir (self .get_option ("outputDir" )):
149- self .output_directory = self .get_option ("outputDir" )
150- else :
151- try :
152- os .makedirs (self .get_option ("outputDir" ))
153- self .output_directory = self .get_option ("outputDir" )
154- except OSError :
155- pass
156-
157- if not self .output_directory or not os .path .isdir (self .output_directory ):
158- self .output_directory = tempfile .mkdtemp (prefix = "sqlmapoutput-" )
159- self .temporary_directory = True
160- self .set_option ("outputDir" , self .output_directory )
161-
162- def clean_filesystem (self ):
163- if self .output_directory and self .temporary_directory :
164- shutil .rmtree (self .output_directory )
165-
166145 def engine_start (self ):
167146 self .process = Popen (["python" , "sqlmap.py" , "--pickled-options" , base64pickle (self .options )],
168147 shell = False , stdin = PIPE , close_fds = False )
@@ -354,7 +333,6 @@ def task_delete(taskid):
354333 Delete own task ID
355334 """
356335 if taskid in DataStore .tasks :
357- DataStore .tasks [taskid ].clean_filesystem ()
358336 DataStore .tasks .pop (taskid )
359337
360338 logger .debug ("[%s] Deleted task" % taskid )
@@ -388,9 +366,6 @@ def task_flush(taskid):
388366 Flush task spool (delete all tasks)
389367 """
390368 if is_admin (taskid ):
391- for task in DataStore .tasks :
392- DataStore .tasks [task ].clean_filesystem ()
393-
394369 DataStore .tasks = dict ()
395370 logger .debug ("[%s] Flushed task pool" % taskid )
396371 return jsonize ({"success" : True })
@@ -466,9 +441,6 @@ def scan_start(taskid):
466441 for option , value in request .json .items ():
467442 DataStore .tasks [taskid ].set_option (option , value )
468443
469- # Overwrite output directory value to a temporary directory
470- DataStore .tasks [taskid ].set_output_directory ()
471-
472444 # Launch sqlmap engine in a separate process
473445 DataStore .tasks [taskid ].engine_start ()
474446
@@ -663,9 +635,9 @@ def client(host=RESTAPI_SERVER_HOST, port=RESTAPI_SERVER_PORT):
663635
664636 # TODO: write a simple client with requests, for now use curl from command line
665637 logger .error ("Not yet implemented, use curl from command line instead for now, for example:" )
666- print "\n \t $ curl http://%s:%d/task/new" % (host , port )
638+ print "\n \t $ taskid=$( curl http://%s:%d/task/new 2>1 | grep -o -I '[a-f0-9]\{16\}') && echo $taskid " % (host , port )
667639 print ("\t $ curl -H \" Content-Type: application/json\" "
668640 "-X POST -d '{\" url\" : \" http://testphp.vulnweb.com/artists.php?artist=1\" }' "
669- "http://%s:%d/scan/: taskid/start" ) % (host , port )
670- print "\t $ curl http://%s:%d/scan/: taskid/data" % (host , port )
671- print "\t $ curl http://%s:%d/scan/: taskid/log\n " % (host , port )
641+ "http://%s:%d/scan/$ taskid/start" ) % (host , port )
642+ print "\t $ curl http://%s:%d/scan/$ taskid/data" % (host , port )
643+ print "\t $ curl http://%s:%d/scan/$ taskid/log\n " % (host , port )
0 commit comments