Merge pull request #2630 from csBlueChip/master

Ability to force MAD decode
This commit is contained in:
Iceman 2024-11-13 17:50:01 +01:00 committed by GitHub
commit ef4cbff857
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View file

@ -166,7 +166,7 @@ globals:
# Currently dumpAcl is hardcoded for RF08S # Currently dumpAcl is hardcoded for RF08S
dumpAcl(data) dumpAcl(data)
if mad is True: if (mad is True) or (args.mad is True):
dumpMad(dump18) dumpMad(dump18)
if (args.bambu is True) or (detectBambu(data) is True): if (args.bambu is True) or (detectBambu(data) is True):
@ -207,6 +207,7 @@ def parseCli():
parser.add_argument('-r', '--recover', action='store_true', help='run key recovery script if required') parser.add_argument('-r', '--recover', action='store_true', help='run key recovery script if required')
parser.add_argument('-f', '--force', action='store_true', help='force recovery of keys') parser.add_argument('-f', '--force', action='store_true', help='force recovery of keys')
parser.add_argument('-b', '--bambu', action='store_true', help='force Bambu tag decode') parser.add_argument('-b', '--bambu', action='store_true', help='force Bambu tag decode')
parser.add_argument('-m', '--mad', action='store_true', help='force M.A.D. decode')
parser.add_argument('-v', '--validate', action='store_true', help='check Fudan signature (requires internet)') parser.add_argument('-v', '--validate', action='store_true', help='check Fudan signature (requires internet)')
parser.add_argument('--fast', action='store_true', help='use ecfill for faster card transactions') parser.add_argument('--fast', action='store_true', help='use ecfill for faster card transactions')
@ -977,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

@ -6171,7 +6171,8 @@ static int CmdHF14AMfMAD(const char *Cmd) {
arg_lit0("b", "keyb", "use key B for access printing sectors (by default: key A)"), arg_lit0("b", "keyb", "use key B for access printing sectors (by default: key A)"),
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;