mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-22 06:13:27 -07:00
Fix "hf mf chk" <t|d|s|ss> flags.
The command flags are broken. "dss" or "tss" just fail. "ds" ignores "d" "ts" ignores "t" This should fix it. Note probably other commands (nested) are broken too.
This commit is contained in:
parent
dc3e2acf33
commit
e5bcf991c2
1 changed files with 25 additions and 22 deletions
|
@ -1040,7 +1040,7 @@ int CmdHF14AMfChk(const char *Cmd)
|
|||
int keycnt = 0;
|
||||
char ctmp = 0x00;
|
||||
int clen = 0;
|
||||
char ctmp3[3] = {0x00};
|
||||
char ctmp3[4] = {0x00,0x00,0x00,0x00};
|
||||
uint8_t blockNo = 0;
|
||||
uint8_t SectorsCnt = 0;
|
||||
uint8_t keyType = 0;
|
||||
|
@ -1050,6 +1050,7 @@ int CmdHF14AMfChk(const char *Cmd)
|
|||
|
||||
int transferToEml = 0;
|
||||
int createDumpFile = 0;
|
||||
int slower = 0;
|
||||
|
||||
sector_t *e_sector = NULL;
|
||||
|
||||
|
@ -1088,32 +1089,34 @@ int CmdHF14AMfChk(const char *Cmd)
|
|||
}
|
||||
|
||||
// transfer to emulator & create dump file
|
||||
ctmp = param_getchar(Cmd, 2);
|
||||
clen = param_getlength(Cmd, 2);
|
||||
if (clen == 1 && (ctmp == 't' || ctmp == 'T')) transferToEml = 1;
|
||||
if (clen == 1 && (ctmp == 'd' || ctmp == 'D')) createDumpFile = 1;
|
||||
|
||||
param3InUse = transferToEml | createDumpFile;
|
||||
|
||||
timeout14a = 500; // fast by default
|
||||
// double parameters - ts, ds
|
||||
|
||||
clen = param_getlength(Cmd, 2);
|
||||
if (clen == 2 || clen == 3){
|
||||
param_getstr(Cmd, 2, ctmp3, sizeof(ctmp3));
|
||||
ctmp = ctmp3[1];
|
||||
}
|
||||
//parse
|
||||
if (ctmp == 's' || ctmp == 'S') {
|
||||
timeout14a = 1000; // slow
|
||||
if (!param3InUse && clen == 2 && (ctmp3[1] == 's' || ctmp3[1] == 'S')) {
|
||||
timeout14a = 5000; // very slow
|
||||
param_getstr(Cmd, 2, ctmp3, sizeof(ctmp3));
|
||||
|
||||
for (i = 0; i < sizeof(ctmp3); i++) {
|
||||
ctmp = ctmp3[i];
|
||||
if (!createDumpFile && (ctmp == 't' || ctmp == 'T')) {
|
||||
transferToEml = 1; // mutually exclusive with d
|
||||
}
|
||||
if (param3InUse && clen == 3 && (ctmp3[2] == 's' || ctmp3[2] == 'S')) {
|
||||
timeout14a = 5000; // very slow
|
||||
if (!transferToEml && (ctmp == 'd' || ctmp == 'D' )) {
|
||||
createDumpFile = 1; // mutually exclusive with t
|
||||
}
|
||||
if (ctmp == 's' || ctmp == 'S') {
|
||||
if (timeout14a == 500) {
|
||||
timeout14a = 1000; // slow
|
||||
slower = 1;
|
||||
PrintAndLog("Using 1ms timeout");
|
||||
} else if (timeout14a == 1000) {
|
||||
timeout14a = 5000; // very slow
|
||||
slower = 1;
|
||||
PrintAndLog("Using 5ms timeout");
|
||||
}
|
||||
}
|
||||
param3InUse = true;
|
||||
}
|
||||
|
||||
param3InUse = transferToEml | createDumpFile | slower;
|
||||
|
||||
for (i = param3InUse; param_getchar(Cmd, 2 + i); i++) {
|
||||
if (!param_gethex(Cmd, 2 + i, keyBlock + 6 * keycnt, 12)) {
|
||||
if ( stKeyBlock - keycnt < 2) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue