(endpoint, options = {})
| 11662 | const qs = '?seconds=' + encodeURIComponent(secs) + (iface ? '&interface=' + encodeURIComponent(iface) : ''); |
| 11663 | const d = await fetchAPI('/api/net/ldap-watch' + qs); |
| 11664 | if (!d || d.success === false) { |
| 11665 | const msg = (d && d.error) || 'failed'; |
| 11666 | let extra = ''; |
| 11667 | if (d && d.missing_tool === 'scapy') extra = ' — install Scapy via Detector Self-Test'; |
| 11668 | out.innerHTML = '<p class="text-sm text-red-400">Error: ' + escapeHtml(msg) + escapeHtml(extra) + '</p>'; |
| 11669 | return; |
| 11670 | } |
| 11671 | const [cls, label] = _LDAP_VERDICT_STYLE[d.verdict] || _LDAP_VERDICT_STYLE.unknown; |
| 11672 | const st = d.stats || {}; |
| 11673 | let html = `<div class="mb-2 px-3 py-2 rounded border ${cls} text-sm">${label}</div>`; |
| 11674 | html += `<p class="text-xs text-gray-500 mb-2">Interface: ${escapeHtml(d.interface || '—')} · ${d.seconds}s · ${st.ldap_messages || 0} messages · ${st.binds || 0} binds · ${st.searches || 0} searches · ${st.extended || 0} extended · ${st.cldap || 0} CLDAP · ${st.flows || 0} flows</p>`; |
| 11675 | const findings = d.findings || []; |
| 11676 | if (findings.length) { |
| 11677 | html += '<table class="min-w-full text-xs text-gray-300 whitespace-nowrap"><thead>' + |
| 11678 | '<tr class="text-left text-gray-500"><th class="px-2 py-1">Sev</th><th class="px-2 py-1">Finding</th><th class="px-2 py-1">Source → Target</th><th class="px-2 py-1">Detail</th></tr>' + |
| 11679 | '</thead><tbody>' + |
| 11680 | findings.map(f => { |
| 11681 | const sev = _LDAP_SEV_STYLE[f.severity] || 'text-gray-400'; |
| 11682 | return `<tr class="border-t border-slate-800 align-top"> |
no test coverage detected