def rule(event):
    if all(
        [
            event.deep_get("ParentImage", default="").endswith("\\code.exe"),
            any(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\calc.exe"),
                            event.deep_get("Image", default="").endswith("\\regsvr32.exe"),
                            event.deep_get("Image", default="").endswith("\\rundll32.exe"),
                            event.deep_get("Image", default="").endswith("\\cscript.exe"),
                            event.deep_get("Image", default="").endswith("\\wscript.exe"),
                        ]
                    ),
                    all(
                        [
                            any(
                                [
                                    event.deep_get("Image", default="").endswith(
                                        "\\powershell.exe"
                                    ),
                                    event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                                    event.deep_get("Image", default="").endswith("\\cmd.exe"),
                                ]
                            ),
                            any(
                                [
                                    "Invoke-Expressions"
                                    in event.deep_get("CommandLine", default=""),
                                    "IEX" in event.deep_get("CommandLine", default=""),
                                    "Invoke-Command" in event.deep_get("CommandLine", default=""),
                                    "ICM" in event.deep_get("CommandLine", default=""),
                                    "DownloadString" in event.deep_get("CommandLine", default=""),
                                    "rundll32" in event.deep_get("CommandLine", default=""),
                                    "regsvr32" in event.deep_get("CommandLine", default=""),
                                    "wscript" in event.deep_get("CommandLine", default=""),
                                    "cscript" in event.deep_get("CommandLine", default=""),
                                ]
                            ),
                        ]
                    ),
                    any(
                        [
                            ":\\Users\\Public\\" in event.deep_get("Image", default=""),
                            ":\\Windows\\Temp\\" in event.deep_get("Image", default=""),
                            ":\\Temp\\" in event.deep_get("Image", default=""),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
