Below are the necessary edits to make in WifiScan.cpp file for ble spam attacks to
not crash out on the CYD, also known as (Cheap Yellow Display).
These edits seem to have solved the crashes in ble attacks on the CYD. Delays were added as it seemed the memory was being affected by not having proper delays for this device's memory bank.
void WiFiScan::executeSwiftpairSpam(EBLEPayloadType type) {
#ifdef HAS_BT
uint8_t macAddr[6];
generateRandomMac(macAddr);
esp_base_mac_addr_set(macAddr);
NimBLEDevice::init("");
NimBLEServer *pServer = NimBLEDevice::createServer();
pAdvertising = pServer->getAdvertising();
delay(20);
//NimBLEAdvertisementData advertisementData = getSwiftAdvertisementData();
NimBLEAdvertisementData advertisementData = this->GetUniversalAdvertisementData(type);
pAdvertising->setAdvertisementData(advertisementData);
pAdvertising->start();
delay(1000);
pAdvertising->stop();
NimBLEDevice::deinit();
#endif
}
void WiFiScan::executeSwiftpairSpam(EBLEPayloadType type) {
#ifdef HAS_BT
uint8_t macAddr[6];
generateRandomMac(macAddr);
delay(5);
esp_base_mac_addr_set(macAddr);
delay(5);
NimBLEDevice::init("");
delay(5);
NimBLEServer *pServer = NimBLEDevice::createServer();
delay(5);
pAdvertising = pServer->getAdvertising();
delay(20);
//NimBLEAdvertisementData advertisementData = getSwiftAdvertisementData();
NimBLEAdvertisementData advertisementData = this->GetUniversalAdvertisementData(type);
pAdvertising->setAdvertisementData(advertisementData);
pAdvertising->start();
delay(1000);
pAdvertising->stop();
delay(5);
NimBLEDevice::deinit();
#endif
}