NFC CLI: Fix multiple apdu commands from not working when one of them gives an empty response (#2922)
* NFC CLI: Fix multiple apdu commands from not working when one of them gives an empty response * Make PVS happy Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
a7aef0bfc2
commit
cf6706c42e
@ -146,7 +146,7 @@ static void nfc_cli_apdu(Cli* cli, FuriString* args) {
|
|||||||
resp_size = (tx_rx.rx_bits / 8) * 2;
|
resp_size = (tx_rx.rx_bits / 8) * 2;
|
||||||
if(!resp_size) {
|
if(!resp_size) {
|
||||||
printf("No response\r\n");
|
printf("No response\r\n");
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
resp_buffer = malloc(resp_size);
|
resp_buffer = malloc(resp_size);
|
||||||
uint8_to_hex_chars(tx_rx.rx_data, resp_buffer, resp_size);
|
uint8_to_hex_chars(tx_rx.rx_data, resp_buffer, resp_size);
|
||||||
|
|||||||
@ -946,13 +946,13 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
|
|||||||
}
|
}
|
||||||
if(!mf_classic_is_key_found(data, i, MfClassicKeyB)) {
|
if(!mf_classic_is_key_found(data, i, MfClassicKeyB)) {
|
||||||
if(mf_classic_authenticate_skip_activate(
|
if(mf_classic_authenticate_skip_activate(
|
||||||
&tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) {
|
&tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) { //-V547
|
||||||
FURI_LOG_D(TAG, "Key B found: %012llX", key);
|
FURI_LOG_D(TAG, "Key B found: %012llX", key);
|
||||||
mf_classic_set_key_found(data, i, MfClassicKeyB, key);
|
mf_classic_set_key_found(data, i, MfClassicKeyB, key);
|
||||||
nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context);
|
nfc_worker->callback(NfcWorkerEventFoundKeyB, nfc_worker->context);
|
||||||
nfc_worker_mf_classic_key_attack(nfc_worker, key, &tx_rx, i + 1);
|
nfc_worker_mf_classic_key_attack(nfc_worker, key, &tx_rx, i + 1);
|
||||||
}
|
}
|
||||||
deactivated = true;
|
deactivated = true; //-V1048
|
||||||
} else {
|
} else {
|
||||||
// If the key B is marked as found and matches the searching key, invalidate it
|
// If the key B is marked as found and matches the searching key, invalidate it
|
||||||
MfClassicSectorTrailer* sec_trailer =
|
MfClassicSectorTrailer* sec_trailer =
|
||||||
@ -964,12 +964,12 @@ void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
|
|||||||
if(mf_classic_is_key_found(data, i, MfClassicKeyB) &&
|
if(mf_classic_is_key_found(data, i, MfClassicKeyB) &&
|
||||||
memcmp(sec_trailer->key_b, current_key, 6) == 0) {
|
memcmp(sec_trailer->key_b, current_key, 6) == 0) {
|
||||||
if(!mf_classic_authenticate_skip_activate(
|
if(!mf_classic_authenticate_skip_activate(
|
||||||
&tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) {
|
&tx_rx, block_num, key, MfClassicKeyB, !deactivated, cuid)) { //-V547
|
||||||
mf_classic_set_key_not_found(data, i, MfClassicKeyB);
|
mf_classic_set_key_not_found(data, i, MfClassicKeyB);
|
||||||
FURI_LOG_D(TAG, "Key %dB not found in attack", i);
|
FURI_LOG_D(TAG, "Key %dB not found in attack", i);
|
||||||
}
|
}
|
||||||
furi_hal_nfc_sleep();
|
furi_hal_nfc_sleep();
|
||||||
deactivated = true;
|
deactivated = true; //-V1048
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mf_classic_is_key_found(data, i, MfClassicKeyA) &&
|
if(mf_classic_is_key_found(data, i, MfClassicKeyA) &&
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user