mirror of
https://github.com/CyberMind-FR/secubox-deb.git
synced 2026-07-29 13:59:40 +00:00
feat(toolbox): splice autolearn mirrors into webui MITM filter list; rename WAF Filters → Filtres MITM
- secubox-toolbox-autolearn now mirrors each splice-learned host into
mitm-bypass-dynamic.conf (the Filtres MITM '🔍 learned' source) as bypass
regex, so autolearned splice hosts are visible + editable in the webui and
honoured on the ignore_hosts path. Merge (never clobbers operator entries).
- secubox-mitmproxy filters.html: 'WAF Filters' → 'Filtres MITM' (title/h1/desc);
API path /api/v1/mitmproxy/waf unchanged.
This commit is contained in:
parent
eddc1af372
commit
872be8c77b
|
|
@ -3,7 +3,7 @@
|
|||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>SecuBox - WAF Filters</title>
|
||||
<title>SecuBox - Filtres MITM</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Courier+Prime:wght@400;700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/shared/crt-light.css">
|
||||
|
|
@ -250,12 +250,12 @@
|
|||
|
||||
<main class="main">
|
||||
<header class="header">
|
||||
<h1>WAF Filters</h1>
|
||||
<h1>Filtres MITM</h1>
|
||||
<a href="index.html" class="btn">Back to Dashboard</a>
|
||||
</header>
|
||||
|
||||
<p style="color: var(--text-dim); margin-bottom: 1.5rem;">
|
||||
Manage WAF rule categories. Toggle filters on/off to control threat detection.
|
||||
Manage MITM rule categories. Toggle filters on/off to control threat detection.
|
||||
</p>
|
||||
|
||||
<div id="loading" class="loading">Loading filters...</div>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ PURE_OUT = os.environ.get("SECUBOX_AUTOLEARN_PURE_OUT",
|
|||
SPLICE_LEARNED_OUT = os.environ.get(
|
||||
"SECUBOX_SPLICE_LEARNED_OUT",
|
||||
"/var/lib/secubox/toolbox/splice-learned.txt")
|
||||
# The webui Filtres MITM "🔍 learned" source — splice-learned hosts are mirrored
|
||||
# here as bypass regex so they show up + are honoured on the ignore_hosts path.
|
||||
BYPASS_DYNAMIC_OUT = os.environ.get(
|
||||
"SECUBOX_BYPASS_DYNAMIC",
|
||||
"/var/lib/secubox/toolbox/mitm-bypass-dynamic.conf")
|
||||
SPLICE_MIN_HITS = int(os.environ.get("SECUBOX_SPLICE_MIN_HITS", "20"))
|
||||
SPLICE_MAX = 2000
|
||||
MIN_SITES = 2 # cross-site threshold for operator-grade trackers
|
||||
|
|
@ -157,6 +162,31 @@ def _splice_feed() -> int:
|
|||
except Exception as e:
|
||||
sys.stderr.write(f"autolearn: splice write failed: {e}\n")
|
||||
return -1
|
||||
# Mirror into the webui MITM filter list (the "🔍 learned" source shown in
|
||||
# Filtres MITM), as bypass regex, so a splice-learned host is ALSO visible +
|
||||
# editable in the webui and honoured by the ignore_hosts path. Merge, never
|
||||
# clobber operator/other-autolearn entries. Best-effort — never fails the run.
|
||||
try:
|
||||
import re as _re
|
||||
want = {"(.+\\.)?" + _re.escape(h) for h in hosts}
|
||||
existing, keep = set(), []
|
||||
try:
|
||||
for ln in open(BYPASS_DYNAMIC_OUT, encoding="utf-8"):
|
||||
keep.append(ln.rstrip("\n"))
|
||||
s = ln.split("#", 1)[0].strip()
|
||||
if s:
|
||||
existing.add(s)
|
||||
except OSError:
|
||||
pass
|
||||
add = sorted(want - existing)
|
||||
if add:
|
||||
os.makedirs(os.path.dirname(BYPASS_DYNAMIC_OUT), exist_ok=True)
|
||||
btmp = BYPASS_DYNAMIC_OUT + ".tmp"
|
||||
with open(btmp, "w", encoding="utf-8") as fh:
|
||||
fh.write("\n".join(keep + add).strip("\n") + "\n")
|
||||
os.replace(btmp, BYPASS_DYNAMIC_OUT)
|
||||
except Exception as e:
|
||||
sys.stderr.write(f"autolearn: bypass-dynamic mirror failed: {e}\n")
|
||||
return len(hosts)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user