def rule(event):
    if any(
        [
            all(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\mshta.exe"),
                            event.deep_get("OriginalFileName", default="") == "MSHTA.EXE",
                        ]
                    ),
                    any(
                        [
                            event.deep_get("ParentImage", default="").endswith("\\cmd.exe"),
                            event.deep_get("ParentImage", default="").endswith("\\cscript.exe"),
                            event.deep_get("ParentImage", default="").endswith("\\powershell.exe"),
                            event.deep_get("ParentImage", default="").endswith("\\pwsh.exe"),
                            event.deep_get("ParentImage", default="").endswith("\\regsvr32.exe"),
                            event.deep_get("ParentImage", default="").endswith("\\rundll32.exe"),
                            event.deep_get("ParentImage", default="").endswith("\\wscript.exe"),
                        ]
                    ),
                    any(
                        [
                            "\\AppData\\Local\\" in event.deep_get("CommandLine", default=""),
                            "C:\\ProgramData\\" in event.deep_get("CommandLine", default=""),
                            "C:\\Users\\Public\\" in event.deep_get("CommandLine", default=""),
                            "C:\\Windows\\Temp\\" in event.deep_get("CommandLine", default=""),
                        ]
                    ),
                ]
            ),
            all(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\mshta.exe"),
                            event.deep_get("OriginalFileName", default="") == "MSHTA.EXE",
                        ]
                    ),
                    not any(
                        [
                            any(
                                [
                                    event.deep_get("Image", default="").startswith(
                                        "C:\\Windows\\System32\\"
                                    ),
                                    event.deep_get("Image", default="").startswith(
                                        "C:\\Windows\\SysWOW64\\"
                                    ),
                                ]
                            ),
                            any(
                                [
                                    ".htm" in event.deep_get("CommandLine", default=""),
                                    ".hta" in event.deep_get("CommandLine", default=""),
                                ]
                            ),
                            any(
                                [
                                    event.deep_get("CommandLine", default="").endswith("mshta.exe"),
                                    event.deep_get("CommandLine", default="").endswith("mshta"),
                                ]
                            ),
                        ]
                    ),
                ]
            ),
        ]
    ):
        return True
    return False
