fix the field is off check

This commit is contained in:
iceman1001 2024-01-16 15:49:35 +01:00
commit 730cc21f08
2 changed files with 12 additions and 7 deletions

View file

@ -2566,6 +2566,7 @@ void SendRawCommand14443B(iso14b_raw_cmd_t *p) {
clear_trace();
BigBuf_Clear_ext(false);
}
set_tracing(true);
// receive buffer
@ -2615,10 +2616,15 @@ void SendRawCommand14443B(iso14b_raw_cmd_t *p) {
}
// if field is off...
if (s_field_on == false) {
DbpString("Field is off");
reply_ng(CMD_HF_ISO14443B_COMMAND, PM3_ERFTRANS, NULL, 0);
goto out;
if (
((p->flags & ISO14B_APDU) == ISO14B_APDU) ||
((p->flags & ISO14B_RAW) == ISO14B_RAW)
) {
if (s_field_on == false) {
DbpString("Field is off");
reply_ng(CMD_HF_ISO14443B_COMMAND, PM3_ERFTRANS, NULL, 0);
goto out;
}
}
if ((p->flags & ISO14B_APDU) == ISO14B_APDU) {

View file

@ -1963,14 +1963,14 @@ int select_card_14443b_4(bool disconnect, iso14b_card_select_t *card) {
PacketResponseNG resp;
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
PrintAndLogEx(INFO, "Trying 14B Select SRx");
PrintAndLogEx(INFO, "Trying 14B Select SRx");
// Anticollision + SELECT SR card
packet.flags = (ISO14B_CONNECT | ISO14B_SELECT_SR | ISO14B_CLEARTRACE);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
if (WaitForResponseTimeout(CMD_HF_ISO14443B_COMMAND, &resp, TIMEOUT) == false) {
PrintAndLogEx(INFO, "Trying 14B Select CTS");
PrintAndLogEx(INFO, "Trying 14B Select CTS");
// Anticollision + SELECT ASK C-Ticket card
packet.flags = (ISO14B_CONNECT | ISO14B_SELECT_CTS | ISO14B_CLEARTRACE);
SendCommandNG(CMD_HF_ISO14443B_COMMAND, (uint8_t *)&packet, sizeof(iso14b_raw_cmd_t));
@ -2118,7 +2118,6 @@ int exchange_14b_apdu(uint8_t *datain, int datainlen, bool activate_field,
if (apdu_in_framing_enable &&
((apdu_frame_length && (datainlen > apdu_frame_length - 3)) || (datainlen > PM3_CMD_DATA_SIZE - 3))) {
PrintAndLogEx(INFO, "ONE");
int clen = 0;
bool v_activate_field = activate_field;