msticpy.init.mp_user_session module

MSTICPy User Session loader.

This loads user-specific configuration settings from a YAML file.

Example YAML file:

QueryProviders:
    qry_prov_sent:
        DataEnvironment: MSSentinel
        InitArgs:
            debug: True
        Connect: True
        ConnectArgs:
            workspace: MySoc
            auth_methods: ['cli', 'device_code']
    qry_prov_md:
        DataEnvironment: M365D
    qry_kusto_mde:
        DataEnvironment: Kusto
        Connect: True
        ConnectArgs:
            cluster: MDEData
    qry_kusto_mstic:
        DataEnvironment: Kusto
        Connect: True
        ConnectArgs:
            cluster: MSTIC
Components:
    mssentinel:
        Module: msticpy.context.azure
        Class: MicrosoftSentinel
        InitArgs:
        Connect: True
        ConnectArgs:
            workspace: CyberSecuritySoc
            auth_methods: ['cli', 'device_code']

Example usage:

import msticpy as mp
mp.init_notebook()
mp.mp_user_session.load_user_config()
msticpy.init.mp_user_session.load_user_session(session_file: str | Path | None = None, namespace: dict[str, Any] | None = None, verbose: bool = False)

Load user session configuration.

Parameters:
  • session_file (str, Path, optional) – Path to the user configuration file, by default None. If no file is provided, the function will look in the current directory for an mp_user_session.yaml file.

  • namespace (dict[str, Any], optional) – Namespace to load the configuration into, by default None. If no namespace is provided, the configuration will be loaded into the global namespace of the caller (usually the notebook).

  • verbose (bool, optional) – If True, set the logger to INFO level for the duration of the function, by default False.