restore function now stops if password is wrong

This commit is contained in:
tharexde 2020-12-03 20:42:46 +01:00
parent 414b892b65
commit e41e8555a3

View file

@ -1331,7 +1331,7 @@ void em4x50_restore(em4x50_data_t *etd) {
// restore em4x50 dump file to tag
bool bsuccess = false;
int status = PM3_EFAILED;
int status = PM3_SUCCESS;
int start_word = 3; // first block/address with user data
uint8_t em4x50_mem[DUMP_FILESIZE] = {0x0};
uint32_t addresses = 0x00001F01; // from fwr = 1 to lwr = 31 (0x1F)
@ -1357,13 +1357,15 @@ void em4x50_restore(em4x50_data_t *etd) {
// login first if password is available
if (etd->pwd_given) {
if (login(etd->password1) == PM3_SUCCESS) {
if ((status = login(etd->password1)) == PM3_SUCCESS) {
// successful login allows words 1 and 2 to be written
start_word = 1;
}
}
if (status == PM3_SUCCESS) {
// write data to each address but ignore addresses
// 0 -> password, 32 -> serial, 33 -> uid
for (int i = start_word; i < EM4X50_NO_WORDS - 2; i++) {
@ -1389,6 +1391,7 @@ void em4x50_restore(em4x50_data_t *etd) {
}
}
}
}
if (bsuccess)
status = PM3_SUCCESS;