Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎨 Added field mappings to windows pipeline and changed new transformer #14

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pySigma-backend-netwitness"
version = "0.2.3"
version = "0.2.4"
description = "pySigma NetWitness backend"
readme = "README.md"
authors = ["Marcel Kwaschny <[email protected]>"]
Expand Down
21 changes: 8 additions & 13 deletions sigma/backends/netwitness/transformations.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,21 @@ class CustomConvertTypeTransformation(ValueTransformation):
def apply_value(self, field: str, val: SigmaType) -> Union[SigmaString, SigmaNumber, SigmaExpansion]:
if self.target_type == "str":
if isinstance(val, SigmaExpansion):
for entry in val.values:
entry = SigmaString(str(entry))
for i, entry in enumerate(val.values):
val.values[i] = SigmaString(str(entry))

return val

return SigmaString(str(val))
if self.target_type == "num":
try:
if isinstance(val, SigmaExpansion):
for entry in val.values:
float_value = float(str(entry))
if float_value.is_integer():
entry = SigmaNumber(int(str(entry)))
else:
entry = SigmaNumber(float(str(entry)))
return val
for i, entry in enumerate(val.values):
val.values[i] = SigmaNumber(str(entry)) # type: ignore[arg-type]

float_value = float(str(val))
if float_value.is_integer():
return SigmaNumber(int(str(val)))
return val

return SigmaNumber(float_value)
return SigmaNumber(str(val)) # type: ignore[arg-type]
except SigmaValueError as error:
raise SigmaValueError(f"Value '{val}' can't be converted to number for {str(self)}") from error

Expand Down
2 changes: 2 additions & 0 deletions sigma/pipelines/netwitness/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"Account": "user",
"AgentComputer": "alias.host",
"AllUser": "user.all",
"AuthenticationPackageName": "auth.method",
"CommandLine": "param",
"DestinationIp": "ip.dst",
"DestinationIpAddress": "ip.dst",
Expand All @@ -24,6 +25,7 @@
"Image": "process",
"IpAddress": "host.src",
"IpPort": "ip.srcport",
"LogonProcessName": "process",
"LogonType": "logon.type",
"NewProcessName": "process",
"ParentImage": "process.src",
Expand Down