AP manageur V1.1 (Bêta)
This commit is contained in:
1 parent
bfc0475665
commit
f1b3179a16
5 files changed
+96
-73
No files matched your search
@@ -3990,9 +3990,10 @@ def setup_ap_nat(iface=None):
|
|||||||
|
|
||||||
# Conserver les chaînes prioritaires (blocage quota et isolation VPN) toujours AU-DESSUS de AP_NAT_FORWARD
|
# Conserver les chaînes prioritaires (blocage quota et isolation VPN) toujours AU-DESSUS de AP_NAT_FORWARD
|
||||||
for prio_chain in ('AP_VPN_ISOLATION', 'AP_QUOTA_BLOCK'):
|
for prio_chain in ('AP_VPN_ISOLATION', 'AP_QUOTA_BLOCK'):
|
||||||
if subprocess.run([ipt, '-w', '1', '-C', 'FORWARD', '-j', prio_chain], capture_output=True, timeout=1).returncode == 0:
|
if _ipt_has_chain(ipt, 'filter', prio_chain):
|
||||||
_ipt_del_jump(ipt, 'filter', 'FORWARD', prio_chain)
|
if subprocess.run([ipt, '-w', '1', '-C', 'FORWARD', '-j', prio_chain], capture_output=True, timeout=1).returncode == 0:
|
||||||
subprocess.run([ipt, '-w', '1', '-I', 'FORWARD', '1', '-j', prio_chain], capture_output=True, timeout=1)
|
_ipt_del_jump(ipt, 'filter', 'FORWARD', prio_chain)
|
||||||
|
subprocess.run([ipt, '-w', '1', '-I', 'FORWARD', '1', '-j', prio_chain], capture_output=True, timeout=1)
|
||||||
|
|
||||||
# 2. Chaîne nat POSTROUTING dédiée au mode AP (MASQUERADE vers la passerelle Internet)
|
# 2. Chaîne nat POSTROUTING dédiée au mode AP (MASQUERADE vers la passerelle Internet)
|
||||||
subprocess.run([ipt, '-w', '1', '-t', 'nat', '-N', 'AP_NAT_POST'], capture_output=True, timeout=1)
|
subprocess.run([ipt, '-w', '1', '-t', 'nat', '-N', 'AP_NAT_POST'], capture_output=True, timeout=1)
|
||||||
@@ -5698,68 +5699,81 @@ def sync_client_bandwidth_and_quotas(force=False):
|
|||||||
ebtables_bin = find_bin('ebtables')
|
ebtables_bin = find_bin('ebtables')
|
||||||
if ebtables_bin and (all_blocked_macs or os.path.exists('/sys/module/ebtable_filter')):
|
if ebtables_bin and (all_blocked_macs or os.path.exists('/sys/module/ebtable_filter')):
|
||||||
try:
|
try:
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-N', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
if not all_blocked_macs:
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-F', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
# Si aucun équipement n'est bloqué, nettoyer seulement si la chaîne existe
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-D', 'FORWARD', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
r_eb = subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-L', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-D', 'INPUT', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
if r_eb.returncode == 0:
|
||||||
if all_blocked_macs:
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-D', 'FORWARD', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-I', 'FORWARD', '1', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-D', 'INPUT', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-I', 'INPUT', '1', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-F', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-A', 'AP_QUOTA_BLOCK', '-p', 'ARP', '-j', 'ACCEPT'], capture_output=True, timeout=5)
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-X', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-A', 'AP_QUOTA_BLOCK', '-p', 'IPv4', '--ip-proto', 'udp', '--ip-dport', '67:68', '-j', 'ACCEPT'], capture_output=True, timeout=5)
|
else:
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-A', 'AP_QUOTA_BLOCK', '-p', 'IPv4', '--ip-proto', 'udp', '--ip-sport', '67:68', '-j', 'ACCEPT'], capture_output=True, timeout=5)
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-N', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-F', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
check_fwd = subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-C', 'FORWARD', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
if check_fwd.returncode != 0:
|
||||||
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-I', 'FORWARD', '1', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
check_inp = subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-C', 'INPUT', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
if check_inp.returncode != 0:
|
||||||
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-I', 'INPUT', '1', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-A', 'AP_QUOTA_BLOCK', '-p', 'ARP', '-j', 'ACCEPT'], capture_output=True, timeout=1.5)
|
||||||
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-A', 'AP_QUOTA_BLOCK', '-p', 'IPv4', '--ip-proto', 'udp', '--ip-dport', '67:68', '-j', 'ACCEPT'], capture_output=True, timeout=1.5)
|
||||||
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-A', 'AP_QUOTA_BLOCK', '-p', 'IPv4', '--ip-proto', 'udp', '--ip-sport', '67:68', '-j', 'ACCEPT'], capture_output=True, timeout=1.5)
|
||||||
for b_mac in all_blocked_macs:
|
for b_mac in all_blocked_macs:
|
||||||
cm = b_mac.strip().lower()
|
cm = b_mac.strip().lower()
|
||||||
if cm:
|
if cm:
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-A', 'AP_QUOTA_BLOCK', '-s', cm, '-j', 'DROP'], capture_output=True, timeout=5)
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-A', 'AP_QUOTA_BLOCK', '-s', cm, '-j', 'DROP'], capture_output=True, timeout=1.5)
|
||||||
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-A', 'AP_QUOTA_BLOCK', '-d', cm, '-j', 'DROP'], capture_output=True, timeout=5)
|
subprocess.run([ebtables_bin, '--concurrent', '-t', 'filter', '-A', 'AP_QUOTA_BLOCK', '-d', cm, '-j', 'DROP'], capture_output=True, timeout=1.5)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[ap-limits] Erreur ebtables : {e}", flush=True)
|
print(f"[ap-limits] Erreur ebtables : {e}", flush=True)
|
||||||
|
|
||||||
# 4. Couche 3 (IPv4 & IPv6) : iptables et ip6tables (filter & mangle avec verrou -w 5 et test -C)
|
# 4. Couche 3 (IPv4 & IPv6) : iptables et ip6tables (optimisé avec _ipt_has_chain et verrou léger)
|
||||||
iptables_bin = find_bin('iptables')
|
iptables_bin = find_bin('iptables')
|
||||||
ip6tables_bin = find_bin('ip6tables')
|
ip6tables_bin = find_bin('ip6tables')
|
||||||
for bin_cmd, is_v6 in [(iptables_bin, False), (ip6tables_bin, True)]:
|
for bin_cmd, is_v6 in [(iptables_bin, False), (ip6tables_bin, True)]:
|
||||||
if not bin_cmd: continue
|
if not bin_cmd: continue
|
||||||
try:
|
try:
|
||||||
for tbl, chain in [('filter', 'FORWARD'), ('filter', 'INPUT'), ('mangle', 'PREROUTING')]:
|
target_chains = [('filter', 'FORWARD'), ('filter', 'INPUT'), ('mangle', 'PREROUTING')]
|
||||||
# Créer et vider la chaîne
|
if not all_blocked_macs:
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-N', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
# Si aucun équipement n'est bloqué : ne toucher aux tables que si AP_QUOTA_BLOCK existe
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-F', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
for tbl in ('filter', 'mangle'):
|
||||||
|
if _ipt_has_chain(bin_cmd, tbl, 'AP_QUOTA_BLOCK'):
|
||||||
|
for t_tbl, chain in target_chains:
|
||||||
|
if t_tbl == tbl:
|
||||||
|
_ipt_del_jump(bin_cmd, tbl, chain, 'AP_QUOTA_BLOCK')
|
||||||
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-F', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-X', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
else:
|
||||||
|
for tbl, chain in target_chains:
|
||||||
|
if not _ipt_has_chain(bin_cmd, tbl, 'AP_QUOTA_BLOCK'):
|
||||||
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-N', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-F', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
|
||||||
# Vérifier si la règle de saut existe
|
check_r = subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-C', chain, '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
check_r = subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-C', chain, '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
if check_r.returncode != 0:
|
||||||
has_jump = (check_r.returncode == 0)
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-I', chain, '1', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=1.5)
|
||||||
|
|
||||||
if all_blocked_macs:
|
|
||||||
if not has_jump:
|
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-I', chain, '1', '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
|
||||||
else:
|
|
||||||
if has_jump:
|
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-D', chain, '-j', 'AP_QUOTA_BLOCK'], capture_output=True, timeout=5)
|
|
||||||
|
|
||||||
if all_blocked_macs:
|
|
||||||
if not is_v6:
|
if not is_v6:
|
||||||
for tbl in ['filter', 'mangle']:
|
for tbl in ['filter', 'mangle']:
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-p', 'udp', '--dport', '67:68', '-j', 'RETURN'], capture_output=True, timeout=5)
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-p', 'udp', '--dport', '67:68', '-j', 'RETURN'], capture_output=True, timeout=1.5)
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-p', 'udp', '--sport', '67:68', '-j', 'RETURN'], capture_output=True, timeout=5)
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-p', 'udp', '--sport', '67:68', '-j', 'RETURN'], capture_output=True, timeout=1.5)
|
||||||
else:
|
else:
|
||||||
for tbl in ['filter', 'mangle']:
|
for tbl in ['filter', 'mangle']:
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-p', 'udp', '--dport', '546:547', '-j', 'RETURN'], capture_output=True, timeout=5)
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-p', 'udp', '--dport', '546:547', '-j', 'RETURN'], capture_output=True, timeout=1.5)
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-p', 'udp', '--sport', '546:547', '-j', 'RETURN'], capture_output=True, timeout=5)
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-p', 'udp', '--sport', '546:547', '-j', 'RETURN'], capture_output=True, timeout=1.5)
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-p', 'ipv6-icmp', '-j', 'RETURN'], capture_output=True, timeout=5)
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-p', 'ipv6-icmp', '-j', 'RETURN'], capture_output=True, timeout=1.5)
|
||||||
|
|
||||||
for b_mac in all_blocked_macs:
|
for b_mac in all_blocked_macs:
|
||||||
cm = b_mac.strip().lower()
|
cm = b_mac.strip().lower()
|
||||||
if cm:
|
if cm:
|
||||||
for tbl in ['filter', 'mangle']:
|
for tbl in ['filter', 'mangle']:
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-m', 'mac', '--mac-source', cm, '-j', 'DROP'], capture_output=True, timeout=5)
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-m', 'mac', '--mac-source', cm, '-j', 'DROP'], capture_output=True, timeout=1.5)
|
||||||
if not is_v6:
|
if not is_v6:
|
||||||
ip = mac_to_ip.get(b_mac)
|
ip = mac_to_ip.get(b_mac)
|
||||||
if ip and ip not in ('Non attribuée', '—'):
|
if ip and ip not in ('Non attribuée', '—'):
|
||||||
for tbl in ['filter', 'mangle']:
|
for tbl in ['filter', 'mangle']:
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-s', ip, '-j', 'DROP'], capture_output=True, timeout=5)
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-s', ip, '-j', 'DROP'], capture_output=True, timeout=1.5)
|
||||||
subprocess.run([bin_cmd, '-w', '5', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-d', ip, '-j', 'DROP'], capture_output=True, timeout=5)
|
subprocess.run([bin_cmd, '-w', '1', '-t', tbl, '-A', 'AP_QUOTA_BLOCK', '-d', ip, '-j', 'DROP'], capture_output=True, timeout=1.5)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[ap-limits] Erreur iptables/ip6tables ({bin_cmd}) : {e}", flush=True)
|
print(f"[ap-limits] Erreur iptables/ip6tables ({bin_cmd}) : {e}", flush=True)
|
||||||
|
|
||||||
@@ -11828,6 +11842,9 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
body=open(os.path.join(os.path.dirname(__file__),'index.html'),'rb').read()
|
body=open(os.path.join(os.path.dirname(__file__),'index.html'),'rb').read()
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-Type','text/html; charset=utf-8')
|
self.send_header('Content-Type','text/html; charset=utf-8')
|
||||||
|
self.send_header('Cache-Control','no-cache, no-store, must-revalidate')
|
||||||
|
self.send_header('Pragma','no-cache')
|
||||||
|
self.send_header('Expires','0')
|
||||||
self.send_header('Content-Length',str(len(body)))
|
self.send_header('Content-Length',str(len(body)))
|
||||||
self.send_header('X-Content-Type-Options','nosniff')
|
self.send_header('X-Content-Type-Options','nosniff')
|
||||||
self.send_header('X-Frame-Options','SAMEORIGIN')
|
self.send_header('X-Frame-Options','SAMEORIGIN')
|
||||||
@@ -11841,6 +11858,9 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
body = open(os.path.join(os.path.dirname(__file__), 'setup.html'), 'rb').read()
|
body = open(os.path.join(os.path.dirname(__file__), 'setup.html'), 'rb').read()
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-Type', 'text/html; charset=utf-8')
|
self.send_header('Content-Type', 'text/html; charset=utf-8')
|
||||||
|
self.send_header('Cache-Control','no-cache, no-store, must-revalidate')
|
||||||
|
self.send_header('Pragma','no-cache')
|
||||||
|
self.send_header('Expires','0')
|
||||||
self.send_header('Content-Length', str(len(body)))
|
self.send_header('Content-Length', str(len(body)))
|
||||||
self.send_header('X-Content-Type-Options','nosniff')
|
self.send_header('X-Content-Type-Options','nosniff')
|
||||||
self.send_header('X-Frame-Options','SAMEORIGIN')
|
self.send_header('X-Frame-Options','SAMEORIGIN')
|
||||||
@@ -11859,7 +11879,9 @@ class Handler(BaseHTTPRequestHandler):
|
|||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-Type', 'application/javascript; charset=utf-8')
|
self.send_header('Content-Type', 'application/javascript; charset=utf-8')
|
||||||
self.send_header('Content-Length', str(len(body)))
|
self.send_header('Content-Length', str(len(body)))
|
||||||
self.send_header('Cache-Control', 'public, max-age=3600')
|
self.send_header('Cache-Control', 'no-cache, no-store, must-revalidate')
|
||||||
|
self.send_header('Pragma', 'no-cache')
|
||||||
|
self.send_header('Expires', '0')
|
||||||
self.send_header('X-Content-Type-Options', 'nosniff')
|
self.send_header('X-Content-Type-Options', 'nosniff')
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(body)
|
self.wfile.write(body)
|
||||||
|
|||||||
+28
-30
@@ -3198,6 +3198,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card">
|
<div class="card">
|
||||||
|
<div id="captureWifiNotice" style="display:none;background:rgba(239,68,68,0.12);border:1px solid rgba(239,68,68,0.3);color:var(--red);padding:10px 14px;border-radius:8px;margin-bottom:14px;font-size:13px;align-items:center;gap:10px">
|
||||||
|
<span style="font-size:16px">⚠️</span>
|
||||||
|
<span data-i18n="adv_pcap_wifi_notice">Le point d’accès Wi-Fi est inactif. L’analyse et la capture de trames réseau sont désactivées tant que le Wi-Fi n’est pas démarré.</span>
|
||||||
|
</div>
|
||||||
<div class="topline" style="flex-wrap:wrap;gap:12px;margin-bottom:12px">
|
<div class="topline" style="flex-wrap:wrap;gap:12px;margin-bottom:12px">
|
||||||
<div>
|
<div>
|
||||||
<h2 style="margin:0 0 4px" data-i18n="adv_pcap_title">Analyseur Réseau Wi-Fi (Wireshark)</h2>
|
<h2 style="margin:0 0 4px" data-i18n="adv_pcap_title">Analyseur Réseau Wi-Fi (Wireshark)</h2>
|
||||||
@@ -9426,14 +9430,6 @@ ${vpnBadgeTopo}
|
|||||||
const icon = getDeviceTypeIcon(client.device_type);
|
const icon = getDeviceTypeIcon(client.device_type);
|
||||||
const nameEsc = String(client.name || t('client_unknown', 'Client inconnu')).replace(/[&<>"']/g, ch => '&#' + ch.charCodeAt(0) + ';');
|
const nameEsc = String(client.name || t('client_unknown', 'Client inconnu')).replace(/[&<>"']/g, ch => '&#' + ch.charCodeAt(0) + ';');
|
||||||
const ipEsc = String(client.ip || '—').replace(/[&<>"']/g, ch => '&#' + ch.charCodeAt(0) + ';');
|
const ipEsc = String(client.ip || '—').replace(/[&<>"']/g, ch => '&#' + ch.charCodeAt(0) + ';');
|
||||||
const macEsc = String(client.mac || '—').replace(/[&<>"']/g, ch => '&#' + ch.charCodeAt(0) + ';');
|
|
||||||
const sigDbm = client.signal_dbm !== null && client.signal_dbm !== undefined ? client.signal_dbm : null;
|
|
||||||
let sigColor = 'var(--red)';
|
|
||||||
if (sigDbm !== null) {
|
|
||||||
if (sigDbm >= -50) sigColor = 'var(--green)';
|
|
||||||
else if (sigDbm >= -60) sigColor = '#68d391';
|
|
||||||
else if (sigDbm >= -70) sigColor = '#f6ad55';
|
|
||||||
}
|
|
||||||
const clientVpnDesc = client.vpn_profile_name ? (client.vpn_routed ? `<div style="display:flex;align-items:center;gap:6px;flex-wrap:wrap"><span style="display:inline-flex;align-items:center">${typeof VPN_LOGOS !== 'undefined' && VPN_LOGOS[client.vpn_profile_type] ? VPN_LOGOS[client.vpn_profile_type] : '🛡️'}</span> <strong>${escapeHtml(client.vpn_profile_name)}</strong> ${client.vpn_public_ip ? (typeof formatIpWithGeo === 'function' ? formatIpWithGeo(client.vpn_public_ip, client.vpn_public_ip_geo) : `<code>${escapeHtml(client.vpn_public_ip)}</code>`) : ''}</div>` : `⚠️ ${escapeHtml(client.vpn_profile_name)} ${t('vpn_status_disconnected_short', '(Coupé)')}`) : ('🌐 ' + t('topo_direct_wan', 'Direct WAN (Box)'));
|
const clientVpnDesc = client.vpn_profile_name ? (client.vpn_routed ? `<div style="display:flex;align-items:center;gap:6px;flex-wrap:wrap"><span style="display:inline-flex;align-items:center">${typeof VPN_LOGOS !== 'undefined' && VPN_LOGOS[client.vpn_profile_type] ? VPN_LOGOS[client.vpn_profile_type] : '🛡️'}</span> <strong>${escapeHtml(client.vpn_profile_name)}</strong> ${client.vpn_public_ip ? (typeof formatIpWithGeo === 'function' ? formatIpWithGeo(client.vpn_public_ip, client.vpn_public_ip_geo) : `<code>${escapeHtml(client.vpn_public_ip)}</code>`) : ''}</div>` : `⚠️ ${escapeHtml(client.vpn_profile_name)} ${t('vpn_status_disconnected_short', '(Coupé)')}`) : ('🌐 ' + t('topo_direct_wan', 'Direct WAN (Box)'));
|
||||||
title.innerHTML = `<span>${icon}</span> ${t('topo_modal_dev_details', 'Détails de l’équipement : {name}').replace('{name}', nameEsc)} <span class="pill pill-green pill-no-dot" style="font-size:11px;margin-left:auto">${t('topo_modal_live_badge', 'En direct')}</span>`;
|
title.innerHTML = `<span>${icon}</span> ${t('topo_modal_dev_details', 'Détails de l’équipement : {name}').replace('{name}', nameEsc)} <span class="pill pill-green pill-no-dot" style="font-size:11px;margin-left:auto">${t('topo_modal_live_badge', 'En direct')}</span>`;
|
||||||
body.innerHTML = `
|
body.innerHTML = `
|
||||||
@@ -9724,6 +9720,27 @@ ${vpnBadgeTopo}
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateCaptureControlsState() {
|
||||||
|
const isWifiActive = !!(status && status.active);
|
||||||
|
const startBtn = $('startCaptureBtn');
|
||||||
|
const stopBtn = $('stopCaptureBtn');
|
||||||
|
const notice = $('captureWifiNotice');
|
||||||
|
if (notice) {
|
||||||
|
notice.style.display = isWifiActive ? 'none' : 'flex';
|
||||||
|
}
|
||||||
|
if (startBtn) {
|
||||||
|
startBtn.style.display = captureRunning ? 'none' : '';
|
||||||
|
startBtn.disabled = !isWifiActive;
|
||||||
|
startBtn.style.opacity = isWifiActive ? '1' : '0.45';
|
||||||
|
startBtn.style.cursor = isWifiActive ? 'pointer' : 'not-allowed';
|
||||||
|
startBtn.style.filter = isWifiActive ? 'none' : 'grayscale(0.85)';
|
||||||
|
startBtn.title = isWifiActive ? '' : t('adv_pcap_wifi_required', "Le Wi-Fi est coupé : démarrez le point d’accès pour lancer l’analyse des trames");
|
||||||
|
}
|
||||||
|
if (stopBtn) {
|
||||||
|
stopBtn.style.display = captureRunning ? 'inline-flex' : 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateApButtons() {
|
function updateApButtons() {
|
||||||
const active = !!(status && status.active), configured = !!(status && status.configured);
|
const active = !!(status && status.active), configured = !!(status && status.configured);
|
||||||
if ($('dashboardView')) $('dashboardView').classList.toggle('active', currentTab === 'dashboard');
|
if ($('dashboardView')) $('dashboardView').classList.toggle('active', currentTab === 'dashboard');
|
||||||
@@ -9804,15 +9821,7 @@ ${vpnBadgeTopo}
|
|||||||
$('btnUpdateAvailable').style.display = (configured && updateAvailable) ? 'inline-flex' : 'none';
|
$('btnUpdateAvailable').style.display = (configured && updateAvailable) ? 'inline-flex' : 'none';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('startCaptureBtn')) {
|
updateCaptureControlsState();
|
||||||
const isWifiActive = !!(status && status.active);
|
|
||||||
if (!captureRunning) {
|
|
||||||
$('startCaptureBtn').disabled = !isWifiActive;
|
|
||||||
$('startCaptureBtn').style.opacity = isWifiActive ? '' : '0.45';
|
|
||||||
$('startCaptureBtn').style.cursor = isWifiActive ? 'pointer' : 'not-allowed';
|
|
||||||
$('startCaptureBtn').title = isWifiActive ? '' : t('adv_pcap_wifi_required', "Le Wi-Fi est coupé : démarrez le point d’accès pour lancer l’analyse des trames");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let lastUpdateData = null;
|
let lastUpdateData = null;
|
||||||
@@ -11944,19 +11953,7 @@ ${vpnBadgeTopo}
|
|||||||
$('captureBufferSize').textContent = (capturePackets.length || buf) + ' ' + keptWord;
|
$('captureBufferSize').textContent = (capturePackets.length || buf) + ' ' + keptWord;
|
||||||
$('capturePcapSize').textContent = formatBytes(pcapSz);
|
$('capturePcapSize').textContent = formatBytes(pcapSz);
|
||||||
if ($('captureDomainsCount')) $('captureDomainsCount').textContent = d.unique_domains_count !== undefined ? d.unique_domains_count : (d.domains ? d.domains.length : 0);
|
if ($('captureDomainsCount')) $('captureDomainsCount').textContent = d.unique_domains_count !== undefined ? d.unique_domains_count : (d.domains ? d.domains.length : 0);
|
||||||
const isWifiActive = !!(status && status.active);
|
updateCaptureControlsState();
|
||||||
const startBtn = $('startCaptureBtn');
|
|
||||||
const stopBtn = $('stopCaptureBtn');
|
|
||||||
if (startBtn) {
|
|
||||||
startBtn.style.display = captureRunning ? 'none' : '';
|
|
||||||
startBtn.disabled = !isWifiActive;
|
|
||||||
startBtn.style.opacity = isWifiActive ? '' : '0.45';
|
|
||||||
startBtn.style.cursor = isWifiActive ? 'pointer' : 'not-allowed';
|
|
||||||
startBtn.title = isWifiActive ? '' : t('adv_pcap_wifi_required', "Le Wi-Fi est coupé : démarrez le point d’accès pour lancer l’analyse des trames");
|
|
||||||
}
|
|
||||||
if (stopBtn) {
|
|
||||||
stopBtn.style.display = captureRunning ? 'inline-flex' : 'none';
|
|
||||||
}
|
|
||||||
if ($('statDns')) $('statDns').textContent = captureStats.dns || 0;
|
if ($('statDns')) $('statDns').textContent = captureStats.dns || 0;
|
||||||
if ($('statIcmp')) $('statIcmp').textContent = captureStats.icmp || 0;
|
if ($('statIcmp')) $('statIcmp').textContent = captureStats.icmp || 0;
|
||||||
if ($('statTcp')) $('statTcp').textContent = captureStats.tcp || 0;
|
if ($('statTcp')) $('statTcp').textContent = captureStats.tcp || 0;
|
||||||
@@ -16096,6 +16093,7 @@ ${vpnBadgeTopo}
|
|||||||
loadVpnClients();
|
loadVpnClients();
|
||||||
stopCaptureTimer();
|
stopCaptureTimer();
|
||||||
} else {
|
} else {
|
||||||
|
updateCaptureControlsState();
|
||||||
loadCaptureStatus();
|
loadCaptureStatus();
|
||||||
loadCapturePackets(true);
|
loadCapturePackets(true);
|
||||||
ensureCapturePolling();
|
ensureCapturePolling();
|
||||||
|
|||||||
+2
-1
@@ -1463,5 +1463,6 @@ window.I18N['en-gb'] = {
|
|||||||
"confirm_save_settings_restart": "Modifying Wi-Fi settings will restart the access point.\n\nAll connected devices will be temporarily disconnected.\nThis operation may take several minutes.\n\nDo you want to continue?",
|
"confirm_save_settings_restart": "Modifying Wi-Fi settings will restart the access point.\n\nAll connected devices will be temporarily disconnected.\nThis operation may take several minutes.\n\nDo you want to continue?",
|
||||||
"settings_restarting_warning": "Restarting: this operation may take several minutes…",
|
"settings_restarting_warning": "Restarting: this operation may take several minutes…",
|
||||||
"settings_saved_restarted": "Settings saved and access point restarted successfully!",
|
"settings_saved_restarted": "Settings saved and access point restarted successfully!",
|
||||||
"adv_pcap_wifi_required": "Wi-Fi is turned off: start the access point to launch packet analysis"
|
"adv_pcap_wifi_required": "Wi-Fi is turned off: start the access point to launch packet analysis",
|
||||||
|
"adv_pcap_wifi_notice": "The Wi-Fi access point is inactive. Network packet capture and analysis are disabled until Wi-Fi is started."
|
||||||
};
|
};
|
||||||
+2
-1
@@ -1463,5 +1463,6 @@ window.I18N['en-us'] = {
|
|||||||
"confirm_save_settings_restart": "Modifying Wi-Fi settings will restart the access point.\n\nAll connected devices will be temporarily disconnected.\nThis operation may take several minutes.\n\nDo you want to continue?",
|
"confirm_save_settings_restart": "Modifying Wi-Fi settings will restart the access point.\n\nAll connected devices will be temporarily disconnected.\nThis operation may take several minutes.\n\nDo you want to continue?",
|
||||||
"settings_restarting_warning": "Restarting: this operation may take several minutes…",
|
"settings_restarting_warning": "Restarting: this operation may take several minutes…",
|
||||||
"settings_saved_restarted": "Settings saved and access point restarted successfully!",
|
"settings_saved_restarted": "Settings saved and access point restarted successfully!",
|
||||||
"adv_pcap_wifi_required": "Wi-Fi is turned off: start the access point to launch packet analysis"
|
"adv_pcap_wifi_required": "Wi-Fi is turned off: start the access point to launch packet analysis",
|
||||||
|
"adv_pcap_wifi_notice": "The Wi-Fi access point is inactive. Network packet capture and analysis are disabled until Wi-Fi is started."
|
||||||
};
|
};
|
||||||
+2
-1
@@ -1463,5 +1463,6 @@ window.I18N['fr'] = {
|
|||||||
"confirm_save_settings_restart": "La modification des réglages Wi-Fi va redémarrer le point d’accès.\n\nTous les appareils connectés seront temporairement déconnectés.\nCette opération peut durer plusieurs minutes.\n\nSouhaitez-vous continuer ?",
|
"confirm_save_settings_restart": "La modification des réglages Wi-Fi va redémarrer le point d’accès.\n\nTous les appareils connectés seront temporairement déconnectés.\nCette opération peut durer plusieurs minutes.\n\nSouhaitez-vous continuer ?",
|
||||||
"settings_restarting_warning": "Redémarrage : cette opération peut durer plusieurs minutes…",
|
"settings_restarting_warning": "Redémarrage : cette opération peut durer plusieurs minutes…",
|
||||||
"settings_saved_restarted": "Réglages enregistrés et point d’accès redémarré avec succès !",
|
"settings_saved_restarted": "Réglages enregistrés et point d’accès redémarré avec succès !",
|
||||||
"adv_pcap_wifi_required": "Le Wi-Fi est coupé : démarrez le point d’accès pour lancer l’analyse des trames"
|
"adv_pcap_wifi_required": "Le Wi-Fi est coupé : démarrez le point d’accès pour lancer l’analyse des trames",
|
||||||
|
"adv_pcap_wifi_notice": "Le point d’accès Wi-Fi est inactif. L’analyse et la capture de trames réseau sont désactivées tant que le Wi-Fi n’est pas démarré."
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user