Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion classes/DetectionRuleConverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,24 @@ def addToSummaryIndex(search, sigma2splunkalertconfig, sigma_rule):
@staticmethod
def performSearchTransformation(transformations, search, sigma_rule):
for trans in transformations:

# Search Transformation to combine collections with "OR"
if trans == "or_collections":
collectionsearch = ""
splitted = search.split("\n")
#search will only get changed if its collection (multiline)
if (len(splitted) > 2):
if (len(splitted[-1]) == 0): del splitted[-1] # delete last entry (empty line)
last = splitted[-1]
for line in splitted:
verticalindex = line.find("|")
if (verticalindex != -1):
collectionsearch = collectionsearch + line[:verticalindex]
else:
collectionsearch = collectionsearch + line
#dont "OR" the last line
if (line!=last):collectionsearch = collectionsearch + " OR "
search = collectionsearch + "\n" #readd the deleted new line at the end

# Search Transformation to add whitelist in front of table or transforming command (for better whitelisting)
if trans == "add_whitelist_in_front":
file_name = sigma_rule["title"] + "_whitelist.csv"
Expand Down