import re


def rule(event):
    if all(
        [
            any(
                [
                    all(
                        [
                            re.match(r"^.*\\7z.*.exe$", event.deep_get("ParentImage", default="")),
                            re.match(
                                r"^.*\\AppData\\local\\temp\\7z.*\\.*$",
                                event.deep_get("CommandLine", default=""),
                            ),
                        ]
                    ),
                    all(
                        [
                            event.deep_get("ParentImage", default="").endswith("\\winrar.exe"),
                            re.match(
                                r"^.*\\AppData\\local\\temp\\rar.*\\.*$",
                                event.deep_get("CommandLine", default=""),
                            ),
                        ]
                    ),
                    all(
                        [
                            event.deep_get("ParentImage", default="").endswith("\\explorer.exe"),
                            any(
                                [
                                    re.match(
                                        r"^.*\\AppData\\local\\temp\\.*.rar\\.*$",
                                        event.deep_get("CommandLine", default=""),
                                    ),
                                    re.match(
                                        r"^.*\\AppData\\local\\temp\\.*.zip\\.*$",
                                        event.deep_get("CommandLine", default=""),
                                    ),
                                ]
                            ),
                        ]
                    ),
                ]
            ),
            any(
                [
                    event.deep_get("Image", default="").endswith("\\cscript.exe"),
                    event.deep_get("Image", default="").endswith("\\mshta.exe"),
                    event.deep_get("Image", default="").endswith("\\powershell.exe"),
                    event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                    event.deep_get("Image", default="").endswith("\\wscript.exe"),
                ]
            ),
            any(
                [
                    event.deep_get("CommandLine", default="").endswith(".hta"),
                    event.deep_get("CommandLine", default="").endswith(".js"),
                    event.deep_get("CommandLine", default="").endswith(".jse"),
                    event.deep_get("CommandLine", default="").endswith(".ps1"),
                    event.deep_get("CommandLine", default="").endswith(".vbe"),
                    event.deep_get("CommandLine", default="").endswith(".vbs"),
                    event.deep_get("CommandLine", default="").endswith(".wsf"),
                    event.deep_get("CommandLine", default="").endswith(".wsh"),
                ]
            ),
        ]
    ):
        return True
    return False
