mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
Improve Hitag µ error reason and messages
This commit is contained in:
parent
93c6250894
commit
2c9a74b906
2 changed files with 13 additions and 29 deletions
|
@ -540,7 +540,7 @@ static int htu_select_tag(const lf_hitag_data_t *payload, uint8_t *tx, size_t si
|
||||||
// Check if the response is valid
|
// Check if the response is valid
|
||||||
if (rxlen < 1 + 48 + 16 || Crc16(rx, rxlen, 0, CRC16_POLY_CCITT, false, false) != 0) {
|
if (rxlen < 1 + 48 + 16 || Crc16(rx, rxlen, 0, CRC16_POLY_CCITT, false, false) != 0) {
|
||||||
DBG Dbprintf("Read UID command failed! %i", rxlen);
|
DBG Dbprintf("Read UID command failed! %i", rxlen);
|
||||||
return -1; // Read UID failed
|
return -2; // Read UID failed
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the UID from the response
|
// Process the UID from the response
|
||||||
|
@ -565,7 +565,7 @@ static int htu_select_tag(const lf_hitag_data_t *payload, uint8_t *tx, size_t si
|
||||||
if (rxlen < 1 + 16 + 16 || Crc16(rx, rxlen, 0, CRC16_POLY_CCITT, false, false) != 0) {
|
if (rxlen < 1 + 16 + 16 || Crc16(rx, rxlen, 0, CRC16_POLY_CCITT, false, false) != 0) {
|
||||||
// 8265 bug? sometile lost Data field first bit
|
// 8265 bug? sometile lost Data field first bit
|
||||||
DBG Dbprintf("Get System Information command failed! %i", rxlen);
|
DBG Dbprintf("Get System Information command failed! %i", rxlen);
|
||||||
return -2; // Get System Information failed
|
return -3; // Get System Information failed
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Read config block
|
// 3. Read config block
|
||||||
|
@ -590,7 +590,7 @@ static int htu_select_tag(const lf_hitag_data_t *payload, uint8_t *tx, size_t si
|
||||||
// Check if the response is valid
|
// Check if the response is valid
|
||||||
if (rxlen < 1 + 32 + 16 || Crc16(rx, rxlen, 0, CRC16_POLY_CCITT, false, false) != 0) {
|
if (rxlen < 1 + 32 + 16 || Crc16(rx, rxlen, 0, CRC16_POLY_CCITT, false, false) != 0) {
|
||||||
DBG Dbprintf("Read config block command failed! %i", rxlen);
|
DBG Dbprintf("Read config block command failed! %i", rxlen);
|
||||||
return -2; // Read config block failed
|
return -3; // Read config block failed
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process the config block from the response
|
// Process the config block from the response
|
||||||
|
@ -616,7 +616,7 @@ static int htu_select_tag(const lf_hitag_data_t *payload, uint8_t *tx, size_t si
|
||||||
// Check if login succeeded
|
// Check if login succeeded
|
||||||
if (rxlen < 1 + 16 || Crc16(rx, rxlen, 0, CRC16_POLY_CCITT, false, false) != 0) {
|
if (rxlen < 1 + 16 || Crc16(rx, rxlen, 0, CRC16_POLY_CCITT, false, false) != 0) {
|
||||||
DBG Dbprintf("Login command failed! %i", rxlen);
|
DBG Dbprintf("Login command failed! %i", rxlen);
|
||||||
return -3; // Login failed
|
return -4; // Login failed
|
||||||
} else {
|
} else {
|
||||||
DBG DbpString("Login successful");
|
DBG DbpString("Login successful");
|
||||||
}
|
}
|
||||||
|
@ -772,14 +772,14 @@ void htu_read(const lf_hitag_data_t *payload, bool ledcontrol) {
|
||||||
|
|
||||||
if (flags & HITAGU_FLAG_CRCT && Crc16(rx, rxlen, 0, CRC16_POLY_CCITT, false, false) != 0) {
|
if (flags & HITAGU_FLAG_CRCT && Crc16(rx, rxlen, 0, CRC16_POLY_CCITT, false, false) != 0) {
|
||||||
DBG Dbprintf("Error: response CRC invalid");
|
DBG Dbprintf("Error: response CRC invalid");
|
||||||
card.pages_reason[i] = -1;
|
card.pages_reason[i] = -6;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check response
|
// Check response
|
||||||
if (rxlen < 1 + HITAGU_BLOCK_SIZE * 8 + (flags & HITAGU_FLAG_CRCT ? 16 : 0)) {
|
if (rxlen < 1 + HITAGU_BLOCK_SIZE * 8 + (flags & HITAGU_FLAG_CRCT ? 16 : 0)) {
|
||||||
DbpString("Error: invalid response received after read command");
|
DbpString("Error: invalid response received after read command");
|
||||||
card.pages_reason[i] = -11;
|
card.pages_reason[i] = -7;
|
||||||
} else {
|
} else {
|
||||||
DBG Dbprintf("Read successful, response: %d bits", rxlen);
|
DBG Dbprintf("Read successful, response: %d bits", rxlen);
|
||||||
// todo: For certain pages, update our cached data
|
// todo: For certain pages, update our cached data
|
||||||
|
@ -885,7 +885,7 @@ void htu_write_page(const lf_hitag_data_t *payload, bool ledcontrol) {
|
||||||
status = PM3_ENODATA;
|
status = PM3_ENODATA;
|
||||||
} else if (rxlen != 1 + 16) {
|
} else if (rxlen != 1 + 16) {
|
||||||
DbpString("Error: htu_write_page No valid response received after write command");
|
DbpString("Error: htu_write_page No valid response received after write command");
|
||||||
reason = -1;
|
reason = -5;
|
||||||
status = PM3_ERFTRANS;
|
status = PM3_ERFTRANS;
|
||||||
} else {
|
} else {
|
||||||
DBG Dbprintf("Write successful, response: %d bits", rxlen);
|
DBG Dbprintf("Write successful, response: %d bits", rxlen);
|
||||||
|
|
|
@ -253,46 +253,30 @@ static void print_error(int8_t reason) {
|
||||||
//todo: USE ENUM OR DEFINES
|
//todo: USE ENUM OR DEFINES
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case 0: {
|
case 0: {
|
||||||
PrintAndLogEx(FAILED, "No data");
|
PrintAndLogEx(INFO, "No data");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case -2: {
|
case -2: {
|
||||||
PrintAndLogEx(FAILED, "UID Request failed!");
|
PrintAndLogEx(FAILED, "READ UID failed!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case -3: {
|
case -3: {
|
||||||
PrintAndLogEx(FAILED, "Select UID failed!");
|
PrintAndLogEx(FAILED, "Get System Information / Config failed!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case -4: {
|
case -4: {
|
||||||
PrintAndLogEx(FAILED, "No write access on block. Not authorized?");
|
PrintAndLogEx(FAILED, "Login failed! Wrong password?");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case -5: {
|
case -5: {
|
||||||
PrintAndLogEx(FAILED, "Write failed! Wrong password?");
|
PrintAndLogEx(FAILED, "No write access on block. Not authorized?");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case -6: {
|
case -6: {
|
||||||
PrintAndLogEx(FAILED, "Error, " _YELLOW_("AUT=1") " This tag is configured in Authentication Mode");
|
PrintAndLogEx(FAILED, "Response CRC invalid!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case -7: {
|
case -7: {
|
||||||
PrintAndLogEx(FAILED, "Error, unknown function");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case -8: {
|
|
||||||
PrintAndLogEx(FAILED, "Authenticate failed!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case -9: {
|
|
||||||
PrintAndLogEx(FAILED, "No write access on block");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case -10: {
|
|
||||||
PrintAndLogEx(FAILED, "Write to block failed!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case -11: {
|
|
||||||
PrintAndLogEx(FAILED, "Read block failed!");
|
PrintAndLogEx(FAILED, "Read block failed!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue