import ipaddress


def rule(event):
    if all(
        [
            event.deep_get("c-useragent", default="").startswith("Microsoft-WebDAV-MiniRedir/"),
            event.deep_get("cs-method", default="") == "GET",
            any(
                [
                    event.deep_get("c-uri", default="").endswith(".7z"),
                    event.deep_get("c-uri", default="").endswith(".bat"),
                    event.deep_get("c-uri", default="").endswith(".dat"),
                    event.deep_get("c-uri", default="").endswith(".cmd"),
                    event.deep_get("c-uri", default="").endswith(".exe"),
                    event.deep_get("c-uri", default="").endswith(".js"),
                    event.deep_get("c-uri", default="").endswith(".lnk"),
                    event.deep_get("c-uri", default="").endswith(".ps1"),
                    event.deep_get("c-uri", default="").endswith(".rar"),
                    event.deep_get("c-uri", default="").endswith(".url"),
                    event.deep_get("c-uri", default="").endswith(".vbe"),
                    event.deep_get("c-uri", default="").endswith(".vbs"),
                    event.deep_get("c-uri", default="").endswith(".zip"),
                ]
            ),
            not any(
                [
                    ipaddress.ip_address(event.deep_get("dst_ip", default=""))
                    in ipaddress.ip_network("127.0.0.0/8"),
                    ipaddress.ip_address(event.deep_get("dst_ip", default=""))
                    in ipaddress.ip_network("10.0.0.0/8"),
                    ipaddress.ip_address(event.deep_get("dst_ip", default=""))
                    in ipaddress.ip_network("172.16.0.0/12"),
                    ipaddress.ip_address(event.deep_get("dst_ip", default=""))
                    in ipaddress.ip_network("192.168.0.0/16"),
                    ipaddress.ip_address(event.deep_get("dst_ip", default=""))
                    in ipaddress.ip_network("169.254.0.0/16"),
                    ipaddress.ip_address(event.deep_get("dst_ip", default=""))
                    in ipaddress.ip_network("::1/128"),
                    ipaddress.ip_address(event.deep_get("dst_ip", default=""))
                    in ipaddress.ip_network("fe80::/10"),
                    ipaddress.ip_address(event.deep_get("dst_ip", default=""))
                    in ipaddress.ip_network("fc00::/7"),
                ]
            ),
        ]
    ):
        return True
    return False
