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

Function loadInterfaces

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

Source from the content-addressed store, hash-verified

2103 h1{font-size:22px;margin:0 0 2px} h2{font-size:15px;margin:22px 0 6px;border-bottom:1px solid #ddd;padding-bottom:3px}
2104 .sub{color:#666;font-size:12px;margin-bottom:14px}
2105 table{border-collapse:collapse;width:100%;font-size:11.5px} th,td{border:1px solid #ddd;padding:3px 6px;text-align:left}
2106 th{background:#f4f4f5} .mono{font-family:ui-monospace,monospace;font-size:10.5px}
2107 .foot{margin-top:26px;color:#999;font-size:11px} @media print{body{margin:0}}
2108</style></head><body>
2109 <h1>WiFi Survey Report</h1>
2110 <div class="sub">${now.toLocaleString()} · interface ${_esc(_wifiState.iface || '—')} · ${aps.length} APs heard${_wifiHm.data && _wifiHm.data.target_ssid ? ' · target ' + _esc(_wifiHm.data.target_ssid) : ''}</div>
2111 ${cov ? '<h2>Coverage</h2>' + cov : ''}
2112 ${plan ? '<h2>Build plan</h2>' + plan : ''}
2113 ${img ? '<h2>Heatmap</h2>' + img : ''}
2114 ${bands ? '<h2>Bands &amp; channel plan</h2>' + bands : ''}
2115 ${intf ? '<h2>Interference</h2>' + intf : ''}
2116 ${issues.length ? '<h2>Security issues (' + issues.length + ')</h2><ul>' + issues.map(a => `<li><b>${_esc(a.ssid) || 'hidden'}</b> (${_esc(a.bssid)}): ${_esc(a.security_findings.join('; '))}</li>`).join('') + '</ul>' : ''}
2117 <h2>AP inventory</h2>
2118 <table><thead><tr><th>SSID</th><th>BSSID</th><th>Vendor</th><th>Band</th><th>Ch</th><th>Width</th><th>RSSI</th><th>SNR</th><th>Security</th></tr></thead><tbody>${rows}</tbody></table>
2119 <div class="foot">Generated by Ragnar WiFi Analyzer. Passive survey — estimates, not survey-grade measurements.</div>
2120 <script>window.onload=function(){setTimeout(function(){window.print();},250);};<\/script>
2121</body></html>`;
2122 const w = window.open('', '_blank');
2123 if (!w) { alert('Allow pop-ups to generate the report.'); return; }
2124 w.document.open(); w.document.write(html); w.document.close();
2125}
2126
2127function wifiRender() {
2128 const d = _wifiState.data; if (!d) return;
2129 if (!_wifiState.apView) _wifiState.apView = 'aps';
2130 if (!_wifiState.sortKey) { _wifiState.sortKey = 'signal'; _wifiState.sortDir = -1; }
2131 // Band summary chips (+ noise floor + width advice)
2132 const summ = document.getElementById('wifi-band-summary');
2133 const ratingColor = { clear: '#22c55e', moderate: '#eab308', congested: '#ef4444' };
2134 let chips = Object.keys(d.spectrum).sort().map(b => {
2135 const s = d.spectrum[b];
2136 const wa = s.width_advice ? ` · <span title="${s.width_advice.reason}">→ ${s.width_advice.mhz}MHz</span>` : '';
2137 return `<span class="px-2 py-1 rounded" style="background:${_WIFI_BAND_COLOR[b]}22;border:1px solid ${_WIFI_BAND_COLOR[b]}66">
2138 <b style="color:${_WIFI_BAND_COLOR[b]}">${b} GHz</b> · ${s.ap_count} AP ·
2139 <span style="color:${ratingColor[s.rating]}">${s.rating}</span> · best ch ${s.recommend.join(', ')}${wa}</span>`;
2140 }).join('');
2141 if (d.noise_floor != null) chips += `<span class="px-2 py-1 rounded bg-slate-800 border border-slate-700">noise floor ${d.noise_floor} dBm</span>`;
2142 summ.innerHTML = chips || '<span class="text-gray-500">No APs heard.</span>';
2143 wifiRenderChanges();
2144 // Legend
2145 document.getElementById('wifi-legend').innerHTML =
2146 '<span>Signal:</span>' +
2147 [['#22c55e', 'strong'], ['#84cc16', 'good'], ['#eab308', 'fair'], ['#f97316', 'weak'], ['#ef4444', 'v.weak']]
2148 .map(([c, l]) => `<span class="flex items-center gap-1"><span style="width:10px;height:10px;background:${c};border-radius:2px;display:inline-block"></span>${l}</span>`).join('') +
2149 '<span class="ml-2">◆ DFS/radar</span><span>⚠ security issue</span>';
2150 wifiRenderTable();
2151 // Interference
2152 const inf = d.interference; const ip = document.getElementById('wifi-interference');
2153 let html = '';
2154 if (inf.co_channel.length) html += '<div class="mb-2"><b class="text-amber-400">Co-channel:</b><ul class="mt-1 space-y-0.5">' +
2155 inf.co_channel.slice(0, 6).map(g => `<li>${g.band}GHz ch${g.channel}: ${g.count} APs sharing (${g.ssids.slice(0, 3).join(', ')})</li>`).join('') + '</ul></div>';
2156 if (inf.adjacent_overlap.length) html += `<div><b class="text-orange-400">2.4GHz overlap:</b> ${inf.adjacent_overlap.length} overlapping pair(s) — use only ch 1/6/11.</div>`;
2157 if (!html) html = '<span class="text-green-400">No significant co-/adjacent-channel interference.</span>';
2158 ip.innerHTML = html;
2159 _wifiDrawSpectrum();
2160 _wifiFsRender();
2161 if (_wifiHm.mesh) wifiHeatmapPopulateSsids(); else wifiHeatmapPopulateAps();
2162 // WIDS pivot: once the flagged BSSID shows up in a survey, select it

Callers 1

showNetworkSubtabFunction · 0.85

Calls 4

typeLabelFunction · 0.85
methodBadgeFunction · 0.85
fetchAPIFunction · 0.70
escapeHtmlFunction · 0.70

Tested by

no test coverage detected