Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix qradar logsource parsing#197

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
alexvolha merged 3 commits intomainfromgis-8762
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes fromall 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,7 @@ log_source:

default_log_source:
devicetype: 11
category:[4012]
category: 4012

field_mapping:
CommandLine: Command
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -8,7 +8,7 @@ log_source:

default_log_source:
devicetype: 102
category:[4012]
category: 4012

field_mapping:
CommandLine: Command
Expand Down
Original file line numberDiff line numberDiff line change
Expand Up@@ -9,7 +9,7 @@ log_source:

default_log_source:
devicetype: 12
category:[4012]
category: 4012
qideventcategory: Microsoft-Windows-Sysmon/Operational

field_mapping:
Expand Down
9 changes: 7 additions & 2 deletionsuncoder-core/app/translator/platforms/base/aql/mapping.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -39,7 +39,12 @@ def __str__(self) -> str:
@property
def extra_condition(self) -> str:
default_source = self._default_source
return " AND ".join((f"{key}={value}" for key, value in default_source.items() if key != "table" and value))
extra = []
for key, value in default_source.items():
if key != "table" and value:
_condition = f"{key}={value}" if isinstance(value, int) else f"{key}='{value}'"
extra.append(_condition)
return " AND ".join(extra)


class AQLMappings(BasePlatformMappings):
Expand All@@ -48,7 +53,7 @@ class AQLMappings(BasePlatformMappings):

def prepare_log_source_signature(self, mapping: dict) -> AQLLogSourceSignature:
log_source = mapping.get("log_source", {})
default_log_source = mapping.get("default_log_source")
default_log_source = mapping["default_log_source"]
return AQLLogSourceSignature(
device_types=log_source.get("devicetype"),
categories=log_source.get("category"),
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -37,13 +37,13 @@ class AQLQueryParser(PlatformQueryParser):
log_source_functions = ("LOGSOURCENAME", "LOGSOURCEGROUPNAME")
log_source_function_pattern = r"\(?(?P<key>___func_name___\([a-zA-Z]+\))(?:\s+like\s+|\s+ilike\s+|\s*=\s*)'(?P<value>[%a-zA-Z\s]+)'\s*\)?\s+(?:and|or)?\s" # noqa: E501

log_source_key_types = ("devicetype", "category", "qid", "qideventcategory", *LOG_SOURCE_FUNCTIONS_MAP.keys())
log_source_key_types = ("devicetype", "qideventcategory", "category", "qid", *LOG_SOURCE_FUNCTIONS_MAP.keys())
log_source_pattern = rf"___source_type___(?:\s+like\s+|\s+ilike\s+|\s*=\s*)(?:{SINGLE_QUOTES_VALUE_PATTERN}|{NUM_VALUE_PATTERN})(?:\s+(?:and|or)\s+|\s+)?" # noqa: E501
num_value_pattern = r"[0-9]+"
multi_num_log_source_pattern = (
rf"___source_type___\s+in\s+\((?P<value>(?:{num_value_pattern}(?:\s*,\s*)?)+)\)(?:\s+(?:and|or)\s+|\s+)?"
)
str_value_pattern = r"""(?:')(?P<s_q_value>(?:[:a-zA-Z\*0-9=+%#\-\/\\,_".$&^@!\(\)\{\}\s]|'')+)(?:')"""
str_value_pattern = r"""'(?P<s_q_value>(?:[:a-zA-Z\*0-9=+%#\-\/\\,_".$&^@!\(\)\{\}\s]|'')+)'"""
multi_str_log_source_pattern = (
rf"""___source_type___\s+in\s+\((?P<value>(?:{str_value_pattern}(?:\s*,\s*)?)+)\)(?:\s+(?:and|or)\s+|\s+)?"""
)
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,7 +18,6 @@
"""

from datetime import timedelta
from re import I
from typing import Optional, Union

from app.translator.core.exceptions.core import SigmaRuleValidationException
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp