import re


def rule(event):
    if any(
        [
            all(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\whoami.exe"),
                            event.deep_get("OriginalFileName", default="") == "whoami.exe",
                        ]
                    ),
                    any(
                        [
                            " /FO CSV" in event.deep_get("CommandLine", default=""),
                            " -FO CSV" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                ]
            ),
            re.match(r"^.*whoami.*>.*$", event.deep_get("CommandLine", default="")),
        ]
    ):
        return True
    return False
