diff --git a/package/secubox/secubox-app-streamlit/files/usr/share/streamlit/secubox_control.py b/package/secubox/secubox-app-streamlit/files/usr/share/streamlit/secubox_control.py index 9f85c125..fde3bd99 100644 --- a/package/secubox/secubox-app-streamlit/files/usr/share/streamlit/secubox_control.py +++ b/package/secubox/secubox-app-streamlit/files/usr/share/streamlit/secubox_control.py @@ -75,6 +75,8 @@ def get_data(): cs = read_cache("/tmp/secubox/crowdsec.json") mitm = read_cache("/tmp/secubox/mitmproxy.json") netif = read_cache("/tmp/secubox/netifyd.json") + waf = read_cache("/tmp/secubox/waf-stats.json") + cs_detail = read_cache("/tmp/secubox/crowdsec-overview.json") modules = status.get("modules", {}) resources = status.get("resources", {}) @@ -96,6 +98,13 @@ def get_data(): d["mitm_threats"] = mitm.get("threats_today", 0) d["netifyd"] = netif.get("running", 0) == 1 + # Enhanced WAF/threat stats + d["waf_threats"] = waf.get("threats_today", 0) + d["waf_autobans"] = waf.get("autobans_total", 0) + d["waf_pending"] = waf.get("autobans_pending", 0) + d["active_bans"] = cs_detail.get("active_bans", 0) + d["total_decisions"] = cs_detail.get("total_decisions", 0) + d["p_haproxy"] = 3 if d["haproxy"] else 10 d["p_crowdsec"] = 3 if d["crowdsec"] and d["cs_alerts"] == 0 else 7 if d["cs_alerts"] > 0 else 10 d["p_mitmproxy"] = 3 if d["mitmproxy"] else 6 @@ -103,6 +112,8 @@ def get_data(): d["led1"] = rgb_hex(0, 255 if d["score"] > 50 else 0, 0) if d["score"] > 80 else rgb_hex(255, 165, 0) if d["score"] > 50 else rgb_hex(255, 0, 0) d["led2"] = rgb_hex(0, 255, 0) if d["threat"] < 10 else rgb_hex(255, 165, 0) if d["threat"] < 50 else rgb_hex(255, 0, 0) d["led3"] = rgb_hex(0, 255, 0) if d["cpu"] < 60 else rgb_hex(255, 165, 0) if d["cpu"] < 85 else rgb_hex(255, 0, 0) + # LED4: Bans indicator + d["led4"] = rgb_hex(255, 0, 0) if d["active_bans"] > 5 else rgb_hex(255, 165, 0) if d["active_bans"] > 0 else rgb_hex(0, 255, 0) return d @@ -119,6 +130,7 @@ def main():