This commit is contained in:
iceman1001 2024-01-15 17:14:04 +01:00
parent f69eb8b127
commit ca21348ff6
2 changed files with 23 additions and 23 deletions

View file

@ -2648,10 +2648,9 @@ void LockPassSlixIso15693(uint32_t pass_id, uint32_t password) {
void SetTag15693Uid(const uint8_t *uid) { void SetTag15693Uid(const uint8_t *uid) {
LED_A_ON(); LED_A_ON();
uint8_t cmd[4][9] = { uint8_t cmd[4][9] = {
{ISO15_REQ_DATARATE_HIGH, ISO15693_WRITEBLOCK, 0x3e, 0x00, 0x00, 0x00, 0x00}, {ISO15_REQ_DATARATE_HIGH, ISO15693_WRITEBLOCK, 0x3e, 0x00, 0x00, 0x00, 0x00, 0xE9, 0x8F},
{ISO15_REQ_DATARATE_HIGH, ISO15693_WRITEBLOCK, 0x3f, 0x69, 0x96, 0x00, 0x00}, {ISO15_REQ_DATARATE_HIGH, ISO15693_WRITEBLOCK, 0x3f, 0x69, 0x96, 0x00, 0x00, 0x8A, 0xBB},
{ISO15_REQ_DATARATE_HIGH, ISO15693_WRITEBLOCK, 0x38}, {ISO15_REQ_DATARATE_HIGH, ISO15693_WRITEBLOCK, 0x38},
{ISO15_REQ_DATARATE_HIGH, ISO15693_WRITEBLOCK, 0x39} {ISO15_REQ_DATARATE_HIGH, ISO15693_WRITEBLOCK, 0x39}
}; };
@ -2668,29 +2667,31 @@ void SetTag15693Uid(const uint8_t *uid) {
cmd[3][5] = uid[1]; cmd[3][5] = uid[1];
cmd[3][6] = uid[0]; cmd[3][6] = uid[0];
AddCrc15(cmd[0], 7);
AddCrc15(cmd[1], 7);
AddCrc15(cmd[2], 7); AddCrc15(cmd[2], 7);
AddCrc15(cmd[3], 7); AddCrc15(cmd[3], 7);
uint8_t recvbuf[ISO15693_MAX_RESPONSE_LENGTH]; uint8_t buf[ISO15693_MAX_RESPONSE_LENGTH] = {0x00};
uint32_t start_time = 0; uint32_t start_time = 0;
uint32_t eof_time = 0; uint32_t eof_time = 0;
uint16_t recvlen = 0; uint16_t recvlen = 0;
int res = PM3_SUCCESS; int res = PM3_SUCCESS;
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
res = SendDataTag( res = SendDataTag(
cmd[i], cmd[i],
sizeof(cmd[i]), sizeof(cmd[i]),
(i == 0) ? true : false, (i == 0) ? true : false,
true, true,
recvbuf, buf,
sizeof(recvbuf), sizeof(buf),
start_time, start_time,
ISO15693_READER_TIMEOUT_WRITE, ISO15693_READER_TIMEOUT_WRITE,
&eof_time, &eof_time,
&recvlen); &recvlen
);
start_time = eof_time + DELAY_ISO15693_VICC_TO_VCD_READER; start_time = eof_time + DELAY_ISO15693_VICC_TO_VCD_READER;
} }

View file

@ -97,8 +97,6 @@
} }
#endif #endif
typedef struct { typedef struct {
uint8_t lock; uint8_t lock;
uint8_t block[8]; uint8_t block[8];
@ -2680,9 +2678,9 @@ static int CmdHF15CSetUID(const char *Cmd) {
return PM3_EINVARG; return PM3_EINVARG;
} }
PrintAndLogEx(SUCCESS, "Reverse input UID... " _YELLOW_("%s"), iso15693_sprintUID(NULL, payload.uid)); PrintAndLogEx(DEBUG, "Reverse input UID... " _YELLOW_("%s"), iso15693_sprintUID(NULL, payload.uid));
PrintAndLogEx(INFO, "Getting current card details..."); PrintAndLogEx(INFO, "Get current tag");
uint8_t carduid[HF15_UID_LENGTH] = {0x00}; uint8_t carduid[HF15_UID_LENGTH] = {0x00};
if (getUID(true, false, carduid) != PM3_SUCCESS) { if (getUID(true, false, carduid) != PM3_SUCCESS) {
@ -2690,8 +2688,7 @@ static int CmdHF15CSetUID(const char *Cmd) {
return PM3_ESOFT; return PM3_ESOFT;
} }
PrintAndLogEx(INFO, "Updating tag uid..."); PrintAndLogEx(INFO, "Writing...");
PacketResponseNG resp; PacketResponseNG resp;
clearCommandBuffer(); clearCommandBuffer();
SendCommandNG(CMD_HF_ISO15693_CSETUID, (uint8_t *)&payload, sizeof(payload)); SendCommandNG(CMD_HF_ISO15693_CSETUID, (uint8_t *)&payload, sizeof(payload));
@ -2701,7 +2698,7 @@ static int CmdHF15CSetUID(const char *Cmd) {
return PM3_ESOFT; return PM3_ESOFT;
} }
PrintAndLogEx(INFO, "Verifying write..."); PrintAndLogEx(INFO, "Verifying...");
if (getUID(true, false, carduid) != PM3_SUCCESS) { if (getUID(true, false, carduid) != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "no tag found"); PrintAndLogEx(FAILED, "no tag found");
@ -2714,10 +2711,12 @@ static int CmdHF15CSetUID(const char *Cmd) {
if (memcmp(revuid, payload.uid, HF15_UID_LENGTH) == 0) { if (memcmp(revuid, payload.uid, HF15_UID_LENGTH) == 0) {
PrintAndLogEx(SUCCESS, "Setting new UID ( " _GREEN_("ok") " )"); PrintAndLogEx(SUCCESS, "Setting new UID ( " _GREEN_("ok") " )");
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS;; return PM3_SUCCESS;;
} }
PrintAndLogEx(FAILED, "Setting new UID ( " _RED_("fail") " )"); PrintAndLogEx(FAILED, "Setting new UID ( " _RED_("fail") " )");
PrintAndLogEx(NORMAL, "");
return PM3_ESOFT; return PM3_ESOFT;
} }