diff --git a/tools/sigma/backends/elasticsearch.py b/tools/sigma/backends/elasticsearch.py index 279e78b84..d050644b9 100644 --- a/tools/sigma/backends/elasticsearch.py +++ b/tools/sigma/backends/elasticsearch.py @@ -20,7 +20,7 @@ from fnmatch import fnmatch import sys import os from random import randrange -from distutils.util import strtobool +from distutils.util import strtobool import sigma import yaml @@ -67,7 +67,6 @@ class ElasticsearchWildcardHandlingMixin(object): ("case_insensitive_whitelist", None, "Fields to make the values case insensitive regex. Automatically sets the field as a keyword. Valid options are: list of fields, single field. Also, wildcards * and ? allowed.", None), ("case_insensitive_blacklist", None, "Fields to exclude from being made into case insensitive regex. Valid options are: list of fields, single field. Also, wildcards * and ? allowed.", None), ("wildcard_use_keyword", "true", "Use analyzed field or wildcard field if the query uses a wildcard value (ie: '*mall_wear.exe'). Set this to 'False' to use analyzed field or wildcard field. Valid options are: true/false", None), - ("set_size", "0", "value for the size of returned datasets.", None) ) reContainsWildcard = re.compile("(?:(?","Index name used to add the alerts", None), #by default it creates a new index every day ("type", "_doc","Index Type used to add the alerts", None) - + ) watcher_urls = { "watcher": "_watcher", @@ -736,7 +736,7 @@ class XPackWatcherBackend(ElasticsearchQuerystringBackend, MultiRuleOutputMixin) # Get time frame if exists interval = sigmaparser.parsedyaml["detection"].setdefault("timeframe", "30m") dateField = self.sigmaconfig.config.get("dateField", "timestamp") - + # creating condition indices = sigmaparser.get_logsource().index # How many results to be returned. Usually 0 but for index action we need it. @@ -839,7 +839,7 @@ class XPackWatcherBackend(ElasticsearchQuerystringBackend, MultiRuleOutputMixin) eaction={} #email action waction={} #webhook action iaction={} #index action - action={} + action={} alert_methods = self.alert_methods.split(',') if 'email' in alert_methods: # mail notification if mail address is given @@ -879,7 +879,7 @@ class XPackWatcherBackend(ElasticsearchQuerystringBackend, MultiRuleOutputMixin) waction = { "httppost":{ "transform":{ - "script": "ctx.metadata.timestamp=ctx.trigger.scheduled_time;" + "script": "ctx.metadata.timestamp=ctx.trigger.scheduled_time;" }, "webhook":{ "scheme" : http_scheme, @@ -914,12 +914,12 @@ class XPackWatcherBackend(ElasticsearchQuerystringBackend, MultiRuleOutputMixin) size=1000 #I presume it will not be more than 1000 events detected iaction = { "elastic":{ - "transform":{ #adding title, description, tags on the event + "transform":{ #adding title, description, tags on the event "script": "ctx.payload.transform = [];for (int j=0;j