mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 22:23:38 -07:00
hf mf nested small refactoring in parsing parameters area
This commit is contained in:
parent
90284d6737
commit
2e81635cb7
1 changed files with 33 additions and 27 deletions
|
@ -574,32 +574,24 @@ int CmdHF14AMfNested(const char *Cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// <card memory>
|
||||||
cmdp = param_getchar(Cmd, 0);
|
cmdp = param_getchar(Cmd, 0);
|
||||||
switch (cmdp) {
|
if (cmdp == 'o' || cmdp == 'O') {
|
||||||
case 'o':
|
cmdp = 'o';
|
||||||
case 'O':
|
SectorsCnt = 1;
|
||||||
cmdp = 'o';
|
} else {
|
||||||
trgBlockNo = param_get8(Cmd, 4);
|
SectorsCnt = ParamCardSizeSectors(cmdp);
|
||||||
|
|
||||||
ctmp = param_getchar(Cmd, 5);
|
|
||||||
if (ctmp != 'a' && ctmp != 'A' && ctmp != 'b' && ctmp != 'B') {
|
|
||||||
PrintAndLog("Target key type must be A or B");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (ctmp != 'A' && ctmp != 'a')
|
|
||||||
trgKeyType = 1;
|
|
||||||
break;
|
|
||||||
// size of card 0.5k - 4k
|
|
||||||
default: SectorsCnt = ParamCardSizeSectors(cmdp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// block number. number or autosearch key (*)
|
// <block number>. number or autosearch key (*)
|
||||||
if (param_getchar(Cmd, 1) == '*') {
|
if (param_getchar(Cmd, 1) == '*') {
|
||||||
autosearchKey = true;
|
autosearchKey = true;
|
||||||
|
|
||||||
ctmp = param_getchar(Cmd, 2);
|
ctmp = param_getchar(Cmd, 2);
|
||||||
transferToEml |= (ctmp == 't' || ctmp == 'T');
|
transferToEml |= (ctmp == 't' || ctmp == 'T');
|
||||||
createDumpFile |= (ctmp == 'd' || ctmp == 'D');
|
createDumpFile |= (ctmp == 'd' || ctmp == 'D');
|
||||||
|
|
||||||
|
PrintAndLog("--nested. sectors:%2d, block no:*, , eml:%c, dmp=%c ", SectorsCnt, transferToEml?'y':'n', createDumpFile?'y':'n');
|
||||||
} else {
|
} else {
|
||||||
blockNo = param_get8(Cmd, 1);
|
blockNo = param_get8(Cmd, 1);
|
||||||
|
|
||||||
|
@ -617,20 +609,34 @@ int CmdHF14AMfNested(const char *Cmd)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctmp = param_getchar(Cmd, 4);
|
|
||||||
transferToEml |= (ctmp == 't' || ctmp == 'T');
|
|
||||||
createDumpFile |= (ctmp == 'd' || ctmp == 'D');
|
|
||||||
|
|
||||||
ctmp = param_getchar(Cmd, 6);
|
|
||||||
transferToEml |= (ctmp == 't' || ctmp == 'T');
|
|
||||||
createDumpFile |= (ctmp == 'd' || ctmp == 'D');
|
|
||||||
|
|
||||||
// check if we can authenticate to sector
|
// check if we can authenticate to sector
|
||||||
res = mfCheckKeys(blockNo, keyType, true, 1, key, &key64);
|
res = mfCheckKeys(blockNo, keyType, true, 1, key, &key64);
|
||||||
if (res) {
|
if (res) {
|
||||||
PrintAndLog("Can't authenticate to block:%3d key type:%c key:%s", blockNo, keyType?'B':'A', sprint_hex(key, 6));
|
PrintAndLog("Can't authenticate to block:%3d key type:%c key:%s", blockNo, keyType?'B':'A', sprint_hex(key, 6));
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmdp == 'o') {
|
||||||
|
trgBlockNo = param_get8(Cmd, 4);
|
||||||
|
|
||||||
|
ctmp = param_getchar(Cmd, 5);
|
||||||
|
if (ctmp != 'a' && ctmp != 'A' && ctmp != 'b' && ctmp != 'B') {
|
||||||
|
PrintAndLog("Target key type must be A or B");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (ctmp != 'A' && ctmp != 'a')
|
||||||
|
trgKeyType = 1;
|
||||||
|
|
||||||
|
ctmp = param_getchar(Cmd, 6);
|
||||||
|
transferToEml |= (ctmp == 't' || ctmp == 'T');
|
||||||
|
createDumpFile |= (ctmp == 'd' || ctmp == 'D');
|
||||||
|
} else {
|
||||||
|
ctmp = param_getchar(Cmd, 4);
|
||||||
|
transferToEml |= (ctmp == 't' || ctmp == 'T');
|
||||||
|
createDumpFile |= (ctmp == 'd' || ctmp == 'D');
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintAndLog("--nested. sectors:%2d, block no:%3d, key type:%c, eml:%c, dmp=%c ", SectorsCnt, blockNo, keyType?'B':'A', transferToEml?'y':'n', createDumpFile?'y':'n');
|
||||||
}
|
}
|
||||||
|
|
||||||
// one-sector nested
|
// one-sector nested
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue