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"],
                    event.deep_get("Description", default="") == "Windows PowerShell",
                    event.deep_get("Product", default="") == "PowerShell Core 6",
                ]
            ),
            "bxor" in event.deep_get("CommandLine", default=""),
            any(
                [
                    "ForEach" in event.deep_get("CommandLine", default=""),
                    "for(" in event.deep_get("CommandLine", default=""),
                    "for " in event.deep_get("CommandLine", default=""),
                    "-join " in event.deep_get("CommandLine", default=""),
                    "-join'" in event.deep_get("CommandLine", default=""),
                    '-join"' in event.deep_get("CommandLine", default=""),
                    "-join`" in event.deep_get("CommandLine", default=""),
                    "::Join" in event.deep_get("CommandLine", default=""),
                    "[char]" in event.deep_get("CommandLine", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
