| 924 | } |
| 925 | |
| 926 | bool HIDExploitEngine::testHIDVulnerability(NimBLEAddress target) { |
| 927 | String connectionMethod = ""; |
| 928 | NimBLEClient *pClient = attemptConnectionWithStrategies(target, connectionMethod); |
| 929 | if (!pClient) return false; |
| 930 | |
| 931 | bool hasHID = false, hasWriteAccess = false; |
| 932 | const std::vector<NimBLERemoteService *> &services = pClient->getServices(true); |
| 933 | for (auto &service : services) { |
| 934 | std::string uuidStr = service->getUUID().toString(); |
| 935 | if (uuidStr.find("1812") != std::string::npos) { |
| 936 | hasHID = true; |
| 937 | const std::vector<NimBLERemoteCharacteristic *> &chars = service->getCharacteristics(true); |
| 938 | for (auto &ch : chars) { |
| 939 | if (ch->canWrite()) { |
| 940 | hasWriteAccess = true; |
| 941 | break; |
| 942 | } |
| 943 | } |
| 944 | } |
| 945 | } |
| 946 | |
| 947 | pClient->disconnect(); |
| 948 | BLEStateManager::unregisterClient(pClient); |
| 949 | NimBLEDevice::deleteClient(pClient); |
| 950 | BLEStateManager::deinitBLE(true); |
| 951 | return hasHID && hasWriteAccess; |
| 952 | } |
| 953 | |
| 954 | //============================================================================= |
| 955 | // WhisperPair Exploit (FastPair Crypto Attacks) |
no test coverage detected