Skip to content

Commit ec55638

Browse files
committed
fixed lint and bugs
1 parent 0696385 commit ec55638

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

dojo/tools/factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def requires_tool_type(scan_type):
122122
# Allow parser class names with optional v[number] suffix (e.g., OpenVASParser, OpenVASParserV2)
123123
expected_base = module_name.replace("_", "") + "parser"
124124
if isclass(attribute) and (
125-
attribute_name.lower() == expected_base or
125+
attribute_name.lower() == expected_base or
126126
re.match(rf"^{re.escape(expected_base)}v\d+$", attribute_name.lower())
127127
):
128128
register(attribute)

dojo/tools/openvas/parser_v1/csv_parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(self):
7979
super().__init__()
8080

8181
def map_column_value(self, finding, column_value):
82-
if column_value != "":
82+
if column_value:
8383
if "," in column_value:
8484
finding.description += "\n**All CVEs:** " + str(column_value)
8585
for value in column_value.split(","):
@@ -234,6 +234,7 @@ def __init__(self):
234234
def map_column_value(self, finding, column_value):
235235
finding.duplicate = self.evaluate_bool_value(column_value)
236236

237+
237238
class OpenVASCSVParser:
238239
def create_chain(self):
239240
date_column_strategy = DateColumnMappingStrategy()

dojo/tools/openvas/parser_v2/common.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,17 @@ def deduplicate(dupes: dict[str, Finding], finding: Finding):
6565
org.unsaved_endpoints += finding.unsaved_endpoints
6666

6767

68-
def id_from_tool_finding_hash(finding: Finding):
69-
"""Generate a hash that complements final hash generating outside of this parser"""
68+
def dedup_finding_hash(finding: Finding):
69+
"""Generate a hash for a finding that is used for deduplication of findings inside the current report"""
7070
endpoint = finding.unsaved_endpoints[0]
71-
72-
if "endpoints" in HASHCODE_FIELDS_PER_SCANNER["OpenVAS Parser v2"]:
73-
pass
74-
7571
hash_data = [
7672
str(endpoint.protocol),
77-
str(endpoint.port), # keep findings on different port seperate as it may be different applications
78-
finding.severity, # allows changing severity of finding after import
73+
str(endpoint.userinfo),
74+
str(endpoint.port),
75+
str(endpoint.path),
76+
str(endpoint.fragment),
77+
finding.title,
78+
finding.vuln_id_from_tool,
79+
finding.severity,
7980
]
8081
return hashlib.sha256("|".join(hash_data).encode("utf-8")).hexdigest()

0 commit comments

Comments
 (0)