# Output backends for sigmac # Copyright 2016-2018 Thomas Patzke, Florian Roth, juju4 # 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 re import sigma from .base import SingleTextQueryBackend # Sumo specifics # https://help.sumologic.com/05Search/Search-Query-Language # want _index or _sourceCategory for performance # try to get most string match on first line for performance # further sorting can be done with extra parsing # No regex match, must use 'parse regex' https://help.sumologic.com/05Search/Search-Query-Language/01-Parse-Operators/02-Parse-Variable-Patterns-Using-Regex # For some strings like Windows ProcessCmdline or LogonProcess, it might be good to force case lower and upper as Windows is inconsistent in logs class SumoLogicBackend(SingleTextQueryBackend): """Converts Sigma rule into SumoLogic query""" identifier = "sumologic" active = True index_field = "_index" reEscape = re.compile('("|(? 5 # Near condition => how near... like timeframe?