MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / openWifiConnectModal

Function openWifiConnectModal

web/scripts/ragnar_modern.js:9374–9423  ·  view source on GitHub ↗
(ssid, isKnown, isSecure, editMode)

Source from the content-addressed store, hash-verified

9372 } catch (e) {
9373 if (out) out.innerHTML = '<span class="text-red-400">Error: ' + escapeHtml(e.message) + '</span>';
9374 }
9375}
9376async function dellGuardAction(action, btn) {
9377 const out = document.getElementById('dell-guard-status');
9378 const sel = document.getElementById('dell-guard-iface');
9379 const iface = sel && sel.value ? sel.value : '';
9380 if (!iface) { if (out) out.innerHTML = '<span class="text-amber-300">Select an interface first.</span>'; return; }
9381 const labels = { baseline: 'Starting 24h baseline…', enforce: 'Enabling enforcement…', disable: 'Disabling…' };
9382 _ndBusy(btn, true, labels[action] || 'Working…');
9383 if (out) out.innerHTML = '<span class="text-gray-500">' + escapeHtml(labels[action] || 'Working…') + '</span>';
9384 try {
9385 const d = await postAPI('/api/net/dell-guard', { action: action, interface: iface });
9386 if (out) out.innerHTML = _dellGuardRender(d);
9387 } catch (e) {
9388 if (out) out.innerHTML = '<span class="text-red-400">Error: ' + escapeHtml(e.message) + '</span>';
9389 } finally {
9390 _ndBusy(btn, false);
9391 }
9392}
9393
9394// ---- ICMP Watch (passive ICMP-redirect / L3 route injection) ---------------
9395const _ICMP_VERDICT_STYLE = {
9396 clean: ['bg-green-950/40 border-green-900 text-green-400', '✓ No ICMP redirects / injections / floods detected'],
9397 anomaly: ['bg-amber-950/50 border-amber-800 text-amber-300', '⚠ ICMP anomaly — a redirect/IRDP from a known gateway (verify)'],
9398 recon: ['bg-amber-950/50 border-amber-800 text-amber-300', '⚠ ICMP reconnaissance — timestamp / address-mask / info requests'],
9399 tunnel: ['bg-amber-950/50 border-amber-800 text-amber-300', '⚠ ICMP tunnelling — oversized echo payloads (covert channel / exfil)'],
9400 flood: ['bg-red-950/60 border-red-800 text-red-300', '🛑 ICMP flood — ping-flood / smurf DoS'],
9401 'rogue-irdp': ['bg-red-950/60 border-red-800 text-red-300', '🛑 Rogue IRDP router advertisement — gateway injection'],
9402 redirect: ['bg-red-950/60 border-red-800 text-red-300', '🛑 ICMP Redirect — Layer-3 man-in-the-middle (route injection)'],
9403 unknown: ['bg-slate-800 border-slate-700 text-slate-400', '— Could not determine'],
9404};
9405function _icmpFillIfaces() {
9406 const sel = document.getElementById('icmp-iface');
9407 if (!sel || sel.dataset.filled === '1') return Promise.resolve();
9408 return fetchAPI('/api/net/interfaces').then(x => {
9409 (x.interfaces || []).forEach(i => {
9410 const o = document.createElement('option');
9411 o.value = i.name;
9412 const tag = i.type === 'wifi' ? ' (WiFi)' : i.type === 'ethernet' ? ' (LAN)' : (i.type ? ' (' + i.type + ')' : '');
9413 o.textContent = i.name + tag;
9414 sel.appendChild(o);
9415 });
9416 sel.dataset.filled = '1';
9417 }).catch(() => {});
9418}
9419async function runIcmpWatch() {
9420 const out = document.getElementById('icmp-results');
9421 if (!out) return;
9422 const btn = (typeof event !== 'undefined' && event && event.target) ? event.target : null;
9423 const ifaceSel = document.getElementById('icmp-iface');
9424 const iface = ifaceSel && ifaceSel.value ? ifaceSel.value : '';
9425 const secsEl = document.getElementById('icmp-secs');
9426 const secs = secsEl && secsEl.value ? secsEl.value : '12';

Callers

nothing calls this directly

Calls 1

addMethod · 0.80

Tested by

no test coverage detected