mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2025-09-28 04:26:42 +02:00
Format
This commit is contained in:
@@ -174,7 +174,9 @@ bool nfc_scene_mf_ultralight_c_dict_attack_on_event(void* context, SceneManagerE
|
||||
nfc_scene_mf_ultralight_c_dict_attack_prepare_view(instance);
|
||||
instance->poller = nfc_poller_alloc(instance->nfc, NfcProtocolMfUltralight);
|
||||
nfc_poller_start(
|
||||
instance->poller, nfc_mf_ultralight_c_dict_attack_worker_callback, instance);
|
||||
instance->poller,
|
||||
nfc_mf_ultralight_c_dict_attack_worker_callback,
|
||||
instance);
|
||||
consumed = true;
|
||||
}
|
||||
} else {
|
||||
@@ -204,9 +206,7 @@ bool nfc_scene_mf_ultralight_c_dict_attack_on_event(void* context, SceneManagerE
|
||||
nfc_scene_mf_ultralight_c_dict_attack_prepare_view(instance);
|
||||
instance->poller = nfc_poller_alloc(instance->nfc, NfcProtocolMfUltralight);
|
||||
nfc_poller_start(
|
||||
instance->poller,
|
||||
nfc_mf_ultralight_c_dict_attack_worker_callback,
|
||||
instance);
|
||||
instance->poller, nfc_mf_ultralight_c_dict_attack_worker_callback, instance);
|
||||
} else {
|
||||
notification_message(instance->notifications, &sequence_semi_success);
|
||||
scene_manager_next_scene(instance->scene_manager, NfcSceneReadSuccess);
|
||||
|
@@ -123,11 +123,7 @@ static void dict_attack_draw_mf_classic(Canvas* canvas, DictAttackViewModel* m)
|
||||
snprintf(draw_str, sizeof(draw_str), "%d/%zu", 1, m->dict_keys_total);
|
||||
} else {
|
||||
snprintf(
|
||||
draw_str,
|
||||
sizeof(draw_str),
|
||||
"%zu/%zu",
|
||||
m->dict_keys_current,
|
||||
m->dict_keys_total);
|
||||
draw_str, sizeof(draw_str), "%zu/%zu", m->dict_keys_current, m->dict_keys_total);
|
||||
}
|
||||
}
|
||||
if(dict_progress > 1.0f) {
|
||||
@@ -142,8 +138,7 @@ static void dict_attack_draw_mf_classic(Canvas* canvas, DictAttackViewModel* m)
|
||||
m->keys_found,
|
||||
m->sectors_total * NFC_CLASSIC_KEYS_PER_SECTOR);
|
||||
canvas_draw_str_aligned(canvas, 0, 33, AlignLeft, AlignTop, draw_str);
|
||||
snprintf(
|
||||
draw_str, sizeof(draw_str), "Sectors Read: %d/%d", m->sectors_read, m->sectors_total);
|
||||
snprintf(draw_str, sizeof(draw_str), "Sectors Read: %d/%d", m->sectors_read, m->sectors_total);
|
||||
canvas_draw_str_aligned(canvas, 0, 43, AlignLeft, AlignTop, draw_str);
|
||||
}
|
||||
|
||||
@@ -156,18 +151,12 @@ static void dict_attack_draw_mf_ultralight_c(Canvas* canvas, DictAttackViewModel
|
||||
snprintf(draw_str, sizeof(draw_str), "Trying keys");
|
||||
canvas_draw_str_aligned(canvas, 0, 10, AlignLeft, AlignTop, draw_str);
|
||||
|
||||
float dict_progress = m->dict_keys_total == 0 ?
|
||||
0 :
|
||||
(float)(m->dict_keys_current) / (float)(m->dict_keys_total);
|
||||
float dict_progress =
|
||||
m->dict_keys_total == 0 ? 0 : (float)(m->dict_keys_current) / (float)(m->dict_keys_total);
|
||||
if(m->dict_keys_current == 0) {
|
||||
snprintf(draw_str, sizeof(draw_str), "%d/%zu", 1, m->dict_keys_total);
|
||||
} else {
|
||||
snprintf(
|
||||
draw_str,
|
||||
sizeof(draw_str),
|
||||
"%zu/%zu",
|
||||
m->dict_keys_current,
|
||||
m->dict_keys_total);
|
||||
snprintf(draw_str, sizeof(draw_str), "%zu/%zu", m->dict_keys_current, m->dict_keys_total);
|
||||
}
|
||||
if(dict_progress > 1.0f) {
|
||||
dict_progress = 1.0f;
|
||||
@@ -422,40 +411,26 @@ void dict_attack_set_type(DictAttack* instance, DictAttackType type) {
|
||||
furi_assert(instance);
|
||||
|
||||
with_view_model(
|
||||
instance->view,
|
||||
DictAttackViewModel * model,
|
||||
{
|
||||
model->attack_type = type;
|
||||
},
|
||||
true);
|
||||
instance->view, DictAttackViewModel * model, { model->attack_type = type; }, true);
|
||||
}
|
||||
|
||||
void dict_attack_set_pages_total(DictAttack* instance, uint8_t pages_total) {
|
||||
furi_assert(instance);
|
||||
|
||||
with_view_model(
|
||||
instance->view,
|
||||
DictAttackViewModel * model,
|
||||
{ model->pages_total = pages_total; },
|
||||
true);
|
||||
instance->view, DictAttackViewModel * model, { model->pages_total = pages_total; }, true);
|
||||
}
|
||||
|
||||
void dict_attack_set_pages_read(DictAttack* instance, uint8_t pages_read) {
|
||||
furi_assert(instance);
|
||||
|
||||
with_view_model(
|
||||
instance->view,
|
||||
DictAttackViewModel * model,
|
||||
{ model->pages_read = pages_read; },
|
||||
true);
|
||||
instance->view, DictAttackViewModel * model, { model->pages_read = pages_read; }, true);
|
||||
}
|
||||
|
||||
void dict_attack_set_key_found(DictAttack* instance, bool key_found) {
|
||||
furi_assert(instance);
|
||||
|
||||
with_view_model(
|
||||
instance->view,
|
||||
DictAttackViewModel * model,
|
||||
{ model->key_found = key_found; },
|
||||
true);
|
||||
instance->view, DictAttackViewModel * model, { model->key_found = key_found; }, true);
|
||||
}
|
||||
|
@@ -465,7 +465,8 @@ static NfcCommand mf_ultralight_poller_handler_auth_ultralight_c(MfUltralightPol
|
||||
instance->state = MfUltralightPollerStateReadPages;
|
||||
return command;
|
||||
} else {
|
||||
instance->auth_context.tdes_key = instance->mfu_event.data->key_request_data.key;
|
||||
instance->auth_context.tdes_key =
|
||||
instance->mfu_event.data->key_request_data.key;
|
||||
}
|
||||
} else {
|
||||
FURI_LOG_D(TAG, "No key provided, skipping auth");
|
||||
|
Reference in New Issue
Block a user