@@ -41,19 +41,21 @@ void mifare_fuzzer_scene_emulator_on_enter(void* context) {
41
41
mifare_fuzzer_emulator_set_ticks_between_cards (
42
42
app -> emulator_view , emulator -> ticks_between_cards );
43
43
// init default card data
44
- FuriHalNfcDevData nfc_dev_data ;
45
- nfc_dev_data .atqa [0 ] = 0x00 ;
46
- nfc_dev_data .atqa [1 ] = 0x00 ;
47
- nfc_dev_data .sak = 0x00 ;
44
+ Iso14443_3aData nfc_data ;
45
+ nfc_data .atqa [0 ] = 0x00 ;
46
+ nfc_data .atqa [1 ] = 0x00 ;
47
+ nfc_data .sak = 0x00 ;
48
48
if (app -> card == MifareCardUltralight ) {
49
- nfc_dev_data .uid_len = 0x07 ;
49
+ nfc_data .uid_len = 0x07 ;
50
50
} else {
51
- nfc_dev_data .uid_len = 0x04 ;
51
+ nfc_data .uid_len = 0x04 ;
52
52
}
53
- for (uint32_t i = 0 ; i < nfc_dev_data .uid_len ; i ++ ) {
54
- nfc_dev_data .uid [i ] = 0x00 ;
53
+ for (uint32_t i = 0 ; i < nfc_data .uid_len ; i ++ ) {
54
+ nfc_data .uid [i ] = 0x00 ;
55
55
}
56
- mifare_fuzzer_emulator_set_nfc_dev_data (app -> emulator_view , nfc_dev_data );
56
+
57
+ mifare_fuzzer_emulator_set_nfc_data (app -> emulator_view , nfc_data );
58
+
57
59
// init other vars
58
60
attack_step = 0 ;
59
61
@@ -67,7 +69,7 @@ void mifare_fuzzer_scene_emulator_on_enter(void* context) {
67
69
/// @return
68
70
bool mifare_fuzzer_scene_emulator_on_event (void * context , SceneManagerEvent event ) {
69
71
//FURI_LOG_D(TAG, "mifare_fuzzer_scene_emulator_on_event()");
70
- FuriHalNfcDevData nfc_dev_data ;
72
+ Iso14443_3aData nfc_data ;
71
73
72
74
MifareFuzzerApp * app = context ;
73
75
MifareFuzzerEmulator * emulator = app -> emulator_view ;
@@ -84,27 +86,27 @@ bool mifare_fuzzer_scene_emulator_on_event(void* context, SceneManagerEvent even
84
86
// Set card type
85
87
// TODO: Move somewhere else, I do not like this to be there
86
88
if (app -> card == MifareCardClassic1k ) {
87
- nfc_dev_data .atqa [0 ] = 0x04 ;
88
- nfc_dev_data .atqa [1 ] = 0x00 ;
89
- nfc_dev_data .sak = 0x08 ;
90
- nfc_dev_data .uid_len = 0x04 ;
89
+ nfc_data .atqa [0 ] = 0x04 ;
90
+ nfc_data .atqa [1 ] = 0x00 ;
91
+ nfc_data .sak = 0x08 ;
92
+ nfc_data .uid_len = 0x04 ;
91
93
} else if (app -> card == MifareCardClassic4k ) {
92
- nfc_dev_data .atqa [0 ] = 0x02 ;
93
- nfc_dev_data .atqa [1 ] = 0x00 ;
94
- nfc_dev_data .sak = 0x18 ;
95
- nfc_dev_data .uid_len = 0x04 ;
94
+ nfc_data .atqa [0 ] = 0x02 ;
95
+ nfc_data .atqa [1 ] = 0x00 ;
96
+ nfc_data .sak = 0x18 ;
97
+ nfc_data .uid_len = 0x04 ;
96
98
} else if (app -> card == MifareCardUltralight ) {
97
- nfc_dev_data .atqa [0 ] = 0x44 ;
98
- nfc_dev_data .atqa [1 ] = 0x00 ;
99
- nfc_dev_data .sak = 0x00 ;
100
- nfc_dev_data .uid_len = 0x07 ;
99
+ nfc_data .atqa [0 ] = 0x44 ;
100
+ nfc_data .atqa [1 ] = 0x00 ;
101
+ nfc_data .sak = 0x00 ;
102
+ nfc_data .uid_len = 0x07 ;
101
103
}
102
104
103
105
// Set UIDs
104
106
if (app -> attack == MifareFuzzerAttackTestValues ) {
105
107
// Load test UIDs
106
- for (uint8_t i = 0 ; i < nfc_dev_data .uid_len ; i ++ ) {
107
- nfc_dev_data .uid [i ] = id_uid_test [attack_step ][i ];
108
+ for (uint8_t i = 0 ; i < nfc_data .uid_len ; i ++ ) {
109
+ nfc_data .uid [i ] = id_uid_test [attack_step ][i ];
108
110
}
109
111
// Next UIDs on next loop
110
112
if (attack_step >= 8 ) {
@@ -121,13 +123,13 @@ bool mifare_fuzzer_scene_emulator_on_event(void* context, SceneManagerEvent even
121
123
122
124
// TODO: Manufacture-code must be selectable from a list
123
125
// use a fixed manufacture-code for now: 0x04 = NXP Semiconductors Germany
124
- nfc_dev_data .uid [0 ] = 0x04 ;
125
- for (uint8_t i = 1 ; i < nfc_dev_data .uid_len ; i ++ ) {
126
- nfc_dev_data .uid [i ] = (furi_hal_random_get () & 0xFF );
126
+ nfc_data .uid [0 ] = 0x04 ;
127
+ for (uint8_t i = 1 ; i < nfc_data .uid_len ; i ++ ) {
128
+ nfc_data .uid [i ] = (furi_hal_random_get () & 0xFF );
127
129
}
128
130
} else {
129
- for (uint8_t i = 0 ; i < nfc_dev_data .uid_len ; i ++ ) {
130
- nfc_dev_data .uid [i ] = (furi_hal_random_get () & 0xFF );
131
+ for (uint8_t i = 0 ; i < nfc_data .uid_len ; i ++ ) {
132
+ nfc_data .uid [i ] = (furi_hal_random_get () & 0xFF );
131
133
}
132
134
}
133
135
} else if (app -> attack == MifareFuzzerAttackLoadUidsFromFile ) {
@@ -155,21 +157,21 @@ bool mifare_fuzzer_scene_emulator_on_event(void* context, SceneManagerEvent even
155
157
156
158
// parse string to UID
157
159
// TODO: a better validation on input?
158
- for (uint8_t i = 0 ; i < nfc_dev_data .uid_len ; i ++ ) {
160
+ for (uint8_t i = 0 ; i < nfc_data .uid_len ; i ++ ) {
159
161
if (i <= ((furi_string_size (app -> uid_str ) - 1 ) / 2 )) {
160
162
char temp_str [3 ];
161
163
temp_str [0 ] = furi_string_get_cstr (app -> uid_str )[i * 2 ];
162
164
temp_str [1 ] = furi_string_get_cstr (app -> uid_str )[i * 2 + 1 ];
163
165
temp_str [2 ] = '\0' ;
164
- nfc_dev_data .uid [i ] = (uint8_t )strtol (temp_str , NULL , 16 );
166
+ nfc_data .uid [i ] = (uint8_t )strtol (temp_str , NULL , 16 );
165
167
} else {
166
- nfc_dev_data .uid [i ] = 0x00 ;
168
+ nfc_data .uid [i ] = 0x00 ;
167
169
}
168
170
}
169
171
}
170
172
171
- mifare_fuzzer_worker_set_nfc_dev_data (app -> worker , nfc_dev_data );
172
- mifare_fuzzer_emulator_set_nfc_dev_data (app -> emulator_view , nfc_dev_data );
173
+ mifare_fuzzer_worker_set_nfc_data (app -> worker , nfc_data );
174
+ mifare_fuzzer_emulator_set_nfc_data (app -> emulator_view , nfc_data );
173
175
174
176
// Reset tick_counter
175
177
tick_counter = 0 ;
0 commit comments