def rule(event):
    if all(
        [
            any(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\powershell.exe"),
                            event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                        ]
                    ),
                    event.deep_get("OriginalFileName", default="")
                    in ["PowerShell.Exe", "pwsh.dll"],
                ]
            ),
            any(
                [
                    " -e " in event.deep_get("CommandLine", default=""),
                    " -en " in event.deep_get("CommandLine", default=""),
                    " -enc " in event.deep_get("CommandLine", default=""),
                    " -enco" in event.deep_get("CommandLine", default=""),
                ]
            ),
            any(
                [
                    " JAB" in event.deep_get("CommandLine", default=""),
                    " SUVYI" in event.deep_get("CommandLine", default=""),
                    " SQBFAFgA" in event.deep_get("CommandLine", default=""),
                    " aWV4I" in event.deep_get("CommandLine", default=""),
                    " IAB" in event.deep_get("CommandLine", default=""),
                    " PAA" in event.deep_get("CommandLine", default=""),
                    " aQBlAHgA" in event.deep_get("CommandLine", default=""),
                ]
            ),
            not any(
                [
                    "C:\\Packages\\Plugins\\Microsoft.GuestConfiguration.ConfigurationforWindows\\"
                    in event.deep_get("ParentImage", default=""),
                    "\\gc_worker.exe" in event.deep_get("ParentImage", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
