diff --git a/tools/sigma/backends/mdatp.py b/tools/sigma/backends/mdatp.py index e82e4c2c21a..f373c0427b7 100644 --- a/tools/sigma/backends/mdatp.py +++ b/tools/sigma/backends/mdatp.py @@ -32,7 +32,6 @@ def _impl(self, method_args): return return _impl - class WindowsDefenderATPBackend(SingleTextQueryBackend): """Converts Sigma rule into Microsoft Defender ATP Hunting Queries.""" identifier = "mdatp" @@ -188,14 +187,9 @@ def decompose_user(self, src_field, src_value): def generate(self, sigmaparser): self.table = None - try: - self.category = sigmaparser.parsedyaml['logsource'].setdefault('category', None) - self.product = sigmaparser.parsedyaml['logsource'].setdefault('product', None) - self.service = sigmaparser.parsedyaml['logsource'].setdefault('service', None) - except KeyError: - self.category = None - self.product = None - self.service = None + self.category = sigmaparser.parsedyaml['logsource'].get('category') + self.product = sigmaparser.parsedyaml['logsource'].get('product') + self.service = sigmaparser.parsedyaml['logsource'].get('service') if (self.category, self.product, self.service) == ("process_creation", "windows", None): self.table = "DeviceProcessEvents"