def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("Image", default="").endswith("\\whoami.exe"),
                    event.deep_get("OriginalFileName", default="") == "whoami.exe",
                ]
            ),
            not any(
                [
                    any(
                        [
                            event.deep_get("ParentImage", default="").endswith("\\cmd.exe"),
                            event.deep_get("ParentImage", default="").endswith(
                                "\\powershell_ise.exe"
                            ),
                            event.deep_get("ParentImage", default="").endswith("\\powershell.exe"),
                            event.deep_get("ParentImage", default="").endswith("\\pwsh.exe"),
                        ]
                    ),
                    event.deep_get("ParentImage", default="") == "",
                    event.deep_get("ParentImage", default="") in ["", "-"],
                ]
            ),
            not event.deep_get("ParentImage", default="").endswith(
                ":\\Program Files\\Microsoft Monitoring Agent\\Agent\\MonitoringHost.exe"
            ),
        ]
    ):
        return True
    return False
