From 30f92af512eba722f30299227f8820ae78c95946 Mon Sep 17 00:00:00 2001 From: Gioacchino Vino <gioacchino.vino@infn.it> Date: Wed, 29 May 2024 18:35:02 +0200 Subject: [PATCH 1/2] Implement advanced vulnerability classification --- files/gvm_library.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/gvm_library.py b/files/gvm_library.py index cd088fa..caddaf5 100644 --- a/files/gvm_library.py +++ b/files/gvm_library.py @@ -768,8 +768,8 @@ class ReportManager(): # Overwrite the detected oids to the host oids self.os_oids[self.os_name] = [] for _ , data in self.oids.items(): - self.os_oids[self.os_name] += data[self.LABEL_ACKNOWLEDGED_VULNS] - self.os_oids[self.os_name] += data[self.LABEL_NEW_VULNS] + self.os_oids[self.os_name] += [ str(a) for a in data[self.LABEL_ACKNOWLEDGED_VULNS]] + self.os_oids[self.os_name] += [ str(a) for a in data[self.LABEL_NEW_VULNS]] with open(self.os_file, 'w') as f: yaml.dump(self.os_oids, f) -- GitLab From 8994d67f1feb38d91a8936be38ae7e3de14906b8 Mon Sep 17 00:00:00 2001 From: Gioacchino Vino <gioacchino.vino@infn.it> Date: Wed, 29 May 2024 18:38:27 +0200 Subject: [PATCH 2/2] Implement advanced vulnerability classification --- files/gvm_library.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/files/gvm_library.py b/files/gvm_library.py index caddaf5..514e861 100644 --- a/files/gvm_library.py +++ b/files/gvm_library.py @@ -471,7 +471,10 @@ class Task: sev: tuple[str] = tuple(res.xpath('report/report/results/result/nvt/severities/@score')) threat: tuple[str] = tuple(res.xpath('report/report/results/result/threat/text()')) ports: tuple[str] = tuple(res.xpath('report/report/results/result/port/text()')) + oids: tuple[float] = tuple(map(str,oids)) sev: tuple[float] = tuple(map(float,sev)) + threat: tuple[float] = tuple(map(str,threat)) + ports: tuple[float] = tuple(map(str,ports)) return {"oids":oids, "severity":sev, "threat":threat, "ports":ports} class GVMClient(): @@ -768,8 +771,8 @@ class ReportManager(): # Overwrite the detected oids to the host oids self.os_oids[self.os_name] = [] for _ , data in self.oids.items(): - self.os_oids[self.os_name] += [ str(a) for a in data[self.LABEL_ACKNOWLEDGED_VULNS]] - self.os_oids[self.os_name] += [ str(a) for a in data[self.LABEL_NEW_VULNS]] + self.os_oids[self.os_name] += data[self.LABEL_ACKNOWLEDGED_VULNS] + self.os_oids[self.os_name] += data[self.LABEL_NEW_VULNS] with open(self.os_file, 'w') as f: yaml.dump(self.os_oids, f) -- GitLab