From 6e98117126eee34a89619e9e39deba6102ddf44b Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 26 Jan 2026 03:30:42 +0000 Subject: [PATCH] fix: add cscli decision list check for LAPI threat-agent --- auditor.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/auditor.py b/auditor.py index 477c697..b756e66 100644 --- a/auditor.py +++ b/auditor.py @@ -14,6 +14,22 @@ class FirewallAuditor: self.table = "crowdsec" self.set_name = "0.0.0.0/0-cscli" + def get_remote_lapi_truth(self): + """Triton-only: Queries local DB via cscli""" + try: + cmd = ["/usr/bin/cscli", "decisions", "list", "-a", "-o", "json"] + res = subprocess.run(cmd, capture_output=True, text=True, check=True) + data = json.loads(res.stdout) or [] + + return { + d["value"]: d.get("duration") + for d in data + if isinstance(d, dict) and d.get("origin") != "CAPI" + } + except Exception as e: + logging.error(f"Failed to get LAPI truth: {e}") + return {} + def get_kernel_state(self): """Scans BOTH IPv4 and IPv6 sets in the crowdsec tables.""" all_ips = {} # Changed from set() to {}