(event)
| 5657 | }).join('') || '<span class="text-green-400 text-xs">✓ No link-quality issues in this capture.</span>'; |
| 5658 | const tb = document.getElementById('wifidef-at-tbody'); |
| 5659 | const aps = d.aps || []; |
| 5660 | if (!aps.length) { tb.innerHTML = '<tr><td colspan="9" class="py-4 text-center text-gray-500">No frames captured (wrong channel? adapter idle?).</td></tr>'; } |
| 5661 | else tb.innerHTML = aps.map(a => { |
| 5662 | const retryCol = a.retry_pct >= 30 ? 'text-red-400' : a.retry_pct >= 15 ? 'text-amber-400' : 'text-gray-300'; |
| 5663 | const airCol = a.airtime_pct >= 50 ? 'text-orange-400' : 'text-gray-300'; |
| 5664 | const rate = a.rate_med != null ? `${a.rate_min}/${a.rate_med}/${a.rate_max}` : '—'; |
| 5665 | const secCol = (a.security === 'Open' || a.security === 'WEP') ? 'text-red-400' |
| 5666 | : (a.security === 'WPA') ? 'text-amber-400' |
| 5667 | : a.security ? 'text-gray-300' : 'text-gray-600'; |
| 5668 | const legacyPhy = a.ap_phy && /802\.11[bg]|802\.11a /.test(a.ap_phy); |
| 5669 | const phyCol = legacyPhy ? 'text-red-300' : a.ap_phy ? 'text-gray-300' : 'text-gray-600'; |
| 5670 | // WPS posture badge: red when the PIN surface is exposed, grey otherwise. |
| 5671 | const w = a.wps; |
| 5672 | let wpsBadge = ''; |
| 5673 | if (w && w.present) { |
| 5674 | const exposed = w.pin_method && w.locked !== true; |
| 5675 | const label = exposed ? (w.version2 ? 'WPS-PIN' : 'WPS-1.0') : 'WPS'; |
| 5676 | const bcls = exposed ? 'bg-purple-600/30 text-purple-200 border-purple-500/60' |
| 5677 | : 'bg-slate-700/40 text-gray-400 border-slate-600/50'; |
| 5678 | const tip = exposed ? 'WPS PIN enrollment exposed — brute-forceable' : 'WPS enabled'; |
| 5679 | wpsBadge = ` <span class="text-[9px] px-1 rounded border ${bcls}" title="${tip}">${label}</span>`; |
| 5680 | } |
| 5681 | // Cipher suffix on the security cell (TKIP is the throughput-relevant one). |
| 5682 | const cipher = a.group_cipher && a.group_cipher !== 'CCMP-128' |
| 5683 | ? ` <span class="text-[10px] ${a.group_cipher === 'TKIP' ? 'text-rose-400' : 'text-gray-500'}">${a.group_cipher}</span>` : ''; |
| 5684 | const htMix = a.ht_protection === 3 |
| 5685 | ? ' <span class="text-[9px] px-1 rounded bg-fuchsia-600/20 text-fuchsia-300 border border-fuchsia-700/50" title="HT Protection = Non-HT Mixed: a pre-11n station is associated">MIXED</span>' : ''; |
| 5686 | return `<tr class="border-b border-slate-800/50 cursor-pointer hover:bg-slate-800/40" title="Open in Signal Intelligence" onclick="wifiPivotFromDefense('${a.bssid}','${encodeURIComponent(a.ssid || '').replace(/'/g, '%27')}', false)"> |
| 5687 | <td class="py-1 pr-2" data-label="SSID">${a.ssid ? _esc(a.ssid) : '<span class="text-gray-600">—</span>'}${a.erp_protection ? ' <span class="text-[9px] px-1 rounded bg-fuchsia-600/20 text-fuchsia-300 border border-fuchsia-700/50" title="ERP protection ON — a legacy 802.11b client is taxing this BSS">ERP</span>' : ''}${wpsBadge}</td> |
| 5688 | <td class="py-1 pr-2 font-mono text-[11px]" data-label="BSSID">${a.bssid}</td> |
| 5689 | <td class="py-1 pr-2 text-xs ${secCol}" data-label="Security">${a.security || '—'}${cipher}</td> |
| 5690 | <td class="py-1 pr-2 text-xs ${phyCol}" data-label="PHY">${a.ap_phy || '—'}${htMix}</td> |
| 5691 | <td class="py-1 pr-2" data-label="Frames">${a.frames} <span class="text-gray-600 text-[10px]">(${a.data_frames} data)</span></td> |
| 5692 | <td class="py-1 pr-2 ${retryCol}" data-label="Retry %">${a.retry_pct}%</td> |
| 5693 | <td class="py-1 pr-2 ${airCol}" data-label="Airtime %">${a.airtime_pct}%</td> |
| 5694 | <td class="py-1 pr-2 text-xs" data-label="Rate min/med/max">${rate} <span class="text-gray-600">Mbps</span></td> |
| 5695 | <td class="py-1 pr-2" data-label="RSSI">${a.rssi == null ? '—' : a.rssi + ' dBm'}</td></tr>`; |
| 5696 | }).join(''); |
| 5697 | // Per-client airtime attribution — pinpoints the offending device. |
| 5698 | const cwrap = document.getElementById('wifidef-at-clients-wrap'); |
| 5699 | _wifidefClients = d.clients || []; |
| 5700 | if (_wifidefClients.length) { |
| 5701 | cwrap.classList.remove('hidden'); |
| 5702 | // Populate the SSID filter with the networks actually seen this capture. |
| 5703 | const sel = document.getElementById('wifidef-at-client-filter'); |
| 5704 | const groups = new Map(); // key -> label (ssid, else BSSID) |
| 5705 | _wifidefClients.forEach(c => { |
| 5706 | const key = c.ssid || c.bssid || ''; |
| 5707 | if (key && !groups.has(key)) groups.set(key, c.ssid || c.bssid); |
| 5708 | }); |
| 5709 | const prev = sel.value; |
| 5710 | sel.innerHTML = '<option value="">All SSIDs</option>' + |
| 5711 | [...groups.entries()].map(([k, label]) => |
| 5712 | `<option value="${_esc(k)}">${_esc(label)}</option>`).join(''); |
| 5713 | sel.value = [...groups.keys()].includes(prev) ? prev : ''; |
| 5714 | wifidefFilterClients(); |
| 5715 | } else { |
| 5716 | cwrap.classList.add('hidden'); |
nothing calls this directly
no test coverage detected