Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Faster ble packet randomization
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Sep 7, 2023
1 parent d6d66e0 commit 0d19526
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions applications/external/apple_ble_spam/lib/continuity/continuity.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ void continuity_generate_packet(const ContinuityMsg* msg, uint8_t* packet) {
uint8_t size = continuity_get_packet_size(msg->type);
uint8_t i = 0;

packet[i] = size - i - 1; // Packet Length
i++;
packet[i++] = size - 1; // Packet Length
packet[i++] = 0xFF; // Packet Header
packet[i++] = 0x4C; // ...
packet[i++] = 0x00; // ...
Expand Down Expand Up @@ -75,22 +74,8 @@ void continuity_generate_packet(const ContinuityMsg* msg, uint8_t* packet) {
packet[i++] = (rand() % 256); // Lid Open Counter
packet[i++] = 0x00; // Device Color
packet[i++] = 0x00;
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); // ...
packet[i++] = (rand() % 256); // ...
packet[i++] = (rand() % 256); // ...
packet[i++] = (rand() % 256); // ...
packet[i++] = (rand() % 256); // ...
packet[i++] = (rand() % 256); // ...
packet[i++] = (rand() % 256); // ...
furi_hal_random_fill_buf(&packet[i], 16); // Encrypted Payload
i += 16;
break;

case ContinuityTypeAirplayTarget:
Expand Down Expand Up @@ -133,9 +118,8 @@ void continuity_generate_packet(const ContinuityMsg* msg, uint8_t* packet) {
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); // ...
furi_hal_random_fill_buf(&packet[i], 3); // Authentication Tag
i += 3;
break;

default:
Expand Down

0 comments on commit 0d19526

Please sign in to comment.