Skip to content

Commit 708e25a

Browse files
committed
fixes for mifare fuzzer
Flipper-XFW/Xtreme-Apps@3a00a27
1 parent 99f6bc2 commit 708e25a

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

apps_source_code/mifare_fuzzer/application.fam

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ App(
1515
fap_icon_assets="images",
1616
fap_author="@spheeere98 @Sil333033",
1717
fap_weburl="https://github.com/spheeere98/mifare_fuzzer",
18-
fap_version="1.2",
18+
fap_version="1.3",
1919
fap_description="App emulates Mifare Classic cards with various UIDs to check how reader reacts on them",
2020
)

apps_source_code/mifare_fuzzer/scenes/mifare_fuzzer_scene_emulator.c

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,30 +78,35 @@ bool mifare_fuzzer_scene_emulator_on_event(void* context, SceneManagerEvent even
7878
if(event.type == SceneManagerEventTypeCustom) {
7979
if(event.event == MifareFuzzerEventStartAttack) {
8080
NfcDevice* nfc_device = NULL;
81-
const MfClassicData* mf_classic_data = NULL;
8281
bool nfc_device_parsed = false;
8382
if(app->card_file_path) {
8483
nfc_device = app->worker->nfc_device;
8584
const char* path = furi_string_get_cstr(app->card_file_path);
8685
if(nfc_device_load(nfc_device, path)) {
8786
nfc_device_parsed = true;
88-
mf_classic_data = nfc_device_get_data(nfc_device, NfcProtocolMfClassic);
89-
if(mf_classic_data->type == MfClassicType1k) {
90-
app->card = MifareCardClassic1k;
91-
} else if(mf_classic_data->type == MfClassicType4k) {
92-
app->card = MifareCardClassic4k;
93-
} else if(nfc_device_get_protocol(nfc_device) == NfcProtocolMfUltralight) {
87+
NfcProtocol protocol = nfc_device_get_protocol(nfc_device);
88+
if(protocol == NfcProtocolMfClassic) {
89+
const MfClassicData* mfc_data = nfc_device_get_data(nfc_device, protocol);
90+
if(mfc_data->type == MfClassicType1k) {
91+
app->card = MifareCardClassic1k;
92+
} else if(mfc_data->type == MfClassicType4k) {
93+
app->card = MifareCardClassic4k;
94+
} else {
95+
nfc_device_parsed = false;
96+
}
97+
} else if(protocol == NfcProtocolMfUltralight) {
9498
app->card = MifareCardUltralight;
9599
}
96-
mifare_fuzzer_emulator_set_card(emulator, app->card, app->card_file_path);
100+
if(nfc_device_parsed) {
101+
mifare_fuzzer_emulator_set_card(emulator, app->card, app->card_file_path);
102+
}
97103
}
98104
}
99105

100-
Iso14443_3aData* nfc_data;
101-
if(mf_classic_data) {
102-
nfc_data = mf_classic_data->iso14443_3a_data;
103-
} else {
104-
nfc_data = iso14443_3a_alloc();
106+
Iso14443_3aData* nfc_data = iso14443_3a_alloc();
107+
if(nfc_device_parsed) {
108+
iso14443_3a_copy(
109+
nfc_data, nfc_device_get_data(nfc_device, NfcProtocolIso14443_3a));
105110
}
106111

107112
// Stop worker

0 commit comments

Comments
 (0)