From fb6e54bdb1b89265347e1edd015af3d873d4ae99 Mon Sep 17 00:00:00 2001 From: None <62809003+Arrowar@users.noreply.github.com> Date: Thu, 8 May 2025 13:55:35 +0200 Subject: [PATCH] Update os.py --- StreamingCommunity/Util/os.py | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/StreamingCommunity/Util/os.py b/StreamingCommunity/Util/os.py index 4b43eeb..c04b714 100644 --- a/StreamingCommunity/Util/os.py +++ b/StreamingCommunity/Util/os.py @@ -282,6 +282,43 @@ class InternManager(): else: return f"{bytes / (1024 * 1024):.2f} MB/s" + def check_dns_provider(self): + """ + Check if the system's current DNS server matches any known DNS providers. + + Returns: + bool: True if the current DNS server matches a known provider, + False if no match is found or in case of errors + """ + dns_providers = { + "Cloudflare": ["1.1.1.1", "1.0.0.1"], + "Google": ["8.8.8.8", "8.8.4.4"], + "OpenDNS": ["208.67.222.222", "208.67.220.220"], + "Quad9": ["9.9.9.9", "149.112.112.112"], + "AdGuard": ["94.140.14.14", "94.140.15.15"], + "Comodo": ["8.26.56.26", "8.20.247.20"], + "Level3": ["209.244.0.3", "209.244.0.4"], + "Norton": ["199.85.126.10", "199.85.127.10"], + "CleanBrowsing": ["185.228.168.9", "185.228.169.9"], + "Yandex": ["77.88.8.8", "77.88.8.1"] + } + + try: + resolver = dns.resolver.Resolver() + nameservers = resolver.nameservers + + if not nameservers: + return False + + for server in nameservers: + for provider, ips in dns_providers.items(): + if server in ips: + return True + return False + + except Exception: + return False + class OsSummary: def __init__(self):