OLD/MIX convert to NG: Phase C9
This commit is contained in:
1 parent
721641428c
commit
72ff6a5b80
9 files changed
+123
-24
No files matched your search
@@ -645,7 +645,11 @@ static int CmdFlashMemWipe(const char *Cmd) {
|
||||
}
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_FLASHMEM_WIPE, page, initialwipe, 0, NULL, 0);
|
||||
flashmem_wipe_t payload = {
|
||||
.page = page,
|
||||
.initialwipe = initialwipe,
|
||||
};
|
||||
SendCommandNG(CMD_FLASHMEM_WIPE, (uint8_t *)&payload, sizeof(payload));
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_FLASHMEM_WIPE, &resp, 10000) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||
|
||||
@@ -6508,7 +6508,12 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||
memcpy(post, resp.data.asBytes, sizeof(post));
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_MFU_OTP_TEAROFF, blockno, current, 0, teardata, sizeof(teardata));
|
||||
uint8_t tbuf[sizeof(mfu_otp_tearoff_t) + sizeof(teardata)] = {0};
|
||||
mfu_otp_tearoff_t *tpayload = (mfu_otp_tearoff_t *)tbuf;
|
||||
tpayload->blockno = blockno;
|
||||
tpayload->tearoff_time = current;
|
||||
memcpy(tpayload->data, teardata, sizeof(teardata));
|
||||
SendCommandNG(CMD_HF_MFU_OTP_TEAROFF, tbuf, sizeof(tbuf));
|
||||
|
||||
// we be getting ACK that we are silently ignoring here..
|
||||
|
||||
|
||||
+2
-1
@@ -658,7 +658,8 @@ static int CmdLCD(const char *Cmd) {
|
||||
|
||||
while (j--) {
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_LCD, raw[0], 0, 0, NULL, 0);
|
||||
lcd_cmd_t payload = { .cmd = raw[0] };
|
||||
SendCommandNG(CMD_LCD, (uint8_t *)&payload, sizeof(payload));
|
||||
}
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1005,7 +1005,11 @@ static int CmdLFHitagSSim(const char *Cmd) {
|
||||
CLIParserFree(ctx);
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_LF_HITAGS_SIMULATE, false, threshold, 0, NULL, 0);
|
||||
hitag_sim_t payload = {
|
||||
.tag_mem_supplied = false,
|
||||
.threshold = threshold,
|
||||
};
|
||||
SendCommandNG(CMD_LF_HITAGS_SIMULATE, (uint8_t *)&payload, sizeof(payload));
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -703,7 +703,11 @@ static int CmdLFHitagUSim(const char *Cmd) {
|
||||
CLIParserFree(ctx);
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_LF_HITAGU_SIMULATE, false, threshold, 0, NULL, 0);
|
||||
hitag_sim_t payload = {
|
||||
.tag_mem_supplied = false,
|
||||
.threshold = threshold,
|
||||
};
|
||||
SendCommandNG(CMD_LF_HITAGU_SIMULATE, (uint8_t *)&payload, sizeof(payload));
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -184,14 +184,24 @@ static int CmdLFPCF7931Write(const char *Cmd) {
|
||||
|
||||
PrintAndLogEx(INFO, "Writing block %u at idx %u with data 0x%02X", block, idx, data[0]);
|
||||
|
||||
uint32_t buf[10]; // TODO sparse struct, 7 *bytes* then words at offset 4*7!
|
||||
memcpy(buf, configPcf.Pwd, sizeof(configPcf.Pwd));
|
||||
buf[7] = (configPcf.OffsetWidth + 128);
|
||||
buf[8] = (configPcf.OffsetPosition + 128);
|
||||
buf[9] = configPcf.InitDelay;
|
||||
pcf7931_write_t payload = {
|
||||
.offset_width = (uint8_t)(configPcf.OffsetWidth + 128),
|
||||
.offset_position = (uint8_t)(configPcf.OffsetPosition + 128),
|
||||
.init_delay = configPcf.InitDelay,
|
||||
.address = block,
|
||||
.byte = idx,
|
||||
.data = data[0],
|
||||
};
|
||||
memcpy(payload.pwd, configPcf.Pwd, sizeof(payload.pwd));
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_LF_PCF7931_WRITE, block, idx, data[0], buf, sizeof(buf));
|
||||
SendCommandNG(CMD_LF_PCF7931_WRITE, (uint8_t *)&payload, sizeof(payload));
|
||||
|
||||
PacketResponseNG resp;
|
||||
if (WaitForResponseTimeout(CMD_LF_PCF7931_WRITE, &resp, 4000) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Done!");
|
||||
PrintAndLogEx(HINT, "Hint: Try " _YELLOW_("`lf pcf7931 reader`") " to verify");
|
||||
|
||||
Reference in new issue
Block a user