add --force to core MAD decode

This commit is contained in:
BlueChip 2024-11-13 01:58:33 +00:00
commit 0638603354
2 changed files with 5 additions and 3 deletions

View file

@ -978,7 +978,7 @@ globals:
lprint("====================================") lprint("====================================")
lprint() lprint()
cmd = f"hf mf mad --verbose --file {dump18}" cmd = f"hf mf mad --force --verbose --file {dump18}"
lprint(f"`{cmd}`", log=False) lprint(f"`{cmd}`", log=False)
lprint('\n`-._,-\'"`-._,-"`-._,-\'"`-._,-\'"`-._,-\'"`-._,-\'"`-._,-\'"`-._,-\'"`-._,\n') lprint('\n`-._,-\'"`-._,-"`-._,-\'"`-._,-\'"`-._,-\'"`-._,-\'"`-._,-\'"`-._,-\'"`-._,\n')

View file

@ -6172,6 +6172,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
arg_lit0(NULL, "be", "(optional, BigEndian)"), arg_lit0(NULL, "be", "(optional, BigEndian)"),
arg_lit0(NULL, "dch", "decode Card Holder information"), arg_lit0(NULL, "dch", "decode Card Holder information"),
arg_str0("f", "file", "<fn>", "load dump file and decode MAD"), arg_str0("f", "file", "<fn>", "load dump file and decode MAD"),
arg_lit0(NULL, "force", "force decode (skip key check)"),
arg_param_end arg_param_end
}; };
CLIExecWithReturn(ctx, Cmd, argtable, true); CLIExecWithReturn(ctx, Cmd, argtable, true);
@ -6185,6 +6186,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
bool keyB = arg_get_lit(ctx, 4); bool keyB = arg_get_lit(ctx, 4);
bool swapmad = arg_get_lit(ctx, 5); bool swapmad = arg_get_lit(ctx, 5);
bool decodeholder = arg_get_lit(ctx, 6); bool decodeholder = arg_get_lit(ctx, 6);
bool force = arg_get_lit(ctx, 8);
int fnlen = 0; int fnlen = 0;
char filename[FILE_PATH_SIZE] = {0}; char filename[FILE_PATH_SIZE] = {0};
@ -6214,7 +6216,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
} }
// MAD detection // MAD detection
if (HasMADKey(dump) == false) { if ((HasMADKey(dump) == false) && (force == false)) {
PrintAndLogEx(FAILED, "No MAD key was detected in the dump file"); PrintAndLogEx(FAILED, "No MAD key was detected in the dump file");
free(dump); free(dump);
return PM3_ESOFT; return PM3_ESOFT;