From dfe71e39175347c0fcfdd9a9daef39dc3da447ce Mon Sep 17 00:00:00 2001 From: Calvin Hobbes <5r91nrqo@duck.com> Date: Tue, 11 Nov 2025 15:44:06 +0000 Subject: [PATCH] Modify SQL query to use 'bips' table instead of bans for the count Use bips as it has the list of all persisted banned IPs. This should fix the incorrect count of banned IPs in the dashboard Signed-off-by: Calvin Hobbes <5r91nrqo@duck.com> --- root/dashboard/swag-f2b.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/root/dashboard/swag-f2b.py b/root/dashboard/swag-f2b.py index c1d144d..d04fac6 100644 --- a/root/dashboard/swag-f2b.py +++ b/root/dashboard/swag-f2b.py @@ -9,12 +9,12 @@ def _get_f2b_data(db_path): con = sqlite3.connect(db_path) cur = con.cursor() results = cur.execute(""" - SELECT jails.name, - COUNT(bans.ip) AS bans, - (SELECT DISTINCT bans.ip from bans where jails.name = bans.jail ORDER BY timeofban DESC) as last_ban, - (SELECT DISTINCT bans.data from bans where jails.name = bans.jail ORDER BY timeofban DESC) as data - FROM jails - LEFT JOIN bans ON jails.name=bans.jail + SELECT jails.name, + COUNT(bips.ip) AS bans, + (SELECT DISTINCT bips.ip from bips where jails.name = bips.jail ORDER BY timeofban DESC) as last_ban, + (SELECT DISTINCT bips.data from bips where jails.name = bips.jail ORDER BY timeofban DESC) as data + FROM jails + LEFT JOIN bips ON jails.name=bips.jail GROUP BY jails.name """).fetchall() con.close()