From e365c49c949f846fb0116d0973fe54b07cb91bd7 Mon Sep 17 00:00:00 2001 From: manuelsommer <47991713+manuel-sommer@users.noreply.github.com> Date: Mon, 11 Nov 2024 19:19:55 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20Defender=20broken=20Endpoi?= =?UTF-8?q?nt=20#11217=20(#11212)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :bug: fix MSDefender computerDNSName to match modelregex * :bug: fix DefendercomputerDNSName is mostly a userinfo * ruff * fix according to review * add unittest --- dojo/tools/ms_defender/parser.py | 2 +- unittests/scans/ms_defender/issue_11217.zip | Bin 0 -> 1563 bytes unittests/tools/test_ms_defender_parser.py | 12 ++++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 unittests/scans/ms_defender/issue_11217.zip diff --git a/dojo/tools/ms_defender/parser.py b/dojo/tools/ms_defender/parser.py index ad909168c26..cfa9db5c0cf 100644 --- a/dojo/tools/ms_defender/parser.py +++ b/dojo/tools/ms_defender/parser.py @@ -131,7 +131,7 @@ def process_zip(self, vulnerability, machine): self.findings.append(finding) finding.unsaved_endpoints = [] if machine["computerDnsName"] is not None: - finding.unsaved_endpoints.append(Endpoint(host=str(machine["computerDnsName"]))) + finding.unsaved_endpoints.append(Endpoint(host=str(machine["computerDnsName"]).replace(" ", "").replace("(", "_").replace(")", "_"))) if machine["lastIpAddress"] is not None: finding.unsaved_endpoints.append(Endpoint(host=str(machine["lastIpAddress"]))) if machine["lastExternalIpAddress"] is not None: diff --git a/unittests/scans/ms_defender/issue_11217.zip b/unittests/scans/ms_defender/issue_11217.zip new file mode 100644 index 0000000000000000000000000000000000000000..862542647b1e85cb63f03244b8a683424e187ae0 GIT binary patch literal 1563 zcmWIWW@h1H0D)60XNQ9sP=b>|h9NgGIU_SKwOBtigp+}Jc56@S93U>O;AUWCxu}1n zfTg1C5KjQm2oazr4u;Y>>5=c$r~0}uF)*~TGBAiC8v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