ChronicleAssetEventsForMACWidgetScript

Displays the list of events fetched for an asset identified as a "ChronicleAsset" type of indicator, when its MAC address is passed as an asset identifier.

python · Google SecOps

Source

import traceback
from typing import Any

import demistomock as demisto
from CommonServerPython import *


def set_arguments_for_widget_view(indicator_data: dict[str, Any]) -> dict[str, str] | str:
    args = {}
    chronicleasset_mac = indicator_data.get("CustomFields", {}).get("chronicleassetmac", "")
    if chronicleasset_mac:
        args = {
            "asset_identifier": chronicleasset_mac,
            "asset_identifier_type": "MAC Address",
            "preset_time_range": "Last 30 days",
        }
    return args


def main() -> None:
    try:
        arguments = set_arguments_for_widget_view(demisto.args().get("indicator"))
        if not arguments:
            demisto.results("No MAC Address associated with the ChronicleAsset.")
        else:
            demisto.results(demisto.executeCommand("gcb-list-events", arguments))
    except Exception as e:
        demisto.error(traceback.format_exc())
        return_error(f"Could not load widget:\n{e}")


# python2 uses __builtin__ python3 uses builtins
if __name__ == "__builtin__" or __name__ == "builtins":
    main()

README

Displays the list of events fetched for an asset identified as a “ChronicleAsset” type of indicator, when its MAC address is passed as an asset identifier.

Script Data


Name Description
Script Type python3
Tags dynamic-indicator-section
Cortex XSOAR Version 5.0.0

Dependencies


This script uses the following commands and scripts.
gcb-list-events

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.