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

Function refreshEthernetStatus

web/scripts/ragnar_modern.js:8263–8308  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8261 <td class="px-2 py-1 font-mono">${escapeHtml(sp.status)}</td>
8262 <td class="px-2 py-1">${forming}</td>
8263 <td class="px-2 py-1">${badge}</td>
8264 </tr>`;
8265 }).join('') +
8266 '</tbody></table>';
8267 }
8268 if (d.reasons && d.reasons.length) {
8269 html += '<ul class="text-xs text-gray-400 mt-2 list-disc pl-5">' +
8270 d.reasons.map(r => '<li>' + escapeHtml(r) + '</li>').join('') + '</ul>';
8271 }
8272 (d.advisories || []).forEach(a => {
8273 html += `<div class="mt-2 px-3 py-2 rounded border text-xs text-gray-400 border-slate-700 bg-slate-900/40">${escapeHtml(a)}</div>`;
8274 });
8275 out.innerHTML = html;
8276 } catch (e) {
8277 out.innerHTML = '<p class="text-sm text-red-400">Failed: ' + escapeHtml(e.message) + '</p>';
8278 } finally {
8279 _ndBusy(btn, false);
8280 }
8281}
8282async function dtpTrustBaseline() {
8283 try {
8284 await postAPI('/api/net/dtp-baseline', { action: 'reset' });
8285 addConsoleMessage('DTP baseline reset — re-learning current DTP speakers', 'info');
8286 await runDtpWatch();
8287 } catch (e) {
8288 addConsoleMessage('Failed to reset DTP baseline: ' + e.message, 'error');
8289 }
8290}
8291
8292// ---- CDP Watch (passive Cisco Discovery flood / spoof / info-leak) ---------
8293const _CDP_VERDICT_STYLE = {
8294 clean: ['bg-green-950/40 border-green-900 text-green-400', '✓ No CDP anomaly — speakers match the trusted baseline'],
8295 'cdp-enabled': ['bg-amber-950/50 border-amber-800 text-amber-300', '⚠ CDP is enabled here — it leaks IOS version / mgmt IP / native VLAN in clear'],
8296 spoof: ['bg-red-950/60 border-red-800 text-red-300', '🛑 Rogue CDP speaker — spoofed neighbour (possible fake IP phone / VoIP-VLAN-hop)'],
8297 flood: ['bg-red-950/60 border-red-800 text-red-300', '🛑 CDP flood — neighbour-table / CPU exhaustion DoS (Yersinia)'],
8298 unknown: ['bg-slate-800 border-slate-700 text-slate-400', '— Could not determine'],
8299};
8300function _cdpFillIfaces() {
8301 const sel = document.getElementById('cdp-iface');
8302 if (!sel || sel.dataset.filled === '1') return Promise.resolve();
8303 return fetchAPI('/api/net/interfaces').then(x => {
8304 (x.interfaces || []).forEach(i => {
8305 const o = document.createElement('option');
8306 o.value = i.name;
8307 const tag = i.type === 'wifi' ? ' (WiFi)' : i.type === 'ethernet' ? ' (LAN)' : (i.type ? ' (' + i.type + ')' : '');
8308 o.textContent = i.name + tag;
8309 sel.appendChild(o);
8310 });
8311 sel.dataset.filled = '1';

Callers 3

loadInitialDataFunction · 0.70
loadTabDataFunction · 0.70
loadConnectDataFunction · 0.70

Calls 2

fetchAPIFunction · 0.70
escapeHtmlFunction · 0.70

Tested by

no test coverage detected