mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
hf mfu otptear - use high precision clock instead
This commit is contained in:
parent
8f536d6655
commit
43f4bba432
2 changed files with 9 additions and 7 deletions
|
@ -2702,17 +2702,17 @@ void MifareU_Otp_Tearoff(uint8_t arg0, uint32_t arg1, uint8_t *datain) {
|
||||||
uint8_t data_testwrite[4] = {0x00};
|
uint8_t data_testwrite[4] = {0x00};
|
||||||
memcpy(data_fullwrite, datain, 4);
|
memcpy(data_fullwrite, datain, 4);
|
||||||
memcpy(data_testwrite, datain + 4, 4);
|
memcpy(data_testwrite, datain + 4, 4);
|
||||||
// optional authentication before?
|
|
||||||
|
|
||||||
if (DBGLEVEL >= DBG_DEBUG) DbpString("Preparing OTP tear-off");
|
if (DBGLEVEL >= DBG_DEBUG) DbpString("Preparing OTP tear-off");
|
||||||
|
|
||||||
|
if (tearOffTime > 43000)
|
||||||
|
tearOffTime == 43000;
|
||||||
|
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
clear_trace();
|
clear_trace();
|
||||||
set_tracing(true);
|
set_tracing(true);
|
||||||
|
|
||||||
StartTicks();
|
|
||||||
|
|
||||||
// write cmd to send, include CRC
|
// write cmd to send, include CRC
|
||||||
// 1b write, 1b block, 4b data, 2 crc
|
// 1b write, 1b block, 4b data, 2 crc
|
||||||
uint8_t cmd[] = {MIFARE_ULC_WRITE, blockNo, data_testwrite[0], data_testwrite[1], data_testwrite[2], data_testwrite[3], 0, 0};
|
uint8_t cmd[] = {MIFARE_ULC_WRITE, blockNo, data_testwrite[0], data_testwrite[1], data_testwrite[2], data_testwrite[3], 0, 0};
|
||||||
|
@ -2732,10 +2732,10 @@ void MifareU_Otp_Tearoff(uint8_t arg0, uint32_t arg1, uint8_t *datain) {
|
||||||
|
|
||||||
// Wait before cutting power. aka tear-off
|
// Wait before cutting power. aka tear-off
|
||||||
LED_D_ON();
|
LED_D_ON();
|
||||||
WaitUS(tearOffTime);
|
|
||||||
|
SpinDelayUsPrecision(tearOffTime);
|
||||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf(_YELLOW_("OTP tear-off triggered!"));
|
if (DBGLEVEL >= DBG_ERROR) Dbprintf(_YELLOW_("OTP tear-off triggered!"));
|
||||||
switch_off();
|
switch_off();
|
||||||
|
|
||||||
reply_ng(CMD_HF_MFU_OTP_TEAROFF, PM3_SUCCESS, NULL, 0);
|
reply_ng(CMD_HF_MFU_OTP_TEAROFF, PM3_SUCCESS, NULL, 0);
|
||||||
StopTicks();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2850,6 +2850,10 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||||
PrintAndLogEx(WARNING, "Wrong time limit number");
|
PrintAndLogEx(WARNING, "Wrong time limit number");
|
||||||
errors = true;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
if (timeLimit > 43000) {
|
||||||
|
PrintAndLogEx(WARNING, "You can't set delay out of 1..43000 range!");
|
||||||
|
errors = true;
|
||||||
|
}
|
||||||
cmdp += 2;
|
cmdp += 2;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
|
@ -2941,14 +2945,12 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||||
else
|
else
|
||||||
snprintf(post_res, sizeof(post_res) - 1, _CYAN_("%s"), sprint_hex_inrow(post, sizeof(post)));
|
snprintf(post_res, sizeof(post_res) - 1, _CYAN_("%s"), sprint_hex_inrow(post, sizeof(post)));
|
||||||
|
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Result %02d/0x%02X | %s vs %s"
|
PrintAndLogEx(INFO, "Result %02d/0x%02X | %s vs %s"
|
||||||
, blockNoUint
|
, blockNoUint
|
||||||
, blockNoUint
|
, blockNoUint
|
||||||
, sprint_hex_inrow(pre, sizeof(pre))
|
, sprint_hex_inrow(pre, sizeof(pre))
|
||||||
, post_res
|
, post_res
|
||||||
);
|
);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (got_pre == false)
|
if (got_pre == false)
|
||||||
PrintAndLogEx(FAILED, "Failed to read block BEFORE");
|
PrintAndLogEx(FAILED, "Failed to read block BEFORE");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue