mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 23:36:31 +08:00
text
This commit is contained in:
parent
9b3a088f58
commit
28b887aedb
|
@ -2138,11 +2138,14 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// new tag (need initialization)
|
|
||||||
if (uid != NULL) {
|
if (uid != NULL) {
|
||||||
|
|
||||||
uint8_t empty[8] = { 0 };
|
uint8_t empty[8] = { 0 };
|
||||||
if (memcmp(uid, empty, 8) != 0) {
|
|
||||||
// simulate a new tag bazed on client parameters
|
// User supplied not empty?
|
||||||
|
if (memcmp(uid, empty, 8)) {
|
||||||
|
// Set default values if user supplied a UID.
|
||||||
|
// Assume emulator memory is empty
|
||||||
tag->uid[0] = uid[7]; // always E0
|
tag->uid[0] = uid[7]; // always E0
|
||||||
tag->uid[1] = uid[6]; // IC Manufacturer code
|
tag->uid[1] = uid[6]; // IC Manufacturer code
|
||||||
tag->uid[2] = uid[5];
|
tag->uid[2] = uid[5];
|
||||||
|
@ -2164,20 +2167,33 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tag->pagesCount > ISO15693_TAG_MAX_PAGES || \
|
if ((tag->pagesCount > ISO15693_TAG_MAX_PAGES) ||
|
||||||
tag->pagesCount * tag->bytesPerPage > ISO15693_TAG_MAX_SIZE ||
|
((tag->pagesCount * tag->bytesPerPage) > ISO15693_TAG_MAX_SIZE) ||
|
||||||
tag->pagesCount == 0 || tag->bytesPerPage == 0) {
|
(tag->pagesCount == 0) ||
|
||||||
|
(tag->bytesPerPage == 0)) {
|
||||||
Dbprintf("Tag size error: pagesCount = %d, bytesPerPage=%d", tag->pagesCount, tag->bytesPerPage);
|
Dbprintf("Tag size error: pagesCount = %d, bytesPerPage=%d", tag->pagesCount, tag->bytesPerPage);
|
||||||
reply_ng(CMD_HF_ISO15693_SIMULATE, PM3_EOPABORTED, NULL, 0);
|
reply_ng(CMD_HF_ISO15693_SIMULATE, PM3_EOPABORTED, NULL, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iso15693InitTag(); // init simulator
|
Iso15693InitTag();
|
||||||
|
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
|
|
||||||
if (g_dbglevel >= DBG_DEBUG)
|
if (g_dbglevel >= DBG_DEBUG) {
|
||||||
Dbprintf("ISO-15963 Simulating uid: %02X%02X%02X%02X%02X%02X%02X%02X, %u bytes/blocks x %u blocks", tag->uid[7], tag->uid[6], tag->uid[5], tag->uid[4], tag->uid[3], tag->uid[2], tag->uid[1], tag->uid[0], tag->bytesPerPage, tag->pagesCount);
|
Dbprintf("ISO-15963 Simulating uid: %02X%02X%02X%02X%02X%02X%02X%02X, %u bytes/blocks x %u blocks"
|
||||||
|
, tag->uid[7]
|
||||||
|
, tag->uid[6]
|
||||||
|
, tag->uid[5]
|
||||||
|
, tag->uid[4]
|
||||||
|
, tag->uid[3]
|
||||||
|
, tag->uid[2]
|
||||||
|
, tag->uid[1]
|
||||||
|
, tag->uid[0]
|
||||||
|
, tag->bytesPerPage
|
||||||
|
, tag->pagesCount
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
LED_C_ON();
|
LED_C_ON();
|
||||||
|
|
||||||
|
@ -2578,8 +2594,9 @@ void SimTagIso15693(uint8_t *uid, uint8_t block_size) {
|
||||||
|
|
||||||
switch_off();
|
switch_off();
|
||||||
|
|
||||||
if (button_pressed)
|
if (button_pressed) {
|
||||||
DbpString("button pressed");
|
DbpString("button pressed");
|
||||||
|
}
|
||||||
|
|
||||||
reply_ng(CMD_HF_ISO15693_SIMULATE, PM3_SUCCESS, NULL, 0);
|
reply_ng(CMD_HF_ISO15693_SIMULATE, PM3_SUCCESS, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1432,8 +1432,7 @@ static int CmdHF15Sim(const char *Cmd) {
|
||||||
|
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
|
||||||
// get UID from emulator, for printing??
|
// get UID from emulator for printing
|
||||||
// iceman: downloading 2200 bytes just to get a 8 byte UID is overkill
|
|
||||||
if (uidlen == 0) {
|
if (uidlen == 0) {
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -1455,7 +1454,7 @@ static int CmdHF15Sim(const char *Cmd) {
|
||||||
PrintAndLogEx(WARNING, "Failed to get UID from emulator memory");
|
PrintAndLogEx(WARNING, "Failed to get UID from emulator memory");
|
||||||
return resp.status;
|
return resp.status;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(SUCCESS, "Starting simulating UID " _YELLOW_("%s"), iso15693_sprintUID(NULL, resp.data.asBytes));
|
PrintAndLogEx(SUCCESS, "Start simulating UID... " _YELLOW_("%s"), iso15693_sprintUID(NULL, resp.data.asBytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Press " _YELLOW_("`pm3-button`") " to abort simulation");
|
PrintAndLogEx(INFO, "Press " _YELLOW_("`pm3-button`") " to abort simulation");
|
||||||
|
@ -1850,10 +1849,14 @@ static int CmdHF15Dump(const char *Cmd) {
|
||||||
|
|
||||||
memcpy(tag->uid, &d[2], 8);
|
memcpy(tag->uid, &d[2], 8);
|
||||||
|
|
||||||
if (d[1] & 0x01)
|
if (d[1] & 0x01) {
|
||||||
tag->dsfid = d[dCpt++];
|
tag->dsfid = d[dCpt++];
|
||||||
if (d[1] & 0x02)
|
}
|
||||||
|
|
||||||
|
if (d[1] & 0x02) {
|
||||||
tag->afi = d[dCpt++];
|
tag->afi = d[dCpt++];
|
||||||
|
}
|
||||||
|
|
||||||
if (d[1] & 0x04) {
|
if (d[1] & 0x04) {
|
||||||
tag->pagesCount = d[dCpt++] + 1;
|
tag->pagesCount = d[dCpt++] + 1;
|
||||||
tag->bytesPerPage = d[dCpt++] + 1;
|
tag->bytesPerPage = d[dCpt++] + 1;
|
||||||
|
@ -1862,8 +1865,10 @@ static int CmdHF15Dump(const char *Cmd) {
|
||||||
tag->bytesPerPage = blocksize;
|
tag->bytesPerPage = blocksize;
|
||||||
tag->pagesCount = 128;
|
tag->pagesCount = 128;
|
||||||
}
|
}
|
||||||
if (d[1] & 0x08)
|
|
||||||
|
if (d[1] & 0x08) {
|
||||||
tag->ic = d[dCpt++];
|
tag->ic = d[dCpt++];
|
||||||
|
}
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
print_emltag_info_15693(tag);
|
print_emltag_info_15693(tag);
|
||||||
|
|
Loading…
Reference in a new issue