(net)
| 6233 | if (btn) { btn.disabled = true; btn.dataset.orig = btn.textContent; btn.textContent = 'Checking…'; } |
| 6234 | const name = 'example.com'; |
| 6235 | // DNS + ARP are fast — render them right away so the button feels |
| 6236 | // responsive. DHCP discovery (nmap) takes a few seconds, so it's |
| 6237 | // fetched separately and patched into its chip when it lands. |
| 6238 | const [arp, dns] = await Promise.all([ |
| 6239 | fetchAPI('/api/net/arp-check').catch(() => null), |
| 6240 | postAPI('/api/net/dns', { name }).catch(() => null), |
| 6241 | ]); |
| 6242 | const dnsV = dns && dns.poison ? dns.poison.verdict : 'unknown'; |
| 6243 | const arpV = arp ? arp.verdict : 'unknown'; |
| 6244 | const state = { |
| 6245 | overall: ['clean', 'suspicious', 'compromised'][Math.max(_NETINT_RANK[dnsV] || 0, _NETINT_RANK[arpV] || 0)], |
| 6246 | ts: new Date().toISOString(), monitor_enabled: true, |
| 6247 | dns: { verdict: dnsV, reasons: (dns && dns.poison && dns.poison.reasons) || [] }, |
| 6248 | arp: { verdict: arpV, reasons: (arp && arp.reasons) || [] }, |
| 6249 | dhcp: { verdict: 'checking…', reasons: [] }, |
| 6250 | }; |
| 6251 | renderNetIntegrity(state); |
no test coverage detected