You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the ConvertTypeTransformation to convert fields to strings in the netwitness backend because netwitness heavily relies on the correct data type for values in fields. I noticed issues when a field uses a SigmaExpansion data type (for example when using the windash modifier).
A simple fix that I figured out is to update the ConvertTypeTransformation to take care of the SigmaExpansion type like this:
@dataclassclassCustomConvertTypeTransformation(ValueTransformation):
""" Convert type of value. The conversion into strings and numbers is currently supported. """target_type: Literal["str", "num"]
defapply_value(self, field: str, val: SigmaType) ->Optional[Union[SigmaString, SigmaNumber, SigmaExpansion]]:
ifself.target_type=="str":
ifisinstance(val, SigmaExpansion):
forentryinval.values:
entry=SigmaString(str(entry))
returnvalreturnSigmaString(str(val))
elifself.target_type=="num":
try:
ifisinstance(val, SigmaExpansion):
forentryinval.values:
entry=SigmaNumber(str(entry))
returnvalreturnSigmaNumber(str(val))
exceptSigmaValueError:
raiseSigmaValueError(f"Value '{val}' can't be converted to number for {str(self)}")
Is this intended behavior? And is the update of the ConvertTypeTransformation implementation the right way or am I missing something?
Let me know what you think 😊. If this fix is okay for you I would be happy to open a PR.
The text was updated successfully, but these errors were encountered:
Hi! Thanks for the proposed fix. I'm unsure if it really works because the calculated result of this iteration that is stored in entry is not really used by the following code. Instead the SigmaExpansion contained in val is simply returned.
Hey!
I am using the
ConvertTypeTransformation
to convert fields to strings in the netwitness backend because netwitness heavily relies on the correct data type for values in fields. I noticed issues when a field uses aSigmaExpansion
data type (for example when using the windash modifier).So when using a rule with a windash modifier:
and a processing item in a pipeline like this:
A conversion will result in a rule that looks like this:
A simple fix that I figured out is to update the
ConvertTypeTransformation
to take care of theSigmaExpansion
type like this:Is this intended behavior? And is the update of the
ConvertTypeTransformation
implementation the right way or am I missing something?Let me know what you think 😊. If this fix is okay for you I would be happy to open a PR.
The text was updated successfully, but these errors were encountered: