def rule(event):
    if all(
        [
            "/autodiscover.json" in event.deep_get("cs-uri-query", default=""),
            any(
                [
                    "/powershell" in event.deep_get("cs-uri-query", default=""),
                    "/mapi/nspi" in event.deep_get("cs-uri-query", default=""),
                    "/EWS" in event.deep_get("cs-uri-query", default=""),
                    "X-Rps-CAT" in event.deep_get("cs-uri-query", default=""),
                ]
            ),
            event.deep_get("sc-status", default="") in [200, 301],
        ]
    ):
        return True
    return False
