def rule(event):
    if any(
        [
            all(
                [
                    event.deep_get("EventID", default="") == 5007,
                    "\\Windows Defender\\Windows Defender Exploit Guard\\Controlled Folder Access\\AllowedApplications\\"
                    in event.deep_get("NewValue", default=""),
                    any(
                        [
                            "\\Users\\Public\\" in event.deep_get("NewValue", default=""),
                            "\\AppData\\Local\\Temp\\" in event.deep_get("NewValue", default=""),
                            "\\Desktop\\" in event.deep_get("NewValue", default=""),
                            "\\PerfLogs\\" in event.deep_get("NewValue", default=""),
                            "\\Windows\\Temp\\" in event.deep_get("NewValue", default=""),
                        ]
                    ),
                ]
            ),
            all(
                [
                    event.deep_get("EventID", default="") == 5007,
                    "\\Windows Defender\\Windows Defender Exploit Guard\\Controlled Folder Access\\ProtectedFolders\\"
                    in event.deep_get("OldValue", default=""),
                ]
            ),
        ]
    ):
        return True
    return False
