mirror of https://github.com/OWASP/Nettacker.git
optimized the sort_loops in module.py and also improved readability (#1150)
Co-authored-by: Sam Stepanyan <sam.stepanyan@owasp.org>
This commit is contained in:
parent
e2b4d7c2d8
commit
8c538fa065
|
|
@ -118,26 +118,25 @@ class Module:
|
||||||
self.module_content["payloads"] = expand_module_steps(self.module_content["payloads"])
|
self.module_content["payloads"] = expand_module_steps(self.module_content["payloads"])
|
||||||
|
|
||||||
def sort_loops(self):
|
def sort_loops(self):
|
||||||
steps = []
|
|
||||||
for index in range(len(self.module_content["payloads"])):
|
for index in range(len(self.module_content["payloads"])):
|
||||||
for step in copy.deepcopy(self.module_content["payloads"][index]["steps"]):
|
steps_without_dependencies = []
|
||||||
if "dependent_on_temp_event" not in step[0]["response"]:
|
steps_with_temp_dependencies = []
|
||||||
steps.append(step)
|
steps_with_normal_dependencies = []
|
||||||
|
|
||||||
for step in copy.deepcopy(self.module_content["payloads"][index]["steps"]):
|
for step in copy.deepcopy(self.module_content["payloads"][index]["steps"]):
|
||||||
if (
|
resp = step[0]["response"]
|
||||||
"dependent_on_temp_event" in step[0]["response"]
|
if "dependent_on_temp_event" not in resp:
|
||||||
and "save_to_temp_events_only" in step[0]["response"]
|
steps_without_dependencies.append(step)
|
||||||
):
|
elif "save_to_temp_events_only" in resp:
|
||||||
steps.append(step)
|
steps_with_temp_dependencies.append(step)
|
||||||
|
else:
|
||||||
|
steps_with_normal_dependencies.append(step)
|
||||||
|
|
||||||
for step in copy.deepcopy(self.module_content["payloads"][index]["steps"]):
|
self.module_content["payloads"][index]["steps"] = (
|
||||||
if (
|
steps_without_dependencies
|
||||||
"dependent_on_temp_event" in step[0]["response"]
|
+ steps_with_temp_dependencies
|
||||||
and "save_to_temp_events_only" not in step[0]["response"]
|
+ steps_with_normal_dependencies
|
||||||
):
|
)
|
||||||
steps.append(step)
|
|
||||||
self.module_content["payloads"][index]["steps"] = steps
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
active_threads = []
|
active_threads = []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue