@@ -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