em tuning

This commit is contained in:
Philippe Teuwen 2020-10-15 23:31:03 +02:00
parent f39131f5f0
commit ab2d232689

View file

@ -1802,7 +1802,7 @@ static int CmdEM4x05Unlock(const char *Cmd) {
// main loop // main loop
// //
//uint32_t prev_delay = 0; //uint32_t prev_delay = 0;
bool success = false;
uint64_t t1 = msclock(); uint64_t t1 = msclock();
while (start <= end) { while (start <= end) {
@ -1868,7 +1868,7 @@ static int CmdEM4x05Unlock(const char *Cmd) {
if (res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
//PrintAndLogEx(INFO, "14 after [ " _GREEN_("%08X") " ]", word14); //PrintAndLogEx(INFO, "14 after [ " _GREEN_("%08X") " ]", word14);
} else { } else {
continue; break;
} }
// read after trigger // read after trigger
@ -1876,7 +1876,7 @@ static int CmdEM4x05Unlock(const char *Cmd) {
if (res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
//PrintAndLogEx(INFO, "15 after [ " _GREEN_("%08X") " ]", word15); //PrintAndLogEx(INFO, "15 after [ " _GREEN_("%08X") " ]", word15);
} else { } else {
continue; break;
} }
if (verbose) if (verbose)
@ -1910,14 +1910,14 @@ static int CmdEM4x05Unlock(const char *Cmd) {
// read after reset // read after reset
res = EM4x05ReadWord_ext(14, pwd, use_pwd, &word14b); res = EM4x05ReadWord_ext(14, pwd, use_pwd, &word14b);
if (res != PM3_SUCCESS) { if (res != PM3_SUCCESS) {
continue; break;
} }
if (word14b == 0) { if (word14b == 0) {
unlock_reset(use_pwd, pwd, write_value); unlock_reset(use_pwd, pwd, write_value);
res = EM4x05ReadWord_ext(14, pwd, use_pwd, &word14b); res = EM4x05ReadWord_ext(14, pwd, use_pwd, &word14b);
if (res != PM3_SUCCESS) { if (res != PM3_SUCCESS) {
continue; break;
} }
} }
@ -1927,10 +1927,9 @@ static int CmdEM4x05Unlock(const char *Cmd) {
res = EM4x05ReadWord_ext(15, pwd, use_pwd, &word15b); res = EM4x05ReadWord_ext(15, pwd, use_pwd, &word15b);
if (res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
PrintAndLogEx(INFO, "Status: new definitive value! => " _RED_("SUCCESS:") " 14: " _CYAN_("%08X") " 15: %08X", word14b, word15b); PrintAndLogEx(INFO, "Status: new definitive value! => " _RED_("SUCCESS:") " 14: " _CYAN_("%08X") " 15: %08X", word14b, word15b);
break; success = true;
} else {
continue;
} }
break;
} }
if (my_auto) { if (my_auto) {
end = start; end = start;
@ -1969,28 +1968,29 @@ static int CmdEM4x05Unlock(const char *Cmd) {
if (word14b == word15) { if (word14b == word15) {
PrintAndLogEx(INFO, "Status: confirmed => " _RED_("SUCCESS: ") "14: " _CYAN_("%08X") " 15: %08X", word14b, word15b); PrintAndLogEx(INFO, "Status: confirmed => " _RED_("SUCCESS: ") "14: " _CYAN_("%08X") " 15: %08X", word14b, word15b);
success = true;
break; break;
} }
if (word14b != search_value) { if (word14b != search_value) {
PrintAndLogEx(INFO, "Status: new definitive value! => " _RED_("SUCCESS: ") "14: " _CYAN_("%08X") " 15: %08X", word14b, word15b); PrintAndLogEx(INFO, "Status: new definitive value! => " _RED_("SUCCESS: ") "14: " _CYAN_("%08X") " 15: %08X", word14b, word15b);
success = true;
break; break;
} }
PrintAndLogEx(INFO, "Status: failed to commit bitflip => " _RED_("FAIL: ") "14: %08X 15: %08X", word14b, word15b); PrintAndLogEx(INFO, "Status: failed to commit bitflip => " _RED_("FAIL: ") "14: %08X 15: %08X", word14b, word15b);
} }
if (my_auto) {
n = 0;
end = start;
} else {
tries = 0;
soon = 0;
late = 0;
}
} else { } else {
PrintAndLogEx(INFO, "Status: 15 bitflipped but inactive => " _YELLOW_("PROMISING: ") "14: %08X 15: " _CYAN_("%08X"), word14, word15); PrintAndLogEx(INFO, "Status: 15 bitflipped but inactive => " _YELLOW_("PROMISING: ") "14: %08X 15: " _CYAN_("%08X"), word14, word15);
soon ++;
}
if (my_auto) {
n = 0;
end = start;
} else {
tries = 0;
soon = 0;
late = 0;
} }
} }
} }
@ -2003,7 +2003,8 @@ static int CmdEM4x05Unlock(const char *Cmd) {
PrintAndLogEx(INFO, "----------------------------- " _CYAN_("exit") " ----------------------------------\n"); PrintAndLogEx(INFO, "----------------------------- " _CYAN_("exit") " ----------------------------------\n");
t1 = msclock() - t1; t1 = msclock() - t1;
PrintAndLogEx(SUCCESS, "\ntime in unlock " _YELLOW_("%.0f") " seconds\n", (float)t1 / 1000.0); PrintAndLogEx(SUCCESS, "\ntime in unlock " _YELLOW_("%.0f") " seconds\n", (float)t1 / 1000.0);
PrintAndLogEx(INFO, "try " _YELLOW_("`lf em 4x05_dump`")); if (success)
PrintAndLogEx(INFO, "try " _YELLOW_("`lf em 4x05_dump`"));
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
return exit_code; return exit_code;
} }