import ipaddress


def rule(event):
    if all(
        [
            "WebDAV" in event.deep_get("user_agent", default=""),
            event.deep_get("method", default="") == "PUT",
            not any(
                [
                    ipaddress.ip_address(event.deep_get("id", "resp_h", default=""))
                    in ipaddress.ip_network("10.0.0.0/8"),
                    ipaddress.ip_address(event.deep_get("id", "resp_h", default=""))
                    in ipaddress.ip_network("127.0.0.0/8"),
                    ipaddress.ip_address(event.deep_get("id", "resp_h", default=""))
                    in ipaddress.ip_network("172.16.0.0/12"),
                    ipaddress.ip_address(event.deep_get("id", "resp_h", default=""))
                    in ipaddress.ip_network("192.168.0.0/16"),
                    ipaddress.ip_address(event.deep_get("id", "resp_h", default=""))
                    in ipaddress.ip_network("169.254.0.0/16"),
                ]
            ),
        ]
    ):
        return True
    return False
