mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-09 01:36:52 +08:00
mf sim: respect DBG_NONE and explicit ATQA/SAK usage
This commit is contained in:
parent
80941ed9e1
commit
4615354864
2 changed files with 13 additions and 9 deletions
|
@ -250,21 +250,21 @@ static bool MifareSimInit(uint16_t flags, uint8_t *datain, tag_response_info_t *
|
|||
if ((flags & FLAG_MF_MINI) == FLAG_MF_MINI) {
|
||||
memcpy(rATQA, rATQA_Mini, sizeof(rATQA));
|
||||
rSAK[0] = rSAK_Mini;
|
||||
Dbprintf("Mifare Mini");
|
||||
if (DBGLEVEL > DBG_NONE) Dbprintf("Enforcing Mifare Mini ATQA/SAK");
|
||||
} else if ((flags & FLAG_MF_1K) == FLAG_MF_1K) {
|
||||
memcpy(rATQA, rATQA_1k, sizeof(rATQA));
|
||||
rSAK[0] = rSAK_1k;
|
||||
Dbprintf("Mifare 1K");
|
||||
if (DBGLEVEL > DBG_NONE) Dbprintf("Enforcing Mifare 1K ATQA/SAK");
|
||||
} else if ((flags & FLAG_MF_2K) == FLAG_MF_2K) {
|
||||
memcpy(rATQA, rATQA_2k, sizeof(rATQA));
|
||||
rSAK[0] = rSAK_2k;
|
||||
*rats = rRATS;
|
||||
*rats_len = sizeof(rRATS);
|
||||
Dbprintf("Mifare 2K with RATS support");
|
||||
if (DBGLEVEL > DBG_NONE) Dbprintf("Enforcing Mifare 2K ATQA/SAK with RATS support");
|
||||
} else if ((flags & FLAG_MF_4K) == FLAG_MF_4K) {
|
||||
memcpy(rATQA, rATQA_4k, sizeof(rATQA));
|
||||
rSAK[0] = rSAK_4k;
|
||||
Dbprintf("Mifare 4K");
|
||||
if (DBGLEVEL > DBG_NONE) Dbprintf("Enforcing Mifare 4K ATQA/SAK");
|
||||
}
|
||||
|
||||
// Prepare UID arrays
|
||||
|
@ -279,7 +279,7 @@ static bool MifareSimInit(uint16_t flags, uint8_t *datain, tag_response_info_t *
|
|||
*cuid = bytes_to_num(rUIDBCC1, 4);
|
||||
// BCC
|
||||
rUIDBCC1[4] = rUIDBCC1[0] ^ rUIDBCC1[1] ^ rUIDBCC1[2] ^ rUIDBCC1[3];
|
||||
if (DBGLEVEL >= DBG_NONE) {
|
||||
if (DBGLEVEL > DBG_NONE) {
|
||||
Dbprintf("4B UID: %02x%02x%02x%02x", rUIDBCC1[0], rUIDBCC1[1], rUIDBCC1[2], rUIDBCC1[3]);
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ static bool MifareSimInit(uint16_t flags, uint8_t *datain, tag_response_info_t *
|
|||
// BCC
|
||||
rUIDBCC1[4] = rUIDBCC1[0] ^ rUIDBCC1[1] ^ rUIDBCC1[2] ^ rUIDBCC1[3];
|
||||
rUIDBCC2[4] = rUIDBCC2[0] ^ rUIDBCC2[1] ^ rUIDBCC2[2] ^ rUIDBCC2[3];
|
||||
if (DBGLEVEL >= DBG_NONE) {
|
||||
if (DBGLEVEL > DBG_NONE) {
|
||||
Dbprintf("7B UID: %02x %02x %02x %02x %02x %02x %02x",
|
||||
rUIDBCC1[1], rUIDBCC1[2], rUIDBCC1[3], rUIDBCC2[0], rUIDBCC2[1], rUIDBCC2[2], rUIDBCC2[3]);
|
||||
}
|
||||
|
@ -326,7 +326,7 @@ static bool MifareSimInit(uint16_t flags, uint8_t *datain, tag_response_info_t *
|
|||
rUIDBCC2[4] = rUIDBCC2[0] ^ rUIDBCC2[1] ^ rUIDBCC2[2] ^ rUIDBCC2[3];
|
||||
rUIDBCC3[4] = rUIDBCC3[0] ^ rUIDBCC3[1] ^ rUIDBCC3[2] ^ rUIDBCC3[3];
|
||||
|
||||
if (DBGLEVEL >= DBG_NONE) {
|
||||
if (DBGLEVEL > DBG_NONE) {
|
||||
Dbprintf("10B UID: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x",
|
||||
rUIDBCC1[1], rUIDBCC1[2], rUIDBCC1[3],
|
||||
rUIDBCC2[1], rUIDBCC2[2], rUIDBCC2[3],
|
||||
|
@ -340,6 +340,9 @@ static bool MifareSimInit(uint16_t flags, uint8_t *datain, tag_response_info_t *
|
|||
Dbprintf("[-] ERROR: UID size not defined");
|
||||
return false;
|
||||
}
|
||||
if (DBGLEVEL > DBG_NONE) {
|
||||
Dbprintf("ATQA = %02X %02X and SAK = %02X)", rATQA[1], rATQA[0], rSAK[0]);
|
||||
}
|
||||
|
||||
// clone UIDs for byte-frame anti-collision multiple tag selection procedure
|
||||
memcpy(rUIDBCC1b4, &rUIDBCC1[1], 4);
|
||||
|
|
|
@ -68,8 +68,9 @@ static int usage_hf14_mfsim(void) {
|
|||
PrintAndLogEx(NORMAL, "Usage: hf mf sim [h] u <uid> n <numreads> [i] [x] [e] [v]");
|
||||
PrintAndLogEx(NORMAL, "Options:");
|
||||
PrintAndLogEx(NORMAL, " h this help");
|
||||
PrintAndLogEx(NORMAL, " u (Optional) UID 4,7 or 10bytes. If not specified, the UID 4b from emulator memory will be used");
|
||||
PrintAndLogEx(NORMAL, " t (Optional) 0 = MIFARE Mini");
|
||||
PrintAndLogEx(NORMAL, " u (Optional) UID 4,7 or 10bytes. If not specified, the UID 4b/7b from emulator memory will be used");
|
||||
PrintAndLogEx(NORMAL, " t (Optional) Enforce ATQA/SAK:");
|
||||
PrintAndLogEx(NORMAL, " 0 = MIFARE Mini");
|
||||
PrintAndLogEx(NORMAL, " 1 = MIFARE Classic 1k (Default)");
|
||||
PrintAndLogEx(NORMAL, " 2 = MIFARE Classic 2k plus in SL0 mode");
|
||||
PrintAndLogEx(NORMAL, " 4 = MIFARE Classic 4k");
|
||||
|
|
Loading…
Reference in a new issue