# Splunk Datamodel backend for sigmac by mf1d3l (twitter: @mfidel19), # greatly inspired from the original Splunk Backend by Thomas Patzke, Florian Roth and Roey # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . import yaml import re import sigma from .base import SingleTextQueryBackend from .mixins import MultiRuleOutputMixin from .cim import default_datamodels class SplunkDMBackend(SingleTextQueryBackend): """ (Experimental) Converts Sigma rule into a Splunk syntax leveraging Datamodel acceleration when possible (rolls back to standard SPL query if necessary)""" identifier = "splunkdm" active = True index_field = "index" # \ -> \\ # \* -> \* # \\* -> \\* reEscape = re.compile('("|(?