Skip to content

Commit

Permalink
rfid fuzzer, ability to change time delay
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Oct 4, 2022
1 parent 1424878 commit a8b4877
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 31 deletions.
5 changes: 1 addition & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
### New changes
* PR: New notification sequence for Frequency Analyzer (PR #86 by @BastienB3)
* Infrared: Update assets (by @Amec0e)
* OFW PR: Signal Generator app: UI update (OFW PR 1829 by nminaylov)
* OFW PR: RFID: write fix for some protocols (OFW PR 1828 by nminaylov)
* Plugins: RFID Fuzzer - ability to change time delay (between cards), useful for slow readers, you can adjust it on the go

#### [🎲 Download extra apps pack](https://download-directory.github.io/?url=https://github.com/UberGuidoZ/Flipper/tree/main/Applications/Unleashed)

Expand Down
2 changes: 2 additions & 0 deletions applications/plugins/flipfrid/flipfrid.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ typedef struct {
ProtocolDict* dict;
ProtocolId protocol;

uint8_t time_between_cards;

// Used for custom dictionnary
Stream* uids_stream;
} FlipFridState;
57 changes: 30 additions & 27 deletions applications/plugins/flipfrid/scene/flipfrid_scene_run_attack.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <gui/elements.h>

uint8_t counter = 0;
#define TIME_BETWEEN_CARDS 6

uint8_t id_list[17][5] = {
{0x00, 0x00, 0x00, 0x00, 0x00}, // Null bytes
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, // Only FF
Expand Down Expand Up @@ -78,6 +78,7 @@ uint8_t id_list_h[14][3] = {
};

void flipfrid_scene_run_attack_on_enter(FlipFridState* context) {
context->time_between_cards = 10;
context->attack_step = 0;
context->dict = protocol_dict_alloc(lfrfid_protocols, LFRFIDProtocolMax);
context->worker = lfrfid_worker_alloc(context->dict);
Expand Down Expand Up @@ -488,30 +489,11 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
}
}
}
if(context->proto == PAC) {
if(counter > 10) {
counter = 0;
} else {
counter++;
}
} else if(context->proto == HIDProx) {
if(counter > 10) {
counter = 0;
} else {
counter++;
}
} else if(context->proto == H10301) {
if(counter > 10) {
counter = 0;
} else {
counter++;
}

if(counter > context->time_between_cards) {
counter = 0;
} else {
if(counter > TIME_BETWEEN_CARDS) {
counter = 0;
} else {
counter++;
}
counter++;
}
}
}
Expand All @@ -521,9 +503,22 @@ void flipfrid_scene_run_attack_on_event(FlipFridEvent event, FlipFridState* cont
if(event.input_type == InputTypeShort) {
switch(event.key) {
case InputKeyDown:
break;
case InputKeyUp:
break;
case InputKeyLeft:
if(!context->is_attacking) {
if(context->time_between_cards > 0) {
context->time_between_cards--;
}
}
break;
case InputKeyRight:
if(!context->is_attacking) {
if(context->time_between_cards < 60) {
context->time_between_cards++;
}
}
break;
case InputKeyOk:
counter = 0;
Expand Down Expand Up @@ -562,9 +557,10 @@ void flipfrid_scene_run_attack_on_draw(Canvas* canvas, FlipFridState* context) {
// Title
canvas_set_font(canvas, FontPrimary);
canvas_draw_str_aligned(
canvas, 64, 8, AlignCenter, AlignTop, string_get_cstr(context->attack_name));
canvas, 64, 2, AlignCenter, AlignTop, string_get_cstr(context->attack_name));

char uid[18];
char speed[16];
if(context->proto == HIDProx) {
snprintf(
uid,
Expand Down Expand Up @@ -605,18 +601,25 @@ void flipfrid_scene_run_attack_on_draw(Canvas* canvas, FlipFridState* context) {
context->payload[4]);
}

canvas_draw_str_aligned(canvas, 64, 36, AlignCenter, AlignTop, uid);
canvas_draw_str_aligned(canvas, 64, 38, AlignCenter, AlignTop, uid);

canvas_set_font(canvas, FontSecondary);

canvas_draw_str_aligned(
canvas, 64, 22, AlignCenter, AlignTop, string_get_cstr(context->proto_name));
canvas, 64, 26, AlignCenter, AlignTop, string_get_cstr(context->proto_name));

snprintf(speed, sizeof(speed), "Time delay: %d", context->time_between_cards);

//canvas_draw_str_aligned(canvas, 0, 22, AlignLeft, AlignTop, "Speed:");
canvas_draw_str_aligned(canvas, 64, 14, AlignCenter, AlignTop, speed);
//char start_stop_msg[20];
if(context->is_attacking) {
elements_button_center(canvas, "Stop");
//snprintf(start_stop_msg, sizeof(start_stop_msg), " Press OK to stop ");
} else {
elements_button_center(canvas, "Start");
elements_button_left(canvas, "TD -");
elements_button_right(canvas, "+ TD");
}
//canvas_draw_str_aligned(canvas, 64, 44, AlignCenter, AlignTop, start_stop_msg);
}

0 comments on commit a8b4877

Please sign in to comment.