import ipaddress


def rule(event):
    if all(
        [
            any(
                [
                    event.deep_get("DestinationHostname", default="") in ["www.ip.cn", "l2.io"],
                    any(
                        [
                            "api.2ip.ua" in event.deep_get("DestinationHostname", default=""),
                            "api.bigdatacloud.net"
                            in event.deep_get("DestinationHostname", default=""),
                            "api.ipify.org" in event.deep_get("DestinationHostname", default=""),
                            "bot.whatismyipaddress.com"
                            in event.deep_get("DestinationHostname", default=""),
                            "canireachthe.net" in event.deep_get("DestinationHostname", default=""),
                            "checkip.amazonaws.com"
                            in event.deep_get("DestinationHostname", default=""),
                            "checkip.dyndns.org"
                            in event.deep_get("DestinationHostname", default=""),
                            "curlmyip.com" in event.deep_get("DestinationHostname", default=""),
                            "db-ip.com" in event.deep_get("DestinationHostname", default=""),
                            "edns.ip-api.com" in event.deep_get("DestinationHostname", default=""),
                            "eth0.me" in event.deep_get("DestinationHostname", default=""),
                            "freegeoip.app" in event.deep_get("DestinationHostname", default=""),
                            "geoipy.com" in event.deep_get("DestinationHostname", default=""),
                            "getip.pro" in event.deep_get("DestinationHostname", default=""),
                            "icanhazip.com" in event.deep_get("DestinationHostname", default=""),
                            "ident.me" in event.deep_get("DestinationHostname", default=""),
                            "ifconfig.io" in event.deep_get("DestinationHostname", default=""),
                            "ifconfig.me" in event.deep_get("DestinationHostname", default=""),
                            "ip-api.com" in event.deep_get("DestinationHostname", default=""),
                            "ip.360.cn" in event.deep_get("DestinationHostname", default=""),
                            "ip.anysrc.net" in event.deep_get("DestinationHostname", default=""),
                            "ip.taobao.com" in event.deep_get("DestinationHostname", default=""),
                            "ip.tyk.nu" in event.deep_get("DestinationHostname", default=""),
                            "ipaddressworld.com"
                            in event.deep_get("DestinationHostname", default=""),
                            "ipapi.co" in event.deep_get("DestinationHostname", default=""),
                            "ipconfig.io" in event.deep_get("DestinationHostname", default=""),
                            "ipecho.net" in event.deep_get("DestinationHostname", default=""),
                            "ipinfo.io" in event.deep_get("DestinationHostname", default=""),
                            "ipip.net" in event.deep_get("DestinationHostname", default=""),
                            "ipof.in" in event.deep_get("DestinationHostname", default=""),
                            "ipv4.icanhazip.com"
                            in event.deep_get("DestinationHostname", default=""),
                            "ipv4bot.whatismyipaddress.com"
                            in event.deep_get("DestinationHostname", default=""),
                            "ipv6-test.com" in event.deep_get("DestinationHostname", default=""),
                            "ipwho.is" in event.deep_get("DestinationHostname", default=""),
                            "jsonip.com" in event.deep_get("DestinationHostname", default=""),
                            "myexternalip.com" in event.deep_get("DestinationHostname", default=""),
                            "seeip.org" in event.deep_get("DestinationHostname", default=""),
                            "wgetip.com" in event.deep_get("DestinationHostname", default=""),
                            "whatismyip.akamai.com"
                            in event.deep_get("DestinationHostname", default=""),
                            "whois.pconline.com.cn"
                            in event.deep_get("DestinationHostname", default=""),
                            "wtfismyip.com" in event.deep_get("DestinationHostname", default=""),
                        ]
                    ),
                ]
            ),
            not any(
                [
                    event.deep_get("Image", default="").endswith("\\brave.exe"),
                    event.deep_get("Image", default="")
                    in [
                        "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
                        "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
                    ],
                    event.deep_get("Image", default="")
                    in [
                        "C:\\Program Files\\Mozilla Firefox\\firefox.exe",
                        "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe",
                    ],
                    event.deep_get("Image", default="")
                    in [
                        "C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe",
                        "C:\\Program Files\\Internet Explorer\\iexplore.exe",
                    ],
                    event.deep_get("Image", default="").endswith("\\maxthon.exe"),
                    any(
                        [
                            event.deep_get("Image", default="").startswith(
                                "C:\\Program Files (x86)\\Microsoft\\EdgeWebView\\Application\\"
                            ),
                            event.deep_get("Image", default="").endswith(
                                "\\WindowsApps\\MicrosoftEdge.exe"
                            ),
                            event.deep_get("Image", default="")
                            in [
                                "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe",
                                "C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe",
                            ],
                        ]
                    ),
                    all(
                        [
                            any(
                                [
                                    event.deep_get("Image", default="").startswith(
                                        "C:\\Program Files (x86)\\Microsoft\\EdgeCore\\"
                                    ),
                                    event.deep_get("Image", default="").startswith(
                                        "C:\\Program Files\\Microsoft\\EdgeCore\\"
                                    ),
                                ]
                            ),
                            any(
                                [
                                    event.deep_get("Image", default="").endswith("\\msedge.exe"),
                                    event.deep_get("Image", default="").endswith(
                                        "\\msedgewebview2.exe"
                                    ),
                                ]
                            ),
                        ]
                    ),
                    event.deep_get("Image", default="").endswith("\\opera.exe"),
                    event.deep_get("Image", default="").endswith("\\safari.exe"),
                    event.deep_get("Image", default="").endswith("\\seamonkey.exe"),
                    event.deep_get("Image", default="").endswith("\\vivaldi.exe"),
                    event.deep_get("Image", default="").endswith("\\whale.exe"),
                ]
            ),
        ]
    ):
        return True
    return False
