Skip to content
Open
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions nettacker/core/lib/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ def process_conditions(
):
# Remove sensitive keys from headers before submitting to DB
event = remove_sensitive_header_keys(event)
if "stop_at_first_success" in event["response"]:
event_name = event["response"]["stop_at_first_success"]
existing = find_temp_events(target, module_name, scan_id, event_name)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
if existing:
return False
if "save_to_temp_events_only" in event.get("response", ""):
submit_temp_logs_to_db(
{
Expand All @@ -135,6 +140,19 @@ def process_conditions(
"data": response,
}
)
if "stop_at_first_success" in event.get("response", ""):
submit_temp_logs_to_db(
{
"date": datetime.now(),
"target": target,
"module_name": module_name,
"scan_id": scan_id,
"event_name": event["response"]["stop_at_first_success"],
"port": event.get("ports", ""),
"event": event,
"data": response,
}
)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
if event["response"]["conditions_results"] and "save_to_temp_events_only" not in event.get(
"response", ""
):
Expand Down Expand Up @@ -273,6 +291,12 @@ def run(
del sub_step["method"]
del sub_step["response"]

if "stop_at_first_success" in backup_response:
event_name = backup_response["stop_at_first_success"]
existing = find_temp_events(target, module_name, scan_id, event_name)
if existing:
return False

Comment thread
coderabbitai[bot] marked this conversation as resolved.
for attr_name in ("ports", "usernames", "passwords"):
if attr_name in sub_step:
value = sub_step.pop(attr_name)
Expand Down
Loading