msticpy/nbtools/ti_browser.py
def _create_ti_agg_list(
    ti_data: pd.DataFrame, severities: Union[List[str], str, None] = None
):
    """Aggregate ti results on IoC for multiple providers."""
    if not severities:
        severities = ["warning", "high"]
    if severities == "all":
        severities = ["information", "warning", "high"]
    ti_data["Details"] = ti_data.apply(lambda x: _label_col_dict(x, "Details"), axis=1)

    return (
        ti_data[ti_data["Severity"].isin(severities)]
        .groupby(["Ioc", "IocType", "Severity"])
        .agg(
            Providers=pd.NamedAgg(
                column="Provider", aggfunc=lambda x: x.unique().tolist()
            ),
            Details=pd.NamedAgg(column="Details", aggfunc=lambda x: x.tolist()),
            Responses=pd.NamedAgg(column="RawResult", aggfunc=lambda x: x.tolist()),
            References=pd.NamedAgg(
                column="Reference", aggfunc=lambda x: x.unique().tolist()
            ),
        )
        .reset_index()
    )
Aggregate ti results on IoC for multiple providers.
Aggregate ti results on IoC for multiple providers.
Aggregate ti results on IoC for multiple providers .
def _create_ti_agg_list(
    ti_data: pd.DataFrame, severities: Union[List[str], str, None] = None
):
    if not severities:
        severities = ["warning", "high"]
    if severities == "all":
        severities = ["information", "warning", "high"]
    ti_data["Details"] = ti_data.apply(lambda x: _label_col_dict(x, "Details"), axis=1)
    return (
        ti_data[ti_data["Severity"].isin(severities)]
        .groupby(["Ioc", "IocType", "Severity"])
        .agg(
            Providers=pd.NamedAgg(
                column="Provider", aggfunc=lambda x: x.unique().tolist()
            ),
            Details=pd.NamedAgg(column="Details", aggfunc=lambda x: x.tolist()),
            Responses=pd.NamedAgg(column="RawResult", aggfunc=lambda x: x.tolist()),
            References=pd.NamedAgg(
                column="Reference", aggfunc=lambda x: x.unique().tolist()
            ),
        )
        .reset_index()
    )
def _create_ti_agg_list ( ti_data : pd . DataFrame , severities : Union [ List [ str ] , str , None ] = None ) : if not severities : severities = [ "warning" , "high" ] if severities == "all" : severities = [ "information" , "warning" , "high" ] ti_data [ "Details" ] = ti_data . apply ( lambda x : _label_col_dict ( x , "Details" ) , axis = 1 ) return ( ti_data [ ti_data [ "Severity" ] . isin ( severities ) ] . groupby ( [ "Ioc" , "IocType" , "Severity" ] ) . agg ( Providers = pd . NamedAgg ( column = "Provider" , aggfunc = lambda x : x . unique ( ) . tolist ( ) ) , Details = pd . NamedAgg ( column = "Details" , aggfunc = lambda x : x . tolist ( ) ) , Responses = pd . NamedAgg ( column = "RawResult" , aggfunc = lambda x : x . tolist ( ) ) , References = pd . NamedAgg ( column = "Reference" , aggfunc = lambda x : x . unique ( ) . tolist ( ) ) , ) . reset_index ( ) )
Aggregate ti results on IoC for multiple providers.
Aggregate ti results on IoC for multiple providers .
"""Aggregate ti results on IoC for multiple providers."""
ti_data
pd.DataFrame
severities
Union[List[str], str, None]