DataminrPulseCVSSColor

This dynamic automation parses the CVSS Score of a CVE and presents it in the layout with color.

python · Dataminr Pulse

Source

import demistomock as demisto  # noqa: F401
from CommonServerPython import *  # noqa: F401


def get_color(cvss) -> str:
    """
    Gets a CVSS score and sends back the correct hex code for a color as a string.

    Args:
        cvss: A CVE CVSS score.

    Returns:
        str: The color of the score in hex format.
    """

    cvss = float(cvss)

    if cvss >= 7.0:
        color = "#E1211E"
    elif cvss >= 4.0:
        color = "#F47D3E"
    elif cvss > 0.0:
        color = "#F9B637"
    else:
        color = "#CDCED6"

    return color


def main():
    indicator = demisto.callingContext.get("args", {}).get("indicator", {})
    cvss = indicator.get("CustomFields", {}).get("cvssscore", None)

    if cvss is None:
        color = "#CDCED6"
        return_results(CommandResults(readable_output=f"# <-:->{{{{color:{color}}}}}(**N/A**)"))  # noqa: E231
    else:
        color = get_color(cvss)
        return_results(CommandResults(readable_output=f"# <-:->{{{{color:{color}}}}}(**{cvss}**)"))  # noqa: E231


if __name__ in ("__builtin__", "builtins", "__main__"):
    main()

README

This dynamic automation parses the CVSS Score of a CVE and presents it in the layout with color.

Script Data


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

Inputs


There are no inputs for this script.

Outputs


There are no outputs for this script.