mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2025-09-28 20:42:51 +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);
|
nfc_scene_mf_ultralight_c_dict_attack_prepare_view(instance);
|
||||||
instance->poller = nfc_poller_alloc(instance->nfc, NfcProtocolMfUltralight);
|
instance->poller = nfc_poller_alloc(instance->nfc, NfcProtocolMfUltralight);
|
||||||
nfc_poller_start(
|
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;
|
consumed = true;
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
nfc_scene_mf_ultralight_c_dict_attack_prepare_view(instance);
|
||||||
instance->poller = nfc_poller_alloc(instance->nfc, NfcProtocolMfUltralight);
|
instance->poller = nfc_poller_alloc(instance->nfc, NfcProtocolMfUltralight);
|
||||||
nfc_poller_start(
|
nfc_poller_start(
|
||||||
instance->poller,
|
instance->poller, nfc_mf_ultralight_c_dict_attack_worker_callback, instance);
|
||||||
nfc_mf_ultralight_c_dict_attack_worker_callback,
|
|
||||||
instance);
|
|
||||||
} else {
|
} else {
|
||||||
notification_message(instance->notifications, &sequence_semi_success);
|
notification_message(instance->notifications, &sequence_semi_success);
|
||||||
scene_manager_next_scene(instance->scene_manager, NfcSceneReadSuccess);
|
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);
|
snprintf(draw_str, sizeof(draw_str), "%d/%zu", 1, m->dict_keys_total);
|
||||||
} else {
|
} else {
|
||||||
snprintf(
|
snprintf(
|
||||||
draw_str,
|
draw_str, sizeof(draw_str), "%zu/%zu", m->dict_keys_current, m->dict_keys_total);
|
||||||
sizeof(draw_str),
|
|
||||||
"%zu/%zu",
|
|
||||||
m->dict_keys_current,
|
|
||||||
m->dict_keys_total);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(dict_progress > 1.0f) {
|
if(dict_progress > 1.0f) {
|
||||||
@@ -142,8 +138,7 @@ static void dict_attack_draw_mf_classic(Canvas* canvas, DictAttackViewModel* m)
|
|||||||
m->keys_found,
|
m->keys_found,
|
||||||
m->sectors_total * NFC_CLASSIC_KEYS_PER_SECTOR);
|
m->sectors_total * NFC_CLASSIC_KEYS_PER_SECTOR);
|
||||||
canvas_draw_str_aligned(canvas, 0, 33, AlignLeft, AlignTop, draw_str);
|
canvas_draw_str_aligned(canvas, 0, 33, AlignLeft, AlignTop, draw_str);
|
||||||
snprintf(
|
snprintf(draw_str, sizeof(draw_str), "Sectors Read: %d/%d", m->sectors_read, m->sectors_total);
|
||||||
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);
|
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");
|
snprintf(draw_str, sizeof(draw_str), "Trying keys");
|
||||||
canvas_draw_str_aligned(canvas, 0, 10, AlignLeft, AlignTop, draw_str);
|
canvas_draw_str_aligned(canvas, 0, 10, AlignLeft, AlignTop, draw_str);
|
||||||
|
|
||||||
float dict_progress = m->dict_keys_total == 0 ?
|
float dict_progress =
|
||||||
0 :
|
m->dict_keys_total == 0 ? 0 : (float)(m->dict_keys_current) / (float)(m->dict_keys_total);
|
||||||
(float)(m->dict_keys_current) / (float)(m->dict_keys_total);
|
|
||||||
if(m->dict_keys_current == 0) {
|
if(m->dict_keys_current == 0) {
|
||||||
snprintf(draw_str, sizeof(draw_str), "%d/%zu", 1, m->dict_keys_total);
|
snprintf(draw_str, sizeof(draw_str), "%d/%zu", 1, m->dict_keys_total);
|
||||||
} else {
|
} else {
|
||||||
snprintf(
|
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) {
|
if(dict_progress > 1.0f) {
|
||||||
dict_progress = 1.0f;
|
dict_progress = 1.0f;
|
||||||
@@ -422,40 +411,26 @@ void dict_attack_set_type(DictAttack* instance, DictAttackType type) {
|
|||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view,
|
instance->view, DictAttackViewModel * model, { model->attack_type = type; }, true);
|
||||||
DictAttackViewModel * model,
|
|
||||||
{
|
|
||||||
model->attack_type = type;
|
|
||||||
},
|
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dict_attack_set_pages_total(DictAttack* instance, uint8_t pages_total) {
|
void dict_attack_set_pages_total(DictAttack* instance, uint8_t pages_total) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view,
|
instance->view, DictAttackViewModel * model, { model->pages_total = pages_total; }, true);
|
||||||
DictAttackViewModel * model,
|
|
||||||
{ model->pages_total = pages_total; },
|
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dict_attack_set_pages_read(DictAttack* instance, uint8_t pages_read) {
|
void dict_attack_set_pages_read(DictAttack* instance, uint8_t pages_read) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view,
|
instance->view, DictAttackViewModel * model, { model->pages_read = pages_read; }, true);
|
||||||
DictAttackViewModel * model,
|
|
||||||
{ model->pages_read = pages_read; },
|
|
||||||
true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dict_attack_set_key_found(DictAttack* instance, bool key_found) {
|
void dict_attack_set_key_found(DictAttack* instance, bool key_found) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
|
|
||||||
with_view_model(
|
with_view_model(
|
||||||
instance->view,
|
instance->view, DictAttackViewModel * model, { model->key_found = key_found; }, true);
|
||||||
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;
|
instance->state = MfUltralightPollerStateReadPages;
|
||||||
return command;
|
return command;
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
FURI_LOG_D(TAG, "No key provided, skipping auth");
|
FURI_LOG_D(TAG, "No key provided, skipping auth");
|
||||||
|
Reference in New Issue
Block a user