[FL-3060] New MFC Bruteforce animation (#2190)

* Change the wording in the headers
* Add support for text in the progress bar
* New MFC key bruteforce screen
* Typo fix
* nfc: rename Flipper Dict to System Dict
* elements: fix types
* Display the correct key attack sector

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Astra
2022-12-27 11:14:03 +02:00
committed by GitHub
parent 08eb666f7b
commit ded7e727d0
15 changed files with 130 additions and 23 deletions

View File

@@ -43,7 +43,7 @@ bool nfc_scene_extra_actions_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubmenuIndexMfClassicKeys) {
if(mf_classic_dict_check_presence(MfClassicDictTypeFlipper)) {
if(mf_classic_dict_check_presence(MfClassicDictTypeSystem)) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicKeys);
} else {
scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound);

View File

@@ -53,10 +53,10 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(Nfc* nfc, DictAttackSt
// Setup view
if(state == DictAttackStateUserDictInProgress) {
worker_state = NfcWorkerStateMfClassicDictAttack;
dict_attack_set_header(nfc->dict_attack, "Mf Classic User Dict.");
dict_attack_set_header(nfc->dict_attack, "MF Classic User Dictionary");
dict = mf_classic_dict_alloc(MfClassicDictTypeUser);
// If failed to load user dictionary - try flipper dictionary
// If failed to load user dictionary - try the system dictionary
if(!dict) {
FURI_LOG_E(TAG, "User dictionary not found");
state = DictAttackStateFlipperDictInProgress;
@@ -64,11 +64,11 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(Nfc* nfc, DictAttackSt
}
if(state == DictAttackStateFlipperDictInProgress) {
worker_state = NfcWorkerStateMfClassicDictAttack;
dict_attack_set_header(nfc->dict_attack, "Mf Classic Flipper Dict.");
dict = mf_classic_dict_alloc(MfClassicDictTypeFlipper);
dict_attack_set_header(nfc->dict_attack, "MF Classic System Dictionary");
dict = mf_classic_dict_alloc(MfClassicDictTypeSystem);
if(!dict) {
FURI_LOG_E(TAG, "Flipper dictionary not found");
// Pass through to let worker handle the failure
// Pass through to let the worker handle the failure
}
}
// Free previous dictionary
@@ -153,6 +153,15 @@ bool nfc_scene_mf_classic_dict_attack_on_event(void* context, SceneManagerEvent
nfc_worker_stop(nfc->worker);
consumed = true;
}
} else if(event.event == NfcWorkerEventKeyAttackStart) {
dict_attack_set_key_attack(
nfc->dict_attack,
true,
nfc->dev->dev_data.mf_classic_dict_attack_data.current_sector);
} else if(event.event == NfcWorkerEventKeyAttackStop) {
dict_attack_set_key_attack(nfc->dict_attack, false, 0);
} else if(event.event == NfcWorkerEventKeyAttackNextSector) {
dict_attack_inc_key_attack_current_sector(nfc->dict_attack);
}
} else if(event.type == SceneManagerEventTypeBack) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneExitConfirm);

View File

@@ -12,7 +12,7 @@ void nfc_scene_mf_classic_keys_on_enter(void* context) {
// Load flipper dict keys total
uint32_t flipper_dict_keys_total = 0;
MfClassicDict* dict = mf_classic_dict_alloc(MfClassicDictTypeFlipper);
MfClassicDict* dict = mf_classic_dict_alloc(MfClassicDictTypeSystem);
if(dict) {
flipper_dict_keys_total = mf_classic_dict_get_total_keys(dict);
mf_classic_dict_free(dict);
@@ -26,11 +26,11 @@ void nfc_scene_mf_classic_keys_on_enter(void* context) {
}
widget_add_string_element(
nfc->widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "Mifare Classic Keys");
nfc->widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "MIFARE Classic Keys");
char temp_str[32];
snprintf(temp_str, sizeof(temp_str), "Flipper list: %lu", flipper_dict_keys_total);
snprintf(temp_str, sizeof(temp_str), "System dict: %lu", flipper_dict_keys_total);
widget_add_string_element(nfc->widget, 0, 20, AlignLeft, AlignTop, FontSecondary, temp_str);
snprintf(temp_str, sizeof(temp_str), "User list: %lu", user_dict_keys_total);
snprintf(temp_str, sizeof(temp_str), "User dict: %lu", user_dict_keys_total);
widget_add_string_element(nfc->widget, 0, 32, AlignLeft, AlignTop, FontSecondary, temp_str);
widget_add_button_element(
nfc->widget, GuiButtonTypeCenter, "Add", nfc_scene_mf_classic_keys_widget_callback, nfc);

View File

@@ -91,7 +91,7 @@ bool nfc_scene_read_on_event(void* context, SceneManagerEvent event) {
DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
consumed = true;
} else if(event.event == NfcWorkerEventReadMfClassicDictAttackRequired) {
if(mf_classic_dict_check_presence(MfClassicDictTypeFlipper)) {
if(mf_classic_dict_check_presence(MfClassicDictTypeSystem)) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicDictAttack);
} else {
scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound);