def rule(event):
    if all(
        [
            any(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\powershell_ise.exe"),
                            event.deep_get("Image", default="").endswith("\\powershell.exe"),
                            event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                        ]
                    ),
                    event.deep_get("OriginalFileName", default="")
                    in ["powershell_ise.EXE", "PowerShell.EXE", "pwsh.dll"],
                ]
            ),
            any(
                [
                    "curl " in event.deep_get("CommandLine", default=""),
                    "Invoke-WebRequest" in event.deep_get("CommandLine", default=""),
                    "iwr " in event.deep_get("CommandLine", default=""),
                    "wget " in event.deep_get("CommandLine", default=""),
                ]
            ),
            any(
                [
                    " -ur" in event.deep_get("CommandLine", default=""),
                    " -o" in event.deep_get("CommandLine", default=""),
                ]
            ),
            any(
                [
                    "\\AppData\\" in event.deep_get("CommandLine", default=""),
                    "\\Desktop\\" in event.deep_get("CommandLine", default=""),
                    "\\Temp\\" in event.deep_get("CommandLine", default=""),
                    "\\Users\\Public\\" in event.deep_get("CommandLine", default=""),
                    "%AppData%" in event.deep_get("CommandLine", default=""),
                    "%Public%" in event.deep_get("CommandLine", default=""),
                    "%Temp%" in event.deep_get("CommandLine", default=""),
                    "%tmp%" in event.deep_get("CommandLine", default=""),
                    ":\\Windows\\" in event.deep_get("CommandLine", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
