def rule(event):
    if all(
        [
            event.deep_get("ParentImage", default="").endswith("\\7zFM.exe"),
            any(
                [
                    any(
                        [
                            event.deep_get("Image", default="").endswith("\\cmd.exe"),
                            event.deep_get("Image", default="").endswith("\\powershell.exe"),
                            event.deep_get("Image", default="").endswith("\\pwsh.exe"),
                        ]
                    ),
                    event.deep_get("OriginalFileName", default="")
                    in ["Cmd.Exe", "PowerShell.EXE", "pwsh.dll"],
                ]
            ),
            not any(
                [
                    any(
                        [
                            any(
                                [
                                    " /c " in event.deep_get("CommandLine", default=""),
                                    " /k " in event.deep_get("CommandLine", default=""),
                                    " /r " in event.deep_get("CommandLine", default=""),
                                ]
                            ),
                            any(
                                [
                                    event.deep_get("CommandLine", default="").endswith(".bat"),
                                    event.deep_get("CommandLine", default="").endswith(".cmd"),
                                    event.deep_get("CommandLine", default="").endswith(".ps1"),
                                ]
                            ),
                        ]
                    ),
                    event.deep_get("CommandLine", default="") == "",
                ]
            ),
        ]
    ):
        return True
    return False
