]> git.ipfire.org Git - dbl.git/commitdiff
dnsbl: Show if a domain is dead
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 28 Dec 2025 14:32:14 +0000 (14:32 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 28 Dec 2025 14:32:14 +0000 (14:32 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/dnsbl/__init__.py
src/scripts/dnsbl.in

index 27c8a48e28bbc72203347aae658a070f903eda81..5b5f0434ae64f26c7cf6961ce86b3b33476cd470 100644 (file)
@@ -119,3 +119,19 @@ class Backend(object):
                                res[domain.source.list] = [domain]
 
                return res
+
+       def check(self, domain):
+               """
+                       Returns the status of a domain
+               """
+               stmt = (
+                       sqlmodel
+                       .select(
+                               checker.CheckerDomain.status,
+                       )
+                       .where(
+                               checker.CheckerDomain.name == domain,
+                       )
+               )
+
+               return self.db.fetch_one(stmt)
index c6e8ced5cf306d6e3a1c592b743afeb2229c903d..424eeee478cf84806e9e1af194ad8320f467f07e 100644 (file)
@@ -29,6 +29,7 @@ import os
 import pathlib
 import rich.console
 import rich.table
+import rich.text
 import sys
 import tempfile
 
@@ -408,6 +409,17 @@ class CLI(object):
                """
                        Searches for a domain name
                """
+               # Check if a domain is active
+               active = backend.check(args.domain)
+
+               # If the domain is dead, we show a warning
+               if active is False:
+                       warning = rich.text.Text(
+                               _("The domain '%s' seems to be dead") % args.domain,
+                               style="bold red",
+                       )
+                       self.console.print(warning)
+
                # Search!
                lists = backend.search(args.domain)