mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
chg: 'hf mfu info' - ndef parsing was a bit wrong
This commit is contained in:
parent
31a531f1d0
commit
b08b1c2cd9
1 changed files with 61 additions and 5 deletions
|
@ -686,11 +686,56 @@ static int ndef_print_CC(uint8_t *data) {
|
|||
if (data[0] != 0xE1)
|
||||
return -1;
|
||||
|
||||
// b7, b6 major version
|
||||
// b5, b4 minor version
|
||||
// b3, b2 read
|
||||
// 00 always, 01 rfu, 10 proprietary, 11 rfu
|
||||
// b1, b0 write
|
||||
// 00 always, 01 rfo, 10 proprietary, 11 never
|
||||
uint8_t write = data[1] & 0x03;
|
||||
uint8_t read = (data[1] & 0x0C) >> 2;
|
||||
uint8_t minor = (data[1] & 0x30) >> 4;
|
||||
uint8_t major = (data[1] & 0xC0) >> 6;
|
||||
|
||||
char wStr[50];
|
||||
switch ( write ) {
|
||||
case 0:
|
||||
sprintf(wStr, "Write access granted without any security");
|
||||
break;
|
||||
case 1:
|
||||
sprintf(wStr, "RFU");
|
||||
break;
|
||||
case 2:
|
||||
sprintf(wStr, "Proprietary");
|
||||
break;
|
||||
case 3:
|
||||
sprintf(wStr, "No write access");
|
||||
break;
|
||||
}
|
||||
char rStr[46];
|
||||
switch ( read ) {
|
||||
case 0:
|
||||
sprintf(rStr, "Read access granted without any security");
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
sprintf(rStr, "RFU");
|
||||
break;
|
||||
case 2:
|
||||
sprintf(rStr, "Proprietary");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
PrintAndLogEx(NORMAL, "--- NDEF Message");
|
||||
PrintAndLogEx(NORMAL, "Capability Container: %s", sprint_hex(data, 4));
|
||||
PrintAndLogEx(NORMAL, " %02X : NDEF Magic Number", data[0]);
|
||||
PrintAndLogEx(NORMAL, " %02X : version %d.%d supported by tag", data[1], (data[1] & 0xF0) >> 4, data[1] & 0x0F);
|
||||
PrintAndLogEx(NORMAL, " %02X : Physical Memory Size: %d bytes", data[2], (data[2] + 1) * 4);
|
||||
|
||||
// PrintAndLogEx(NORMAL, " %02X : version %d.%d supported by tag", data[1], (data[1] & 0xF0) >> 4, data[1] & 0x0F);
|
||||
PrintAndLogEx(NORMAL, " %02X : version %d.%d supported by tag", data[1], major, minor);
|
||||
PrintAndLogEx(NORMAL, " : %s / %s", rStr, wStr);
|
||||
|
||||
PrintAndLogEx(NORMAL, " %02X : Physical Memory Size: %d bytes", data[2], data[2] * 8);
|
||||
if (data[2] == 0x96)
|
||||
PrintAndLogEx(NORMAL, " %02X : NDEF Memory Size: %d bytes", data[2], 48);
|
||||
else if (data[2] == 0x12)
|
||||
|
@ -700,9 +745,20 @@ static int ndef_print_CC(uint8_t *data) {
|
|||
else if (data[2] == 0x6D)
|
||||
PrintAndLogEx(NORMAL, " %02X : NDEF Memory Size: %d bytes", data[2], 872);
|
||||
|
||||
PrintAndLogEx(NORMAL, " %02X : %s / %s", data[3],
|
||||
(data[3] & 0xF0) ? "(RFU)" : "Read access granted without any security",
|
||||
(data[3] & 0x0F) == 0 ? "Write access granted without any security" : (data[3] & 0x0F) == 0x0F ? "No write access granted at all" : "(RFU)");
|
||||
uint8_t msb3 = (data[3] & 0xE0) >> 5;
|
||||
uint8_t sf = (data[3] & 0x10) >> 4;
|
||||
uint8_t lb = (data[3] & 0x08) >> 3;
|
||||
uint8_t mlrule = (data[3] & 0x06) >> 1;
|
||||
uint8_t mbread = (data[3] & 0x01);
|
||||
|
||||
PrintAndLogEx(NORMAL, " Additional feature information");
|
||||
PrintAndLogEx(NORMAL, " %02X", data[3]);
|
||||
PrintAndLogEx(NORMAL, " 00000000");
|
||||
PrintAndLogEx(NORMAL, " xxx - %02X : RFU (%s)", msb3, (msb3 == 0) ? _GREEN_("OK") : _RED_("Fail"));
|
||||
PrintAndLogEx(NORMAL, " x - %02X : %s special frame", sf, (sf) ? "support" : "don\'t support");
|
||||
PrintAndLogEx(NORMAL, " x - %02X : %s lock block", lb, (lb) ? "support" : "don\'t support");
|
||||
PrintAndLogEx(NORMAL, " xx - %02X : RFU (%s)", mlrule, (mlrule == 0) ? _GREEN_("OK") : _RED_("Fail"));
|
||||
PrintAndLogEx(NORMAL, " x - %02X : IC %s multiple block reads", mbread, (mbread) ? "support" : "don\'t support");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue