mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-12-03 17:59:16 +00:00
[FL-3064] Skip the read when the card is not present (#2494)
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
e90042368f
commit
6aa0c08f3a
3 changed files with 12 additions and 1 deletions
|
@ -115,7 +115,8 @@ bool nfc_scene_mf_classic_dict_attack_on_event(void* context, SceneManagerEvent
|
|||
consumed = true;
|
||||
}
|
||||
} else if(event.event == NfcWorkerEventAborted) {
|
||||
if(state == DictAttackStateUserDictInProgress) {
|
||||
if(state == DictAttackStateUserDictInProgress &&
|
||||
dict_attack_get_card_state(nfc->dict_attack)) {
|
||||
nfc_scene_mf_classic_dict_attack_prepare_view(nfc, state);
|
||||
consumed = true;
|
||||
} else {
|
||||
|
|
|
@ -11,6 +11,7 @@ struct DictAttack {
|
|||
View* view;
|
||||
DictAttackCallback callback;
|
||||
void* context;
|
||||
bool card_present;
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
|
@ -162,6 +163,7 @@ void dict_attack_set_header(DictAttack* dict_attack, const char* header) {
|
|||
|
||||
void dict_attack_set_card_detected(DictAttack* dict_attack, MfClassicType type) {
|
||||
furi_assert(dict_attack);
|
||||
dict_attack->card_present = true;
|
||||
with_view_model(
|
||||
dict_attack->view,
|
||||
DictAttackViewModel * model,
|
||||
|
@ -175,6 +177,7 @@ void dict_attack_set_card_detected(DictAttack* dict_attack, MfClassicType type)
|
|||
|
||||
void dict_attack_set_card_removed(DictAttack* dict_attack) {
|
||||
furi_assert(dict_attack);
|
||||
dict_attack->card_present = false;
|
||||
with_view_model(
|
||||
dict_attack->view,
|
||||
DictAttackViewModel * model,
|
||||
|
@ -182,6 +185,11 @@ void dict_attack_set_card_removed(DictAttack* dict_attack) {
|
|||
true);
|
||||
}
|
||||
|
||||
bool dict_attack_get_card_state(DictAttack* dict_attack) {
|
||||
furi_assert(dict_attack);
|
||||
return dict_attack->card_present;
|
||||
}
|
||||
|
||||
void dict_attack_set_sector_read(DictAttack* dict_attack, uint8_t sec_read) {
|
||||
furi_assert(dict_attack);
|
||||
with_view_model(
|
||||
|
|
|
@ -25,6 +25,8 @@ void dict_attack_set_card_detected(DictAttack* dict_attack, MfClassicType type);
|
|||
|
||||
void dict_attack_set_card_removed(DictAttack* dict_attack);
|
||||
|
||||
bool dict_attack_get_card_state(DictAttack* dict_attack);
|
||||
|
||||
void dict_attack_set_sector_read(DictAttack* dict_attack, uint8_t sec_read);
|
||||
|
||||
void dict_attack_set_keys_found(DictAttack* dict_attack, uint8_t keys_found);
|
||||
|
|
Loading…
Reference in a new issue