def rule(event):
    if any(
        [
            all(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\powershell.exe"),
                            event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                        ]
                    ),
                    any(
                        [
                            " | iex;" in event.deep_get("CommandLine", default=""),
                            " | iex " in event.deep_get("CommandLine", default=""),
                            " | iex}" in event.deep_get("CommandLine", default=""),
                            " | IEX ;" in event.deep_get("CommandLine", default=""),
                            " | IEX -Error" in event.deep_get("CommandLine", default=""),
                            " | IEX (new" in event.deep_get("CommandLine", default=""),
                            ");IEX " in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                    any(
                        [
                            "::FromBase64String" in event.deep_get("CommandLine", default=""),
                            ".GetString([System.Convert]::"
                            in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                ]
            ),
            any(
                [
                    ")|iex;$" in event.deep_get("CommandLine", default=""),
                    ");iex($" in event.deep_get("CommandLine", default=""),
                    ");iex $" in event.deep_get("CommandLine", default=""),
                    " | IEX | " in event.deep_get("CommandLine", default=""),
                    ' | iex\\"' in event.deep_get("CommandLine", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
