mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-14 19:24:10 +08:00
Chg: 'hf mf autopwn' - skip extra checks if all keys found on first check
This commit is contained in:
parent
04ce6c64cc
commit
3a63b72741
1 changed files with 11 additions and 2 deletions
|
@ -1644,7 +1644,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
|||
int block_cnt = MIFARE_1K_MAXBLOCK;
|
||||
uint8_t tmp_key[6] = {0};
|
||||
bool know_target_key = false;
|
||||
// For the timier
|
||||
// For the timer
|
||||
uint64_t t1;
|
||||
// Parameters and dictionary file
|
||||
char filename[FILE_PATH_SIZE] = {0};
|
||||
|
@ -1666,6 +1666,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
|||
bool verbose = false;
|
||||
bool has_filename = false;
|
||||
bool errors = false;
|
||||
uint8_t num_found_keys = 0;
|
||||
|
||||
// Parse the options given by the user
|
||||
while ((ctmp = param_getchar(Cmd, cmdp)) && !errors) {
|
||||
|
@ -1819,6 +1820,9 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
|||
|
||||
// Store the key for the nested / hardnested attack (if supplied by the user)
|
||||
e_sector[blockNo].Key[keyType] = key64;
|
||||
e_sector[blockNo].foundKey[keyType] = 'U';
|
||||
|
||||
++num_found_keys;
|
||||
} else {
|
||||
know_target_key = false;
|
||||
PrintAndLogEx(FAILED, "Key is wrong. Can't authenticate to sector:"_RED_("%3d") " key type: "_RED_("%c") " key: " _RED_("%s"),
|
||||
|
@ -1855,11 +1859,14 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
|||
sprint_hex(key, sizeof(key))
|
||||
);
|
||||
}
|
||||
++num_found_keys;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (verbose) PrintAndLogEx(INFO, _YELLOW_("======================= STOP KNOWN KEY ATTACK ======================="));
|
||||
if (num_found_keys == sectors_cnt * 2)
|
||||
goto all_found;
|
||||
}
|
||||
|
||||
bool load_success = true;
|
||||
|
@ -1873,7 +1880,6 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
|||
|
||||
load_success = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (has_filename == false || load_success == false) {
|
||||
|
@ -1905,6 +1911,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
|||
if (mfCheckKeys(FirstBlockOfSector(i), j, true, 1, (keyBlock + (6 * k)), &key64) == PM3_SUCCESS) {
|
||||
e_sector[i].Key[j] = bytes_to_num((keyBlock + (6 * k)), 6);
|
||||
e_sector[i].foundKey[j] = 'D';
|
||||
++num_found_keys;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2205,6 +2212,8 @@ tryHardnested: // If the nested attack fails then we try the hardnested attack
|
|||
}
|
||||
}
|
||||
|
||||
all_found:
|
||||
|
||||
// Show the results to the user
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "found Keys:");
|
||||
|
|
Loading…
Reference in a new issue