Skip to content

Commit

Permalink
Blink the LED while emulating cards
Browse files Browse the repository at this point in the history
  • Loading branch information
Kondenko committed Jan 8, 2024
1 parent fb02471 commit a540e69
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apps_source_code/mifare_fuzzer/mifare_fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ MifareFuzzerApp* mifare_fuzzer_alloc() {
app->gui = furi_record_open(RECORD_GUI);
view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen);

// Open Notifications record
app->notifications = furi_record_open(RECORD_NOTIFICATION);

// view: select card type
app->submenu_card = submenu_alloc();
view_dispatcher_add_view(
Expand Down Expand Up @@ -116,6 +119,10 @@ void mifare_fuzzer_free(MifareFuzzerApp* app) {
furi_record_close(RECORD_GUI);
app->gui = NULL;

// Notifications
furi_record_close(RECORD_NOTIFICATION);
app->notifications = NULL;

// Worker
//FURI_LOG_D(TAG, "mifare_fuzzer_free() :: Worker");
mifare_fuzzer_worker_free(app->worker);
Expand Down
2 changes: 2 additions & 0 deletions apps_source_code/mifare_fuzzer/mifare_fuzzer_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <gui/gui.h>
#include <gui/view_dispatcher.h>
#include <gui/scene_manager.h>
#include <notification/notification_messages.h>

#include <gui/modules/submenu.h>

Expand Down Expand Up @@ -54,6 +55,7 @@ typedef enum {

struct MifareFuzzerApp {
Gui* gui;
NotificationApp* notifications;

ViewDispatcher* view_dispatcher;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "../mifare_fuzzer_i.h"
#include <notification/notification.h>
#include <notification/notification_messages.h>

uint8_t tick_counter = 0;
uint8_t attack_step = 0;
Expand Down Expand Up @@ -77,10 +79,12 @@ bool mifare_fuzzer_scene_emulator_on_event(void* context, SceneManagerEvent even
if(event.event == MifareFuzzerEventStartAttack) {
NfcDevice* nfc_device = NULL;
const MfClassicData* mf_classic_data = NULL;
bool nfc_device_parsed = false;
if(app->card_file_path) {
nfc_device = app->worker->nfc_device;
const char* path = furi_string_get_cstr(app->card_file_path);
if(nfc_device_load(nfc_device, path)) {
nfc_device_parsed = true;
mf_classic_data = nfc_device_get_data(nfc_device, NfcProtocolMfClassic);
if(mf_classic_data->type == MfClassicType1k) {
app->card = MifareCardClassic1k;
Expand Down Expand Up @@ -203,10 +207,15 @@ bool mifare_fuzzer_scene_emulator_on_event(void* context, SceneManagerEvent even

// Start worker
mifare_fuzzer_worker_start(app->worker);

if(nfc_device_parsed) {
notification_message(app->notifications, &sequence_blink_start_magenta);
}
} else if(event.event == MifareFuzzerEventStopAttack) {
//FURI_LOG_D(TAG, "mifare_fuzzer_scene_emulator_on_event() :: MifareFuzzerEventStopAttack");
// Stop worker
mifare_fuzzer_worker_stop(app->worker);
notification_message(app->notifications, &sequence_blink_stop);
} else if(event.event == MifareFuzzerEventIncrementTicks) {
if(!emulator->is_attacking) {
if(emulator->ticks_between_cards < MIFARE_FUZZER_MAX_TICKS_BETWEEN_CARDS) {
Expand Down Expand Up @@ -257,6 +266,7 @@ bool mifare_fuzzer_scene_emulator_on_event(void* context, SceneManagerEvent even
void mifare_fuzzer_scene_emulator_on_exit(void* context) {
//FURI_LOG_D(TAG, "mifare_fuzzer_scene_emulator_on_exit()");
MifareFuzzerApp* app = context;
notification_message(app->notifications, &sequence_blink_stop);
mifare_fuzzer_worker_stop(app->worker);

if(app->attack == MifareFuzzerAttackLoadUidsFromFile) {
Expand Down

0 comments on commit a540e69

Please sign in to comment.