From 1395e7d6f68bf50022c0334adb21aae812729065 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 6 Aug 2021 14:22:27 -0700 Subject: [PATCH] detect blocks that self-redirect --- respodns/dns.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/respodns/dns.py b/respodns/dns.py index 7ac4dd2..1b04006 100644 --- a/respodns/dns.py +++ b/respodns/dns.py @@ -71,6 +71,11 @@ def process_result(res, ip, check, opts: Options): elif check.kind.startswith("bad"): reason = "okay" if "NXDOMAIN" in res else "redirect" + elif any(r == ip for r in res): + # server returned its own IP, must be a block, unless + # one of our checks actually contains a domain that also hosts a DNS. + reason = "block" + elif any(is_bogon(r) or is_block_target(r) for r in res): reason = "block"