def rule(event):
    if all(
        [
            event.deep_get("EventID", default="") in [2006, 2052],
            not any(
                [
                    any(
                        [
                            event.deep_get("ModifyingApplication", default="").startswith(
                                "C:\\Program Files (x86)\\"
                            ),
                            event.deep_get("ModifyingApplication", default="").startswith(
                                "C:\\Program Files\\"
                            ),
                            event.deep_get("ModifyingApplication", default="").startswith(
                                "C:\\Windows\\WinSxS\\"
                            ),
                        ]
                    ),
                    event.deep_get("ModifyingApplication", default="")
                    == "C:\\Windows\\System32\\svchost.exe",
                    event.deep_get("ModifyingApplication", default="") == "",
                    event.deep_get("ModifyingApplication", default="") == "",
                ]
            ),
            not all(
                [
                    event.deep_get("ModifyingApplication", default="").startswith(
                        "C:\\ProgramData\\Microsoft\\Windows Defender\\Platform\\"
                    ),
                    event.deep_get("ModifyingApplication", default="").endswith("\\MsMpEng.exe"),
                ]
            ),
        ]
    ):
        return True
    return False
