mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-10 18:24:27 +08:00
flasher: ask confirmation if fw mismatch, fix segfault on abort
This commit is contained in:
parent
72f7bc762d
commit
5997f23139
2 changed files with 11 additions and 4 deletions
|
@ -322,8 +322,13 @@ int flash_load(flash_file_t *ctx) {
|
||||||
if (strlen(g_version_information.armsrc) == 9) {
|
if (strlen(g_version_information.armsrc) == 9) {
|
||||||
if (strncmp(vi->armsrc, g_version_information.armsrc, 9) != 0) {
|
if (strncmp(vi->armsrc, g_version_information.armsrc, 9) != 0) {
|
||||||
PrintAndLogEx(WARNING, _RED_("ARM firmware does not match the source at the time the client was compiled"));
|
PrintAndLogEx(WARNING, _RED_("ARM firmware does not match the source at the time the client was compiled"));
|
||||||
PrintAndLogEx(WARNING, "Make sure to flash a correct and up-to-date version");
|
PrintAndLogEx(INFO, "Make sure to flash a correct and up-to-date version");
|
||||||
// TODO: prompt user to continue or abort
|
PrintAndLogEx(NORMAL, "Do you want to flash the current image? (yes/no)");
|
||||||
|
char answer[10];
|
||||||
|
if ((fgets (answer, sizeof(answer), stdin) == NULL) || (strncmp(answer, "yes", 3) != 0)) {
|
||||||
|
res = PM3_EOPABORTED;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -637,7 +637,7 @@ static int flash_pm3(char *serial_port_name, uint8_t num_files, char *filenames[
|
||||||
for (int i = 0 ; i < num_files; ++i) {
|
for (int i = 0 ; i < num_files; ++i) {
|
||||||
ret = flash_load(&files[i]);
|
ret = flash_load(&files[i]);
|
||||||
if (ret != PM3_SUCCESS) {
|
if (ret != PM3_SUCCESS) {
|
||||||
goto finish;
|
goto finish2;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
}
|
}
|
||||||
|
@ -679,7 +679,7 @@ static int flash_pm3(char *serial_port_name, uint8_t num_files, char *filenames[
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
if (ret != PM3_SUCCESS)
|
if (ret != PM3_SUCCESS)
|
||||||
PrintAndLogEx(INFO, "The flashing procedure failed, follow the suggested steps!");
|
PrintAndLogEx(WARNING, "The flashing procedure failed, follow the suggested steps!");
|
||||||
ret = flash_stop_flashing();
|
ret = flash_stop_flashing();
|
||||||
CloseProxmark(g_session.current_device);
|
CloseProxmark(g_session.current_device);
|
||||||
finish2:
|
finish2:
|
||||||
|
@ -688,6 +688,8 @@ finish2:
|
||||||
}
|
}
|
||||||
if (ret == PM3_SUCCESS)
|
if (ret == PM3_SUCCESS)
|
||||||
PrintAndLogEx(SUCCESS, _CYAN_("All done"));
|
PrintAndLogEx(SUCCESS, _CYAN_("All done"));
|
||||||
|
else if (ret == PM3_EOPABORTED)
|
||||||
|
PrintAndLogEx(FAILED, "Aborted by user");
|
||||||
else
|
else
|
||||||
PrintAndLogEx(ERR, "Aborted on error");
|
PrintAndLogEx(ERR, "Aborted on error");
|
||||||
PrintAndLogEx(INFO, "\nHave a nice day!");
|
PrintAndLogEx(INFO, "\nHave a nice day!");
|
||||||
|
|
Loading…
Reference in a new issue