mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-14 03:03:14 +08:00
changed logs
This commit is contained in:
parent
122cbe7d1d
commit
b08ce3a1f7
1 changed files with 29 additions and 29 deletions
|
@ -119,36 +119,36 @@ int CmdHFMFPInfo(const char *cmd) {
|
||||||
uint64_t select_status = resp.arg[0]; // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision
|
uint64_t select_status = resp.arg[0]; // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision
|
||||||
|
|
||||||
if (select_status == 1 || select_status == 2) {
|
if (select_status == 1 || select_status == 2) {
|
||||||
PrintAndLogEx(INFO, "----------------------------------------------");
|
PrintAndLogEx(NORMAL, "----------------------------------------------");
|
||||||
PrintAndLogEx(INFO, "Mifare Plus info:");
|
PrintAndLogEx(NORMAL, "Mifare Plus info:");
|
||||||
|
|
||||||
// MIFARE Type Identification Procedure
|
// MIFARE Type Identification Procedure
|
||||||
// https://www.nxp.com/docs/en/application-note/AN10833.pdf
|
// https://www.nxp.com/docs/en/application-note/AN10833.pdf
|
||||||
uint16_t ATQA = card.atqa[0] + (card.atqa[1] << 8);
|
uint16_t ATQA = card.atqa[0] + (card.atqa[1] << 8);
|
||||||
if (ATQA == 0x0004) PrintAndLog("ATQA: Mifare Plus 2k 4bUID");
|
if (ATQA == 0x0004) PrintAndLogEx(INFO, "ATQA: Mifare Plus 2k 4bUID");
|
||||||
if (ATQA == 0x0002) PrintAndLog("ATQA: Mifare Plus 4k 4bUID");
|
if (ATQA == 0x0002) PrintAndLogEx(INFO, "ATQA: Mifare Plus 4k 4bUID");
|
||||||
if (ATQA == 0x0044) PrintAndLog("ATQA: Mifare Plus 2k 7bUID");
|
if (ATQA == 0x0044) PrintAndLogEx(INFO, "ATQA: Mifare Plus 2k 7bUID");
|
||||||
if (ATQA == 0x0042) PrintAndLog("ATQA: Mifare Plus 4k 7bUID");
|
if (ATQA == 0x0042) PrintAndLogEx(INFO, "ATQA: Mifare Plus 4k 7bUID");
|
||||||
|
|
||||||
uint8_t SLmode = 0xff;
|
uint8_t SLmode = 0xff;
|
||||||
if (card.sak == 0x08) {
|
if (card.sak == 0x08) {
|
||||||
PrintAndLog("SAK: Mifare Plus 2k 7bUID");
|
PrintAndLogEx(INFO, "SAK: Mifare Plus 2k 7bUID");
|
||||||
if (select_status == 2) SLmode = 1;
|
if (select_status == 2) SLmode = 1;
|
||||||
}
|
}
|
||||||
if (card.sak == 0x18) {
|
if (card.sak == 0x18) {
|
||||||
PrintAndLog("SAK: Mifare Plus 4k 7bUID");
|
PrintAndLogEx(INFO, "SAK: Mifare Plus 4k 7bUID");
|
||||||
if (select_status == 2) SLmode = 1;
|
if (select_status == 2) SLmode = 1;
|
||||||
}
|
}
|
||||||
if (card.sak == 0x10) {
|
if (card.sak == 0x10) {
|
||||||
PrintAndLog("SAK: Mifare Plus 2k");
|
PrintAndLogEx(INFO, "SAK: Mifare Plus 2k");
|
||||||
if (select_status == 2) SLmode = 2;
|
if (select_status == 2) SLmode = 2;
|
||||||
}
|
}
|
||||||
if (card.sak == 0x11) {
|
if (card.sak == 0x11) {
|
||||||
PrintAndLog("SAK: Mifare Plus 4k");
|
PrintAndLogEx(INFO, "SAK: Mifare Plus 4k");
|
||||||
if (select_status == 2) SLmode = 2;
|
if (select_status == 2) SLmode = 2;
|
||||||
}
|
}
|
||||||
if (card.sak == 0x20) {
|
if (card.sak == 0x20) {
|
||||||
PrintAndLog("SAK: Mifare Plus SL0/SL3 or Mifare desfire");
|
PrintAndLogEx(INFO, "SAK: Mifare Plus SL0/SL3 or Mifare desfire");
|
||||||
if (card.ats_len > 0) {
|
if (card.ats_len > 0) {
|
||||||
SLmode = 3;
|
SLmode = 3;
|
||||||
|
|
||||||
|
@ -529,12 +529,12 @@ int CmdHFMFPRdsc(const char *cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sectorNum > 39) {
|
if (sectorNum > 39) {
|
||||||
PrintAndLog("ERROR: <Sector Num> must be in range [0..39] instead of: %d", sectorNum);
|
PrintAndLogEx(ERR, "<Sector Num> must be in range [0..39] instead of: %d", sectorNum);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keylen != 16) {
|
if (keylen != 16) {
|
||||||
PrintAndLog("ERROR: <Key Value> must be 16 bytes long instead of: %d", keylen);
|
PrintAndLogEx(ERR, "<Key Value> must be 16 bytes long instead of: %d", keylen);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,12 +542,12 @@ int CmdHFMFPRdsc(const char *cmd) {
|
||||||
keyn[0] = uKeyNum >> 8;
|
keyn[0] = uKeyNum >> 8;
|
||||||
keyn[1] = uKeyNum & 0xff;
|
keyn[1] = uKeyNum & 0xff;
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLog("--sector[%d]:%02x key:%04x", mfNumBlocksPerSector(sectorNum), sectorNum, uKeyNum);
|
PrintAndLogEx(INFO, "--sector[%d]:%02x key:%04x", mfNumBlocksPerSector(sectorNum), sectorNum, uKeyNum);
|
||||||
|
|
||||||
mf4Session session;
|
mf4Session session;
|
||||||
int res = MifareAuth4(&session, keyn, key, true, true, verbose);
|
int res = MifareAuth4(&session, keyn, key, true, true, verbose);
|
||||||
if (res) {
|
if (res) {
|
||||||
PrintAndLog("Authentication error: %d", res);
|
PrintAndLogEx(ERR, "Authentication error: %d", res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,26 +556,26 @@ int CmdHFMFPRdsc(const char *cmd) {
|
||||||
for(int n = mfFirstBlockOfSector(sectorNum); n < mfFirstBlockOfSector(sectorNum) + mfNumBlocksPerSector(sectorNum); n++) {
|
for(int n = mfFirstBlockOfSector(sectorNum); n < mfFirstBlockOfSector(sectorNum) + mfNumBlocksPerSector(sectorNum); n++) {
|
||||||
res = MFPReadBlock(&session, plain, n & 0xff, 1, false, true, data, sizeof(data), &datalen);
|
res = MFPReadBlock(&session, plain, n & 0xff, 1, false, true, data, sizeof(data), &datalen);
|
||||||
if (res) {
|
if (res) {
|
||||||
PrintAndLog("Read error: %d", res);
|
PrintAndLogEx(ERR, "Read error: %d", res);
|
||||||
DropField();
|
DropField();
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (datalen && data[0] != 0x90) {
|
if (datalen && data[0] != 0x90) {
|
||||||
PrintAndLog("Card read error: %02x %s", data[0], GetErrorDescription(data[0]));
|
PrintAndLogEx(ERR, "Card read error: %02x %s", data[0], GetErrorDescription(data[0]));
|
||||||
DropField();
|
DropField();
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
if (datalen != 1 + 16 + 8 + 2) {
|
if (datalen != 1 + 16 + 8 + 2) {
|
||||||
PrintAndLog("Error return length:%d", datalen);
|
PrintAndLogEx(ERR, "Error return length:%d", datalen);
|
||||||
DropField();
|
DropField();
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLog("data[%03d]: %s", n, sprint_hex(&data[1], 16));
|
PrintAndLogEx(INFO, "data[%03d]: %s", n, sprint_hex(&data[1], 16));
|
||||||
|
|
||||||
if(verbose)
|
if(verbose)
|
||||||
PrintAndLog("MAC: %s", sprint_hex(&data[1 + 16], 8));
|
PrintAndLogEx(INFO, "MAC: %s", sprint_hex(&data[1 + 16], 8));
|
||||||
}
|
}
|
||||||
DropField();
|
DropField();
|
||||||
|
|
||||||
|
@ -618,17 +618,17 @@ int CmdHFMFPWrbl(const char *cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blockNum > 39) {
|
if (blockNum > 39) {
|
||||||
PrintAndLog("ERROR: <Block Num> must be in range [0..255] instead of: %d", blockNum);
|
PrintAndLogEx(ERR, "<Block Num> must be in range [0..255] instead of: %d", blockNum);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keylen != 16) {
|
if (keylen != 16) {
|
||||||
PrintAndLog("ERROR: <Key> must be 16 bytes long instead of: %d", keylen);
|
PrintAndLogEx(ERR, "<Key> must be 16 bytes long instead of: %d", keylen);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (datainlen != 16) {
|
if (datainlen != 16) {
|
||||||
PrintAndLog("ERROR: <Data> must be 16 bytes long instead of: %d", datainlen);
|
PrintAndLogEx(ERR, "<Data> must be 16 bytes long instead of: %d", datainlen);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,12 +637,12 @@ int CmdHFMFPWrbl(const char *cmd) {
|
||||||
keyn[0] = uKeyNum >> 8;
|
keyn[0] = uKeyNum >> 8;
|
||||||
keyn[1] = uKeyNum & 0xff;
|
keyn[1] = uKeyNum & 0xff;
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLog("--block:%d sector[%d]:%02x key:%04x", blockNum & 0xff, mfNumBlocksPerSector(sectorNum), sectorNum, uKeyNum);
|
PrintAndLogEx(INFO, "--block:%d sector[%d]:%02x key:%04x", blockNum & 0xff, mfNumBlocksPerSector(sectorNum), sectorNum, uKeyNum);
|
||||||
|
|
||||||
mf4Session session;
|
mf4Session session;
|
||||||
int res = MifareAuth4(&session, keyn, key, true, true, verbose);
|
int res = MifareAuth4(&session, keyn, key, true, true, verbose);
|
||||||
if (res) {
|
if (res) {
|
||||||
PrintAndLog("Authentication error: %d", res);
|
PrintAndLogEx(ERR, "Authentication error: %d", res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -650,22 +650,22 @@ int CmdHFMFPWrbl(const char *cmd) {
|
||||||
int datalen = 0;
|
int datalen = 0;
|
||||||
res = MFPWriteBlock(&session, blockNum & 0xff, datain, false, false, data, sizeof(data), &datalen);
|
res = MFPWriteBlock(&session, blockNum & 0xff, datain, false, false, data, sizeof(data), &datalen);
|
||||||
if (res) {
|
if (res) {
|
||||||
PrintAndLog("Write error: %d", res);
|
PrintAndLogEx(ERR, "Write error: %d", res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (datalen != 3 && (datalen != 3 + 8)) {
|
if (datalen != 3 && (datalen != 3 + 8)) {
|
||||||
PrintAndLog("Error return length:%d", datalen);
|
PrintAndLogEx(ERR, "Error return length:%d", datalen);
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (datalen && data[0] != 0x90) {
|
if (datalen && data[0] != 0x90) {
|
||||||
PrintAndLog("Card write error: %02x %s", data[0], GetErrorDescription(data[0]));
|
PrintAndLogEx(ERR, "Card write error: %02x %s", data[0], GetErrorDescription(data[0]));
|
||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(verbose)
|
if(verbose)
|
||||||
PrintAndLog("MAC: %s", sprint_hex(&data[1], 8));
|
PrintAndLogEx(INFO, "MAC: %s", sprint_hex(&data[1], 8));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue