From 93e7fa3431397bb60ea17875e6b77568d0e3d97e Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sat, 29 Aug 2020 10:28:26 +0200 Subject: [PATCH] reorganize checks --- respodns/__main__.py | 17 ++++++++--------- respodns/checks.py | 13 ++++--------- 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/respodns/__main__.py b/respodns/__main__.py index ff3f0d7..a810776 100644 --- a/respodns/__main__.py +++ b/respodns/__main__.py @@ -1,15 +1,14 @@ #!/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 .ips import blocks, is_bogon from .pooler import make_simple_pooler from .structs import Options, Entry 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 +import respodns.checks as chk def process_result(res, ip, check, opts: Options): # TODO: get more accurate times by inserting start-end into getaddrs. @@ -164,11 +163,11 @@ def ui(program, args): a = parser.parse_args(args) checks = [] - checks += first_checks - #checks += new_checks - checks += likely_checks - #checks += unlikely_checks - #checks += top100 + checks += chk.first + #checks += chk.new + checks += chk.likely + #checks += chk.unlikely + #checks += chk.top100 opts = Options() opts.dry = a.database is None diff --git a/respodns/checks.py b/respodns/checks.py index 5d3f68f..fbb6749 100644 --- a/respodns/checks.py +++ b/respodns/checks.py @@ -25,11 +25,11 @@ def head(n, it): 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 ] -new_checks = [ +new = [ # via dnsvalidator Check("adtrack", "bet365.com"), Check("common", "facebook.com"), @@ -39,7 +39,7 @@ new_checks = [ Check("news", "telegram.com"), ] -likely_checks = [ +likely = [ # these checks are, in practice, the most likely to weed out unwanted DNS servers. Check("news", "huanqiu.com"), 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 ] -unlikely_checks = [ +unlikely = [ Check("piracy", "thepiratebay.org"), Check("porn", "xvideos.com"), Check("usercontent","imgur.com"), @@ -107,8 +107,3 @@ def _top1m_gen(): top100 = head(100, _top1m_gen()) top1000 = head(1000, _top1m_gen()) - -#__all__ = [ -# "first_checks", "new_checks", "likely_checks", "unlikely_checks", "top100", -# "defunct", -#]