(expectEnabled, maxAttempts = 12)
| 17834 | if (devicesList) { |
| 17835 | devicesList.innerHTML = ` |
| 17836 | <div class="text-center text-gray-400 py-8"> |
| 17837 | Start a Bluetooth scan to discover nearby devices |
| 17838 | </div> |
| 17839 | `; |
| 17840 | } |
| 17841 | currentBluetoothDevices = []; |
| 17842 | addConsoleMessage('Cleared Bluetooth device list', 'info'); |
| 17843 | } |
| 17844 | |
| 17845 | // ============================================================================ |
| 17846 | // BLUETOOTH PENTEST FUNCTIONS |
| 17847 | // ============================================================================ |
| 17848 | |
| 17849 | async function startBeaconTracking() { |
| 17850 | const btn = document.getElementById('beacon-track-btn'); |
| 17851 | const resultsDiv = document.getElementById('beacon-results'); |
| 17852 | const durationInput = document.getElementById('beacon-duration'); |
| 17853 | |
| 17854 | if (!btn || !resultsDiv || !durationInput) return; |
| 17855 | |
| 17856 | const duration = parseInt(durationInput.value) || 60; |
| 17857 | const originalText = btn.textContent; |
| 17858 | |
| 17859 | btn.disabled = true; |
| 17860 | btn.textContent = 'Tracking...'; |
| 17861 | resultsDiv.classList.remove('hidden'); |
| 17862 | resultsDiv.textContent = `Tracking beacons for ${duration} seconds...`; |
| 17863 | |
| 17864 | try { |
| 17865 | const response = await postAPI('/api/bluetooth/pentest/beacon-track', { duration }); |
| 17866 | |
| 17867 | if (response.success) { |
| 17868 | const beaconCount = response.beacons_found || 0; |
| 17869 | resultsDiv.innerHTML = ` |
| 17870 | <div class="text-green-400">✓ Found ${beaconCount} beacon(s)</div> |
| 17871 | <div class="mt-1">${JSON.stringify(response.beacons, null, 2)}</div> |
| 17872 | `; |
| 17873 | addConsoleMessage(`Beacon tracking complete: ${beaconCount} beacons found`, 'success'); |
| 17874 | updatePentestSummary('beacon_tracking', response); |
| 17875 | } else { |
| 17876 | throw new Error(response.error || 'Beacon tracking failed'); |
| 17877 | } |
| 17878 | } catch (error) { |
| 17879 | console.error('Beacon tracking error:', error); |
| 17880 | resultsDiv.innerHTML = `<div class="text-red-400">✗ Error: ${error.message}</div>`; |
| 17881 | addConsoleMessage(`Beacon tracking failed: ${error.message}`, 'error'); |
| 17882 | } finally { |
| 17883 | btn.disabled = false; |
| 17884 | btn.textContent = originalText; |
| 17885 | } |
| 17886 | } |
| 17887 | |
| 17888 | async function startDataExfiltration() { |
| 17889 | const btn = document.getElementById('exfil-btn'); |
| 17890 | const resultsDiv = document.getElementById('exfil-results'); |
| 17891 | const targetInput = document.getElementById('exfil-target'); |
| 17892 |
no outgoing calls
no test coverage detected