def rule(event):
    if all(
        [
            any(
                [
                    all(
                        [
                            any(
                                [
                                    "\\Microsoft\\Word\\STARTUP"
                                    in event.deep_get("TargetFilename", default=""),
                                    all(
                                        [
                                            "\\Office"
                                            in event.deep_get("TargetFilename", default=""),
                                            "\\Program Files"
                                            in event.deep_get("TargetFilename", default=""),
                                            "\\STARTUP"
                                            in event.deep_get("TargetFilename", default=""),
                                        ]
                                    ),
                                ]
                            ),
                            any(
                                [
                                    event.deep_get("TargetFilename", default="").endswith(".doc"),
                                    event.deep_get("TargetFilename", default="").endswith(".docm"),
                                    event.deep_get("TargetFilename", default="").endswith(".docx"),
                                    event.deep_get("TargetFilename", default="").endswith(".dot"),
                                    event.deep_get("TargetFilename", default="").endswith(".dotm"),
                                    event.deep_get("TargetFilename", default="").endswith(".rtf"),
                                ]
                            ),
                        ]
                    ),
                    all(
                        [
                            any(
                                [
                                    "\\Microsoft\\Excel\\XLSTART"
                                    in event.deep_get("TargetFilename", default=""),
                                    all(
                                        [
                                            "\\Office"
                                            in event.deep_get("TargetFilename", default=""),
                                            "\\Program Files"
                                            in event.deep_get("TargetFilename", default=""),
                                            "\\XLSTART"
                                            in event.deep_get("TargetFilename", default=""),
                                        ]
                                    ),
                                ]
                            ),
                            any(
                                [
                                    event.deep_get("TargetFilename", default="").endswith(".xls"),
                                    event.deep_get("TargetFilename", default="").endswith(".xlsm"),
                                    event.deep_get("TargetFilename", default="").endswith(".xlsx"),
                                    event.deep_get("TargetFilename", default="").endswith(".xlt"),
                                    event.deep_get("TargetFilename", default="").endswith(".xltm"),
                                ]
                            ),
                        ]
                    ),
                ]
            ),
            not any(
                [
                    event.deep_get("Image", default="").endswith("\\WINWORD.exe"),
                    event.deep_get("Image", default="").endswith("\\EXCEL.exe"),
                ]
            ),
        ]
    ):
        return True
    return False
