1-
21import json
3-
42from dojo .models import Finding
53
64
@@ -15,7 +13,7 @@ def get_description_for_scan_types(self, scan_type):
1513 return "JSON output from the n0s1 scanner."
1614
1715 def get_findings (self , filename , test ):
18- findings = []
16+ dupes = {}
1917 tree = filename .read ()
2018 try :
2119 data = json .loads (str (tree , "utf-8" ))
@@ -41,7 +39,7 @@ def get_findings(self, filename, test):
4139 "description" : regex_ref .get ("description" , regex_info .get ("description" , "N/A" )),
4240 "regex" : regex_ref .get ("regex" , regex_info .get ("regex" , "N/A" )),
4341 "keywords" : regex_info .get ("keywords" , []),
44- "tags" : regex_info .get ("tags" , []),
42+ "tags" : regex_info .get ("tags" , [])
4543 }
4644
4745 title = merged_regex ["id" ] or "n0s1 Finding"
@@ -56,16 +54,17 @@ def get_findings(self, filename, test):
5654 description += f"**Keywords:** { ', ' .join (merged_regex ['keywords' ])} \n "
5755 if merged_regex ["tags" ]:
5856 description += f"**Tags:** { ', ' .join (merged_regex ['tags' ])} \n "
59-
60- find = Finding (
57+ dupe_key = finding_data .get ("id" , finding_id )
58+ if dupe_key in dupes :
59+ continue
60+ finding = Finding (
6161 title = title ,
6262 test = test ,
6363 description = description ,
64- severity = "High" , # You can adjust this based on your logic
64+ severity = "High" , # Adjust if needed
6565 dynamic_finding = True ,
6666 static_finding = False ,
67- unique_id_from_tool = finding_data . get ( "id" , finding_id ) ,
67+ unique_id_from_tool = dupe_key ,
6868 )
69- findings .append (find )
70-
71- return findings
69+ dupes [dupe_key ] = finding
70+ return list (dupes .values ())
0 commit comments