Skip to content

adding new output types #1085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
This is good to go now
  • Loading branch information
pUrGe12 committed Jun 12, 2025
commit ff41f2fac41e7dca77cd1a755e41c6014fbbae98
80 changes: 47 additions & 33 deletions nettacker/core/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import os
from datetime import datetime
import yaml
import uuid

import texttable

Expand Down Expand Up @@ -126,43 +127,56 @@ def create_dd_specific_json(all_scan_logs):

findings = []

modules_used = {log["module_name"].strip() for log in all_scan_logs}
print(modules_used)
date_ = {log["date"].strip() for log in all_scan_logs}
module_path = Config.path.modules_dir
submodules_used = {
f"{str(module_path).strip()}/{i.split('_')[-1].strip()}/{'_'.join(i.split('_')[0:-1])}.yaml"
for i in modules_used
}

for module_name, module_file, date in zip(modules_used, submodules_used, date_):
with open(module_file) as fp:
data = yaml.safe_load(fp)

severity = data["info"]["severity"]
description = data["info"]["description"]

if severity >= 9:
severity = severity_mapping.get(5)
elif severity >= 7:
severity = severity_mapping.get(4)
elif severity >= 4:
severity = severity_mapping.get(3)
elif severity > 0:
severity = severity_mapping.get(2)
for log in all_scan_logs:
module_name = log["module_name"].strip()
date = log["date"].split(" ")[0].strip()
port = log.get("port", "").__str__().strip()
impact = log.get("event", "").strip()
severity_justification = log.get("json_event", "").strip()
service = log.get("target", "").strip()
unique_id = log.get("scan_id", uuid.uuid4().hex)

module_file = f"{str(module_path).strip()}/{module_name.split('_')[-1].strip()}/{'_'.join(module_name.split('_')[0:-1])}.yaml"

try:
with open(module_file) as fp:
data = yaml.safe_load(fp)
severity_raw = data["info"].get("severity", 0)
description = data["info"].get("description", "")
except Exception as e:
severity_raw = 1 # Default to Info
description = "No description available."

if severity_raw >= 9:
severity = severity_mapping[5]
elif severity_raw >= 7:
severity = severity_mapping[4]
elif severity_raw >= 4:
severity = severity_mapping[3]
elif severity_raw > 0:
severity = severity_mapping[2]
else:
severity = severity_mapping.get(1)

findings.append(
{
"title": module_name.strip(),
"severity": severity.strip(),
"description": description.strip(),
"date": date.split(" ")[0].strip()
}
)
severity = severity_mapping[1]

finding = {
"date": date,
"title": module_name,
"description": description.strip(),
"severity": severity,
"param": port,
"impact": impact,
"severity_justification": severity_justification,
"service": service,
"unique_id_from_tool": unique_id,
"static_finding": False,
"dynamic_finding": True
}

findings.append(finding)

return str(json.dumps({"findings": findings}, indent=4))
return json.dumps({"findings": findings}, indent=4)


def create_sarif_report(all_scan_logs):
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy