Skip to content

Commit ef4cbff

Browse files
authored
Merge pull request #2630 from csBlueChip/master
Ability to force MAD decode
2 parents 9ac59b5 + 0638603 commit ef4cbff

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

client/pyscripts/fm11rf08_full.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def main():
166166
# Currently dumpAcl is hardcoded for RF08S
167167
dumpAcl(data)
168168

169-
if mad is True:
169+
if (mad is True) or (args.mad is True):
170170
dumpMad(dump18)
171171

172172
if (args.bambu is True) or (detectBambu(data) is True):
@@ -207,6 +207,7 @@ def parseCli():
207207
parser.add_argument('-r', '--recover', action='store_true', help='run key recovery script if required')
208208
parser.add_argument('-f', '--force', action='store_true', help='force recovery of keys')
209209
parser.add_argument('-b', '--bambu', action='store_true', help='force Bambu tag decode')
210+
parser.add_argument('-m', '--mad', action='store_true', help='force M.A.D. decode')
210211
parser.add_argument('-v', '--validate', action='store_true', help='check Fudan signature (requires internet)')
211212
parser.add_argument('--fast', action='store_true', help='use ecfill for faster card transactions')
212213

@@ -977,7 +978,7 @@ def dumpMad(dump18):
977978
lprint("====================================")
978979
lprint()
979980

980-
cmd = f"hf mf mad --verbose --file {dump18}"
981+
cmd = f"hf mf mad --force --verbose --file {dump18}"
981982
lprint(f"`{cmd}`", log=False)
982983

983984
lprint('\n`-._,-\'"`-._,-"`-._,-\'"`-._,-\'"`-._,-\'"`-._,-\'"`-._,-\'"`-._,-\'"`-._,\n')

client/src/cmdhfmf.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6171,7 +6171,8 @@ static int CmdHF14AMfMAD(const char *Cmd) {
61716171
arg_lit0("b", "keyb", "use key B for access printing sectors (by default: key A)"),
61726172
arg_lit0(NULL, "be", "(optional, BigEndian)"),
61736173
arg_lit0(NULL, "dch", "decode Card Holder information"),
6174-
arg_str0("f", "file", "<fn>", "load dump file and decode MAD"),
6174+
arg_str0("f", "file", "<fn>", "load dump file and decode MAD"),
6175+
arg_lit0(NULL, "force", "force decode (skip key check)"),
61756176
arg_param_end
61766177
};
61776178
CLIExecWithReturn(ctx, Cmd, argtable, true);
@@ -6185,6 +6186,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
61856186
bool keyB = arg_get_lit(ctx, 4);
61866187
bool swapmad = arg_get_lit(ctx, 5);
61876188
bool decodeholder = arg_get_lit(ctx, 6);
6189+
bool force = arg_get_lit(ctx, 8);
61886190

61896191
int fnlen = 0;
61906192
char filename[FILE_PATH_SIZE] = {0};
@@ -6214,7 +6216,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
62146216
}
62156217

62166218
// MAD detection
6217-
if (HasMADKey(dump) == false) {
6219+
if ((HasMADKey(dump) == false) && (force == false)) {
62186220
PrintAndLogEx(FAILED, "No MAD key was detected in the dump file");
62196221
free(dump);
62206222
return PM3_ESOFT;

0 commit comments

Comments
 (0)