Update os.py

This commit is contained in:
None 2025-05-08 13:55:35 +02:00 committed by GitHub
parent 646cb22ddf
commit fb6e54bdb1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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):