Variable | __pdoc__ | Undocumented |
Function | dehexify | A URL and Hexadecimal Decoding Method. |
Function | tob64 | Encode a string to base64 almost like echo '123' | base64 would do. |
Function | fromb64 | Decode a string to base64 almost like echo 'MTIzCg==' | base64 --decode would do. |
Function | timerange_gettimes | Convert a string time range to a tuple of datetime objects. Only works for certain time ranges. |
Function | divide_times | Divide the time range based on a delta or on a number of slots or another time,. |
Function | regex_match | Returns: True if the string match the regex. |
Function | format_esm_time | Converts time object to ESM time string. |
Function | convert_to_time_obj | Converts given timestamp string to datetime object |
Function | parse_query_result | Parse the query results into a list of dict |
Function | format_fields_for_query | Format fields names to cann query module. |
Function | parse_timedelta | Parse a time string e.g. (2h13m ) into a timedelta object. |
Function | nitro_tz | Maps McAfee SIEM/Nitro ESM internal timezone IDs to the tz database at: http://web.cs.ucla.edu/~eggert/tz/tz-link.htm |
A URL and Hexadecimal Decoding Method.
Credit: Larry Dewey.
In the case of the SIEM API, this is used only when dealing with the pricate API calls.
echo 'MTIzCg==' | base64 --decode
would do.Divide the time range based on a delta or on a number of slots or another time,.
list[tuple(datetime, datetime)]
Converts given timestamp string to datetime object
time_str
(str
): timestamp in format 'YYYY/MM/DD HH:MM:SS', 'MM/DD/YYYY HH:MM:SS', or 'DD/MM/YYYY HH:MM:SS'Parse the query results into a list of dict
columns
(list[dict]
): Returned by the SIEM. Exemple:
[{'name': 'Alert.LastTime'}, {'name': 'Rule.msg'}, {'name': 'Alert.DstIP'}, {'name': 'Alert.IPSIDAlertID'}]
rows
(list[dict]
): Returned by the SIEM. Exemple:
[ {'values': ['09/22/2020 15:51:14', 'Postfix Disconnect from host', '::', '144116287604260864|547123']}, {'values': ['09/22/2020 15:51:14', 'Postfix Lost connection from host', '::', '144116287604260864|547122']} ]
list[dict]
Exemple:
[ { "Alert.LastTime":"09/22/2020 15:51:14", "Rule.msg":"Postfix Disconnect from host", "Alert.DstIP":"::", "Alert.IPSIDAlertID":"144116287604260864|547123" }, { ... }, ]
Format fields names to cann query module.
fields
: list of fields, exemple:
['field1','name','user']
Returns:
[ {'name':'field1'}, {'name':'name'}, {'name':'user'}, ]
Parse a time string e.g. (2h13m
) into a timedelta object.
Modified from virhilo's answer at https://stackoverflow.com/a/4628148/851699
time_str
: A string identifying a duration. (eg. 2h13m
)timedelta
: A timedelta objectMaps McAfee SIEM/Nitro ESM internal timezone IDs to the tz database at: http://web.cs.ucla.edu/~eggert/tz/tz-link.htm