MS365DefenderCountIncidentCategories
Count the categories of alerts in given incident.
python · Microsoft 365 Defender
Source
from collections import Counter import demistomock as demisto # noqa: F401 from CommonServerPython import * # noqa: F401 def count_dict(value: str) -> List[dict]: """ Count the number of occurrences of each category in the given string. :param value: The string containing the categories separated by commas. :return: A list of dictionaries containing the category and the number of occurrences. """ demisto.debug(f"Counting categories in string: {value}") categories = value.split(",") return [{"category": key, "count": value} for key, value in dict(Counter(categories)).items()] def main(): # pragma: no cover try: return_results(count_dict(**demisto.args())) except Exception as e: return_error(f"Failed to execute MS365DefenderCountIncidentCategories.py. Error: {e!s}") if __name__ in ("__main__", "__builtin__", "builtins"): main()
README
count the categories of alerts in given incident.
Script Data
| Name | Description |
|---|---|
| Script Type | python3 |
| Tags | transformer |
| Cortex XSOAR Version | 5.5.0 |
Inputs
| Argument Name | Description |
|---|---|
| value | count the categories of alerts in given incident |
Outputs
There are no outputs for this script.