~phlash/sinkhole

2758f9be8eadb2aded2f0e610d0b3f7ab77e841b — Phil Ashby 3 months ago 7527867
report total hosts hit
1 files changed, 1 insertions(+), 2 deletions(-)

M etc/cron.daily/x1report-hosts-blocked
M etc/cron.daily/x1report-hosts-blocked => etc/cron.daily/x1report-hosts-blocked +1 -2
@@ 48,7 48,6 @@ if os.access(SINKHOLE_LOG, os.R_OK):
                hits[hit] += 1
            else:
                hits[hit] = 1
#print(f"Hits({len(hits)}):", hits)

now = int(time.time())
then = now - (SINKHOLE_SUPPDAYS * 86400)


@@ 81,7 80,7 @@ def update(k, v):
stats = {k: update(k,v) for (k,v) in stats.items()}
#print(f"Updated({len(stats)}):", stats)

print(f"Blocked DNS domains (in {SINKHOLE_BLOCKFILE}) from {SINKHOLE_LOG}, suppressed by {SINKHOLE_SUPPFILE} ({len(stats)} entries) for {SINKHOLE_SUPPDAYS} days")
print(f"Blocked DNS lookups from log {SINKHOLE_LOG} ({len(hits)} hosts), suppressed by {SINKHOLE_SUPPFILE} ({len(stats)} entries) for {SINKHOLE_SUPPDAYS} days")
for hit in sorted(hits, key=hits.get, reverse=True):
    if not hit in suppress:
        print(f"{hits[hit]} {hit}")