1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-12 20:49:49 +04:00

Avoid storage errors, clean up temporary files

This commit is contained in:
noproto
2024-10-04 18:41:29 -04:00
parent 00f356469e
commit 4f722a00c0

View File

@@ -171,20 +171,25 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(NfcApp* instance) {
do { do {
instance->nfc_dict_context.enhanced_dict = true; instance->nfc_dict_context.enhanced_dict = true;
// TODO: Check for errors if(keys_dict_check_presence(NFC_APP_MF_CLASSIC_DICT_SYSTEM_NESTED_PATH)) {
storage_common_remove(instance->storage, NFC_APP_MF_CLASSIC_DICT_SYSTEM_NESTED_PATH); storage_common_remove(
instance->storage, NFC_APP_MF_CLASSIC_DICT_SYSTEM_NESTED_PATH);
}
if(keys_dict_check_presence(NFC_APP_MF_CLASSIC_DICT_SYSTEM_PATH)) {
storage_common_copy( storage_common_copy(
instance->storage, instance->storage,
NFC_APP_MF_CLASSIC_DICT_SYSTEM_PATH, NFC_APP_MF_CLASSIC_DICT_SYSTEM_PATH,
NFC_APP_MF_CLASSIC_DICT_SYSTEM_NESTED_PATH); NFC_APP_MF_CLASSIC_DICT_SYSTEM_NESTED_PATH);
}
if(!keys_dict_check_presence(NFC_APP_MF_CLASSIC_DICT_USER_PATH)) { if(!keys_dict_check_presence(NFC_APP_MF_CLASSIC_DICT_USER_PATH)) {
state = DictAttackStateSystemDictInProgress; state = DictAttackStateSystemDictInProgress;
break; break;
} }
// TODO: Check for errors if(keys_dict_check_presence(NFC_APP_MF_CLASSIC_DICT_USER_NESTED_PATH)) {
storage_common_remove(instance->storage, NFC_APP_MF_CLASSIC_DICT_USER_NESTED_PATH); storage_common_remove(instance->storage, NFC_APP_MF_CLASSIC_DICT_USER_NESTED_PATH);
}
storage_common_copy( storage_common_copy(
instance->storage, instance->storage,
NFC_APP_MF_CLASSIC_DICT_USER_PATH, NFC_APP_MF_CLASSIC_DICT_USER_PATH,
@@ -376,6 +381,14 @@ void nfc_scene_mf_classic_dict_attack_on_exit(void* context) {
instance->nfc_dict_context.msb_count = 0; instance->nfc_dict_context.msb_count = 0;
instance->nfc_dict_context.enhanced_dict = false; instance->nfc_dict_context.enhanced_dict = false;
// Clean up temporary files used for nested dictionary attack
if(keys_dict_check_presence(NFC_APP_MF_CLASSIC_DICT_USER_NESTED_PATH)) {
storage_common_remove(instance->storage, NFC_APP_MF_CLASSIC_DICT_USER_NESTED_PATH);
}
if(keys_dict_check_presence(NFC_APP_MF_CLASSIC_DICT_SYSTEM_NESTED_PATH)) {
storage_common_remove(instance->storage, NFC_APP_MF_CLASSIC_DICT_SYSTEM_NESTED_PATH);
}
nfc_blink_stop(instance); nfc_blink_stop(instance);
notification_message(instance->notifications, &sequence_display_backlight_enforce_auto); notification_message(instance->notifications, &sequence_display_backlight_enforce_auto);
} }