Skip to content

Commit e756c68

Browse files
committed
RFID and iButton fuzzer fixes
Attempt to fix crash when exiting from uids from file attack
1 parent 9df393c commit e756c68

7 files changed

+33
-19
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Plugins: Weather Station -> Improved signal info dashboard, added signal age counter. (PR by @LY2NEO | #197) (Modified and improved by @xMasterX, new icons and UI changes recommendations by @Karator in OFW PR 2087)
66
* Plugins: Weather Station -> Oregon2 - add support for RTHN129
77
* Plugins: iButton Fuzzer -> change minimal delay (after @Tobirg successfully verified stability with lower delay)
8+
* Plugins: iButton Fuzzer + RFID Fuzzer -> Attempt to fix crash when exiting from uids from file attack
89
* OFW: NFC bug fixes **(breaking change, affects API version)**
910
* OFW: UART echo: fix race conditions causing null pointer dereference
1011
* OFW: File browser base folder **(breaking change, affects API version)**

applications/plugins/flipfrid/flipfrid.h

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ typedef struct {
8282
ProtocolDict* dict;
8383
ProtocolId protocol;
8484
bool workr_rund;
85+
bool attack_stop_called;
8586

8687
uint8_t time_between_cards;
8788

applications/plugins/flipfrid/scene/flipfrid_scene_entrypoint.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void flipfrid_scene_entrypoint_on_enter(FlipFridState* context) {
7171
main_menu_items[0] = furi_string_alloc_set("Default Values");
7272
main_menu_items[1] = furi_string_alloc_set("BF Customer ID");
7373
main_menu_items[2] = furi_string_alloc_set("Load File");
74-
main_menu_items[3] = furi_string_alloc_set("Load uids from file");
74+
main_menu_items[3] = furi_string_alloc_set("Load UIDs from file");
7575

7676
context->menu_proto_index = 0;
7777
/*for(uint32_t i = 0; i < 4; i++) {

applications/plugins/flipfrid/scene/flipfrid_scene_run_attack.c

+14-9
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ uint8_t id_list_h[14][3] = {
8080
void flipfrid_scene_run_attack_on_enter(FlipFridState* context) {
8181
context->time_between_cards = 10;
8282
context->attack_step = 0;
83+
context->attack_stop_called = false;
8384
context->dict = protocol_dict_alloc(lfrfid_protocols, LFRFIDProtocolMax);
8485
context->worker = lfrfid_worker_alloc(context->dict);
8586
if(context->proto == HIDProx) {
@@ -497,7 +498,6 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
497498
}
498499
}
499500
}
500-
501501
if(counter > context->time_between_cards) {
502502
counter = 0;
503503
} else {
@@ -541,18 +541,23 @@ void flipfrid_scene_run_attack_on_event(FlipFridEvent event, FlipFridState* cont
541541
break;
542542
case InputKeyBack:
543543
context->is_attacking = false;
544-
context->attack_step = 0;
545544
counter = 0;
546545

547-
if(context->attack == FlipFridAttackLoadFileCustomUids) {
548-
furi_string_reset(context->data_str);
549-
stream_rewind(context->uids_stream);
550-
buffered_file_stream_close(context->uids_stream);
546+
notification_message(context->notify, &sequence_blink_stop);
547+
if(context->attack_stop_called) {
548+
context->attack_stop_called = false;
549+
context->attack_step = 0;
550+
if(context->attack == FlipFridAttackLoadFileCustomUids) {
551+
furi_string_reset(context->data_str);
552+
stream_rewind(context->uids_stream);
553+
buffered_file_stream_close(context->uids_stream);
554+
}
555+
556+
furi_string_reset(context->notification_msg);
557+
context->current_scene = SceneEntryPoint;
551558
}
552559

553-
furi_string_reset(context->notification_msg);
554-
notification_message(context->notify, &sequence_blink_stop);
555-
context->current_scene = SceneEntryPoint;
560+
context->attack_stop_called = true;
556561
break;
557562
default:
558563
break;

applications/plugins/ibtn_fuzzer/ibtnfuzzer.h

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ typedef struct {
8181
iButtonKeyType keytype;
8282
bool workr_rund;
8383
bool enter_rerun;
84+
bool attack_stop_called;
8485

8586
uint8_t time_between_cards;
8687

applications/plugins/ibtn_fuzzer/scene/ibtnfuzzer_scene_entrypoint.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void ibtnfuzzer_scene_entrypoint_on_enter(iBtnFuzzerState* context) {
6363

6464
main_menu_items[0] = furi_string_alloc_set("Default Values");
6565
main_menu_items[1] = furi_string_alloc_set("Load File");
66-
main_menu_items[2] = furi_string_alloc_set("Load uids from file");
66+
main_menu_items[2] = furi_string_alloc_set("Load UIDs from file");
6767

6868
context->menu_proto_index = 0;
6969
/*for(uint32_t i = 0; i < 4; i++) {

applications/plugins/ibtn_fuzzer/scene/ibtnfuzzer_scene_run_attack.c

+14-8
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ uint8_t id_list_cyfral[14][2] = {
7171
void ibtnfuzzer_scene_run_attack_on_enter(iBtnFuzzerState* context) {
7272
context->time_between_cards = 8;
7373
context->attack_step = 0;
74+
context->attack_stop_called = false;
7475
context->key = ibutton_key_alloc();
7576
context->worker = ibutton_worker_alloc();
7677
if(context->proto == Metakom) {
@@ -387,18 +388,23 @@ void ibtnfuzzer_scene_run_attack_on_event(iBtnFuzzerEvent event, iBtnFuzzerState
387388
break;
388389
case InputKeyBack:
389390
context->is_attacking = false;
390-
context->attack_step = 0;
391391
counter = 0;
392392

393-
if(context->attack == iBtnFuzzerAttackLoadFileCustomUids) {
394-
furi_string_reset(context->data_str);
395-
stream_rewind(context->uids_stream);
396-
buffered_file_stream_close(context->uids_stream);
393+
notification_message(context->notify, &sequence_blink_stop);
394+
if(context->attack_stop_called) {
395+
context->attack_stop_called = false;
396+
context->attack_step = 0;
397+
if(context->attack == iBtnFuzzerAttackLoadFileCustomUids) {
398+
furi_string_reset(context->data_str);
399+
stream_rewind(context->uids_stream);
400+
buffered_file_stream_close(context->uids_stream);
401+
}
402+
403+
furi_string_reset(context->notification_msg);
404+
context->current_scene = SceneEntryPoint;
397405
}
398406

399-
furi_string_reset(context->notification_msg);
400-
notification_message(context->notify, &sequence_blink_stop);
401-
context->current_scene = SceneEntryPoint;
407+
context->attack_stop_called = true;
402408
break;
403409
default:
404410
break;

0 commit comments

Comments
 (0)