@@ -98,16 +98,18 @@ class Task(object):
9898 def __init__ (self , taskid ):
9999 self .process = None
100100 self .output_directory = None
101+ self .options = None
102+ self ._original_options = None
101103 self .initialize_options (taskid )
102104
103105 def initialize_options (self , taskid ):
104- dataype = {"boolean" : False , "string" : None , "integer" : None , "float" : None }
106+ datatype = {"boolean" : False , "string" : None , "integer" : None , "float" : None }
105107 self .options = AttribDict ()
106108
107109 for _ in optDict :
108110 for name , type_ in optDict [_ ].items ():
109111 type_ = unArrayizeValue (type_ )
110- self .options [name ] = _defaults .get (name , dataype [type_ ])
112+ self .options [name ] = _defaults .get (name , datatype [type_ ])
111113
112114 # Let sqlmap engine knows it is getting called by the API, the task ID and the file path of the IPC database
113115 self .options .api = True
@@ -119,6 +121,8 @@ def initialize_options(self, taskid):
119121 self .options .disableColoring = True
120122 self .options .eta = False
121123
124+ self ._original_options = AttribDict (self .options )
125+
122126 def set_option (self , option , value ):
123127 self .options [option ] = value
124128
@@ -128,6 +132,9 @@ def get_option(self, option):
128132 def get_options (self ):
129133 return self .options
130134
135+ def reset_options (self ):
136+ self .options = AttribDict (self ._original_options )
137+
131138 def set_output_directory (self ):
132139 if not self .output_directory or not os .path .isdir (self .output_directory ):
133140 self .output_directory = tempfile .mkdtemp (prefix = "sqlmapoutput-" )
@@ -419,6 +426,8 @@ def scan_start(taskid):
419426 if taskid not in tasks :
420427 abort (500 , "Invalid task ID" )
421428
429+ tasks [taskid ].reset_options ()
430+
422431 # Initialize sqlmap engine's options with user's provided options, if any
423432 for option , value in request .json .items ():
424433 tasks [taskid ].set_option (option , value )
0 commit comments