OLD/MIX convert to NG: Phase C1

This commit is contained in:
iceman1001 committed 2026-08-29 13:58:42 +02:00
1 parent 1a3f64960a
commit 5c7e9f6c42
5 files changed
+77 -41

No files matched your search

+12 -6
View File
@@ -402,19 +402,25 @@ static int CmdHFFudanWrBl(const char *Cmd) {
PrintAndLogEx(INFO, "Writing block no %d, key %s", blockno, sprint_hex_inrow(key, sizeof(key)));
PrintAndLogEx(INFO, "data: %s", sprint_hex(block, sizeof(block)));
uint8_t data[26];
memcpy(data, key, sizeof(key));
memcpy(data + 10, block, sizeof(block));
mf_writeblock_ex_t payload = {
.wakeup = MF_WAKE_WUPA,
.auth_cmd = MIFARE_AUTH_KEYA,
.write_cmd = ISO14443A_CMD_WRITEBLOCK,
.block_no = blockno,
};
memcpy(payload.key, key, MIFARE_KEY_SIZE);
memcpy(payload.block_data, block, MFBLOCK_SIZE);
clearCommandBuffer();
SendCommandMIX(CMD_HF_MIFARE_WRITEBL, blockno, 0, 0, data, sizeof(data));
SendCommandNG(CMD_HF_MIFARE_WRITEBL_EX, (uint8_t *)&payload, sizeof(payload));
PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500) == false) {
if (WaitForResponseTimeout(CMD_HF_MIFARE_WRITEBL_EX, &resp, 1500) == false) {
PrintAndLogEx(FAILED, "command execution time out");
return PM3_ETIMEOUT;
}
uint8_t isok = resp.oldarg[0] & 0xff;
uint8_t isok = (resp.status == PM3_SUCCESS);
if (isok) {
PrintAndLogEx(SUCCESS, "Write ( " _GREEN_("ok") " )");
PrintAndLogEx(HINT, "Hint: Try `" _YELLOW_("hf fudan rdbl") "` to verify");