reorganize checks

This commit is contained in:
Connor Olding 2020-08-29 10:28:26 +02:00
parent 3afeb5a3fd
commit 93e7fa3431
2 changed files with 12 additions and 18 deletions

View file

@ -1,15 +1,14 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from argparse import ArgumentParser
from asyncio import run, sleep
from .checks import (first_checks, new_checks,
likely_checks, unlikely_checks, top100)
from .db import RespoDB from .db import RespoDB
from .ips import blocks, is_bogon from .ips import blocks, is_bogon
from .pooler import make_simple_pooler from .pooler import make_simple_pooler
from .structs import Options, Entry from .structs import Options, Entry
from .util import right_now, read_ips, getaddrs, detect_gfw from .util import right_now, read_ips, getaddrs, detect_gfw
from argparse import ArgumentParser
from asyncio import run, sleep
from sys import argv, stdin, stderr, exit from sys import argv, stdin, stderr, exit
import respodns.checks as chk
def process_result(res, ip, check, opts: Options): def process_result(res, ip, check, opts: Options):
# TODO: get more accurate times by inserting start-end into getaddrs. # TODO: get more accurate times by inserting start-end into getaddrs.
@ -164,11 +163,11 @@ def ui(program, args):
a = parser.parse_args(args) a = parser.parse_args(args)
checks = [] checks = []
checks += first_checks checks += chk.first
#checks += new_checks #checks += chk.new
checks += likely_checks checks += chk.likely
#checks += unlikely_checks #checks += chk.unlikely
#checks += top100 #checks += chk.top100
opts = Options() opts = Options()
opts.dry = a.database is None opts.dry = a.database is None

View file

@ -25,11 +25,11 @@ def head(n, it):
Check = namedtuple("Check", ("kind", "domain")) Check = namedtuple("Check", ("kind", "domain"))
first_checks = [ first = [
Check("common", "baidu.com"), # this avoids issues with chinese censorship: https://www.bortzmeyer.org/sichuan-pepper.html Check("common", "baidu.com"), # this avoids issues with chinese censorship: https://www.bortzmeyer.org/sichuan-pepper.html
] ]
new_checks = [ new = [
# via dnsvalidator # via dnsvalidator
Check("adtrack", "bet365.com"), Check("adtrack", "bet365.com"),
Check("common", "facebook.com"), Check("common", "facebook.com"),
@ -39,7 +39,7 @@ new_checks = [
Check("news", "telegram.com"), Check("news", "telegram.com"),
] ]
likely_checks = [ likely = [
# these checks are, in practice, the most likely to weed out unwanted DNS servers. # these checks are, in practice, the most likely to weed out unwanted DNS servers.
Check("news", "huanqiu.com"), Check("news", "huanqiu.com"),
Check("adware", rot13("nqf789.pbz")), Check("adware", rot13("nqf789.pbz")),
@ -69,7 +69,7 @@ likely_checks = [
Check("common", "google.com"), # surely a fully-functional server would resolve the most popular domain in existence Check("common", "google.com"), # surely a fully-functional server would resolve the most popular domain in existence
] ]
unlikely_checks = [ unlikely = [
Check("piracy", "thepiratebay.org"), Check("piracy", "thepiratebay.org"),
Check("porn", "xvideos.com"), Check("porn", "xvideos.com"),
Check("usercontent","imgur.com"), Check("usercontent","imgur.com"),
@ -107,8 +107,3 @@ def _top1m_gen():
top100 = head(100, _top1m_gen()) top100 = head(100, _top1m_gen())
top1000 = head(1000, _top1m_gen()) top1000 = head(1000, _top1m_gen())
#__all__ = [
# "first_checks", "new_checks", "likely_checks", "unlikely_checks", "top100",
# "defunct",
#]