Commit c89756ec authored by Felix Yan's avatar Felix Yan

accelerated-domains: remove invalid items

parent ca8392bb
This diff is collapsed.
...@@ -4,6 +4,7 @@ import dns.resolver ...@@ -4,6 +4,7 @@ import dns.resolver
from termcolor import colored from termcolor import colored
import random import random
import ipaddress import ipaddress
import tldextract
with open("ns-whitelist.txt") as f: with open("ns-whitelist.txt") as f:
whitelist = list([l.rstrip('\n') for l in f if l]) whitelist = list([l.rstrip('\n') for l in f if l])
...@@ -55,7 +56,7 @@ for domain in domains: ...@@ -55,7 +56,7 @@ for domain in domains:
testdomain = None testdomain = None
if any(i in nameserver_text for i in whitelist): if any(i in nameserver_text for i in whitelist):
print(colored("NS Whitelist matched for domain: " + domain, "green")) print(colored("NS Whitelist matched for domain: " + domain, "green"))
elif domain.count(".") > 1 or any(testdomain.endswith(domain) for testdomain in cdnlist): elif domain.count(".") > 1 and tldextract.extract(domain).registered_domain != domain or any(testdomain.endswith(domain) for testdomain in cdnlist):
for testdomain in cdnlist: for testdomain in cdnlist:
if testdomain.endswith(domain): if testdomain.endswith(domain):
break break
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment