()
| 9782 | d.advisories.map(a => '<li>' + escapeHtml(a) + '</li>').join('') + '</ul>'; |
| 9783 | } |
| 9784 | out.innerHTML = html; |
| 9785 | } catch (e) { |
| 9786 | out.innerHTML = '<p class="text-sm text-red-400">Failed: ' + escapeHtml(e.message) + '</p>'; |
| 9787 | } finally { |
| 9788 | _ndBusy(btn, false); |
| 9789 | } |
| 9790 | } |
| 9791 | async function certTrustBaseline() { |
| 9792 | try { |
| 9793 | await postAPI('/api/net/cert-baseline', { action: 'reset' }); |
| 9794 | addConsoleMessage('TLS cert-fingerprint baseline reset — re-learning on the next scan', 'info'); |
| 9795 | await runCertWatch(); |
| 9796 | } catch (e) { |
| 9797 | addConsoleMessage('Failed to reset TLS baseline: ' + e.message, 'error'); |
| 9798 | } |
| 9799 | } |
| 9800 | |
| 9801 | // ---- OSPF Security Scanner (passive) --------------------------------------- |
| 9802 | const _OSPF_VERDICT_STYLE = { |
| 9803 | clean: ['bg-green-950/40 border-green-900 text-green-400', '✓ No OSPF anomalies detected'], |
| 9804 | weak_auth: ['bg-amber-950/50 border-amber-800 text-amber-300', '⚠ Weak / no OSPF authentication — exposed to LSA injection'], |
| 9805 | anomaly: ['bg-amber-950/50 border-amber-800 text-amber-300', '⚠ OSPF anomaly — rogue router / Router-ID conflict / mismatch'], |
| 9806 | injection: ['bg-red-950/60 border-red-800 text-red-300', '🛑 OSPF LSA injection / route poisoning detected'], |
| 9807 | storm: ['bg-red-950/60 border-red-800 text-red-300', '🛑 OSPF flooding storm detected'], |
| 9808 | unknown: ['bg-slate-800 border-slate-700 text-slate-400', '— Could not determine'], |
| 9809 | }; |
| 9810 | const _OSPF_AUTH_NAME = { 0: 'none (0)', 1: 'plaintext (1)', 2: 'cryptographic (2)' }; |
| 9811 | function _ospfFillIfaces() { |
| 9812 | const sel = document.getElementById('ospf-iface'); |
| 9813 | if (!sel || sel.dataset.filled === '1') return Promise.resolve(); |
| 9814 | return fetchAPI('/api/net/interfaces').then(x => { |
| 9815 | (x.interfaces || []).forEach(i => { |
| 9816 | const o = document.createElement('option'); |
| 9817 | o.value = i.name; |
| 9818 | const tag = i.type === 'wifi' ? ' (WiFi)' : i.type === 'ethernet' ? ' (LAN)' : (i.type ? ' (' + i.type + ')' : ''); |
| 9819 | o.textContent = i.name + tag; |
| 9820 | sel.appendChild(o); |
| 9821 | }); |
| 9822 | sel.dataset.filled = '1'; |
| 9823 | }).catch(() => {}); |
| 9824 | } |
| 9825 | async function runOspfWatch() { |
| 9826 | const out = document.getElementById('ospf-results'); |
| 9827 | if (!out) return; |
| 9828 | const btn = (typeof event !== 'undefined' && event && event.target) ? event.target : null; |
| 9829 | const ifaceSel = document.getElementById('ospf-iface'); |
| 9830 | const iface = ifaceSel && ifaceSel.value ? ifaceSel.value : ''; |
| 9831 | const secsEl = document.getElementById('ospf-secs'); |
| 9832 | const secs = secsEl && secsEl.value ? secsEl.value : '15'; |
| 9833 | _ndBusy(btn, true, 'Listening…'); |
| 9834 | out.classList.remove('hidden'); |
| 9835 | out.innerHTML = '<p class="text-sm text-gray-400">Passively capturing OSPF on the segment…</p>'; |
| 9836 | try { |
| 9837 | _ospfFillIfaces(); |
nothing calls this directly
no test coverage detected