From 62db171ed614e31f89def5415ba50f05081ec73f Mon Sep 17 00:00:00 2001 From: Smittix Date: Fri, 16 Jan 2026 16:31:19 +0000 Subject: [PATCH] Fix capabilities display and add 'Add to Known Devices' button - Fix tscmShowCapabilities to parse nested API response structure - Build can/cannot detect lists dynamically from actual capabilities - Display system info, limitations, and disclaimer - Add 'Add to Known Devices' button in device detail modal - New tscmAddToKnownDevices function with custom name prompt Co-Authored-By: Claude Opus 4.5 --- templates/index.html | 154 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 127 insertions(+), 27 deletions(-) diff --git a/templates/index.html b/templates/index.html index f137f6b..14f3e76 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8547,27 +8547,40 @@ } html += ``; + // Actions section - always show with "Add to Known Devices" + const deviceIdentifier = device.bssid || device.mac || (device.frequency ? device.frequency.toString() : id); + const deviceName = device.name || device.ssid || device.essid || (device.frequency ? device.frequency + ' MHz' : 'Unknown'); + html += ` +
+

Actions

+
+ `; + // Add "Listen" button for RF signals if (protocol === 'rf' && device.frequency) { const freq = device.frequency; html += ` -
-

Actions

-
- - -
-
- Opens Listening Post and tunes to this frequency -
-
+ + `; } + // Add "Add to Known Devices" button for all device types + html += ` + +
+
+ ${protocol === 'rf' ? 'Listen buttons open Listening Post. ' : ''}Known devices are excluded from threat scoring in future sweeps. +
+
+ `; + // Add indicators section if (device.indicators && device.indicators.length > 0) { html += ` @@ -9097,48 +9110,104 @@ if (data.status === 'success') { const caps = data.capabilities; + + // Determine availability from nested structure + const wifiAvailable = caps.wifi && caps.wifi.mode !== 'unavailable'; + const btAvailable = caps.bluetooth && caps.bluetooth.mode !== 'unavailable'; + const rfAvailable = caps.rf && caps.rf.available; + + // Build can/cannot detect lists based on capabilities + const canDetect = []; + const cannotDetect = []; + + if (wifiAvailable) { + canDetect.push('WiFi access points and networks'); + canDetect.push('Hidden SSIDs (presence only)'); + if (caps.wifi.monitor_capable) { + canDetect.push('WiFi client devices (probe requests)'); + canDetect.push('Deauthentication attacks'); + } + } else { + cannotDetect.push('WiFi networks - no adapter available'); + } + + if (btAvailable) { + canDetect.push('Bluetooth Classic devices'); + canDetect.push('BLE beacons and trackers'); + canDetect.push('Audio-capable Bluetooth devices'); + } else { + cannotDetect.push('Bluetooth devices - no adapter available'); + } + + if (rfAvailable) { + const minFreq = caps.rf.frequency_range_mhz?.min || 0; + const maxFreq = caps.rf.frequency_range_mhz?.max || 0; + canDetect.push(`RF signals (${minFreq}-${maxFreq} MHz)`); + canDetect.push('Unknown transmitters in frequency range'); + } else { + cannotDetect.push('RF signals - no SDR device available'); + } + + // Always cannot detect + cannotDetect.push('Wired surveillance devices'); + cannotDetect.push('Passive listening devices (no transmitter)'); + cannotDetect.push('Devices that are powered off'); + cannotDetect.push('Burst/store-and-forward transmitters (when idle)'); + content.innerHTML = `

Sweep Capabilities

+

System Information

+
+ OS: ${escapeHtml(caps.system?.os || 'Unknown')} ${escapeHtml(caps.system?.os_version || '')} | + Root: ${caps.system?.is_root ? 'Yes' : 'No'} +

Available Detection Methods

-
+
📶 WiFi Scanning - ${caps.wifi_available ? 'Available' : 'Not Available'} - ${caps.wifi_interface ? `${caps.wifi_interface}` : ''} + ${wifiAvailable ? caps.wifi.mode : 'Not Available'} + ${caps.wifi?.interface ? `${escapeHtml(caps.wifi.interface)}` : ''}
-
+
🔵 Bluetooth Scanning - ${caps.bluetooth_available ? 'Available' : 'Not Available'} - ${caps.bt_adapter ? `${caps.bt_adapter}` : ''} + ${btAvailable ? caps.bluetooth.mode : 'Not Available'} + ${caps.bluetooth?.adapter ? `${escapeHtml(caps.bluetooth.adapter)}` : ''}
-
+
📡 RF/SDR Scanning - ${caps.sdr_available ? 'Available' : 'Not Available'} - ${caps.sdr_device ? `${caps.sdr_device}` : ''} + ${rfAvailable ? 'Available' : 'Not Available'} + ${caps.rf?.device_type ? `${escapeHtml(caps.rf.device_type)}` : ''}

What This Sweep CAN Detect

    - ${(caps.can_detect || []).map(item => `
  • ✅ ${escapeHtml(item)}
  • `).join('')} + ${canDetect.map(item => `
  • ✅ ${escapeHtml(item)}
  • `).join('')}

What This Sweep CANNOT Detect

    - ${(caps.cannot_detect || []).map(item => `
  • ❌ ${escapeHtml(item)}
  • `).join('')} + ${cannotDetect.map(item => `
  • ❌ ${escapeHtml(item)}
  • `).join('')}
+ ${caps.all_limitations && caps.all_limitations.length > 0 ? ` +
+

Current Limitations

+
    + ${caps.all_limitations.map(item => `
  • ⚠️ ${escapeHtml(item)}
  • `).join('')} +
+
+ ` : ''}
- Important: This tool detects wireless RF emissions only. - Professional TSCM requires physical inspection, NLJD, thermal imaging, and spectrum analysis equipment. + Important: ${escapeHtml(caps.disclaimer || 'This tool detects wireless RF emissions only. Professional TSCM requires physical inspection, NLJD, thermal imaging, and spectrum analysis equipment.')}
`; } else { @@ -9249,6 +9318,37 @@ } } + async function tscmAddToKnownDevices(identifier, name, deviceType) { + // Ask for optional custom name + const customName = prompt(`Add "${name}" to known devices.\n\nEnter a friendly name (or leave blank to use default):`, name); + if (customName === null) return; // User cancelled + + try { + const response = await fetch('/tscm/known-devices', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + identifier: identifier, + name: customName || name, + device_type: deviceType + }) + }); + + const data = await response.json(); + if (data.status === 'success') { + // Show success message + alert(`"${customName || name}" added to known devices.\n\nThis device will be excluded from threat scoring in future sweeps.`); + // Close the device modal + closeTscmDeviceModal(); + } else { + alert(data.message || 'Failed to add device'); + } + } catch (e) { + console.error('Failed to add to known devices:', e); + alert('Failed to add device to known list'); + } + } + // Cases Management async function tscmShowCases() { const modal = document.getElementById('tscmDeviceModal');