mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-20 13:23:25 -07:00
parent
03439be30f
commit
5594c6215e
1 changed files with 15 additions and 35 deletions
|
@ -534,7 +534,7 @@ int CmdHF14AMfRestore(const char *Cmd)
|
||||||
//----------------------------------------------
|
//----------------------------------------------
|
||||||
|
|
||||||
static void parseParamTDS(const char *Cmd, const uint8_t indx, bool *paramT, bool *paramD, uint8_t *timeout) {
|
static void parseParamTDS(const char *Cmd, const uint8_t indx, bool *paramT, bool *paramD, uint8_t *timeout) {
|
||||||
char ctmp3[3] = {0};
|
char ctmp3[4] = {0};
|
||||||
int len = param_getlength(Cmd, indx);
|
int len = param_getlength(Cmd, indx);
|
||||||
if (len > 0 && len < 4){
|
if (len > 0 && len < 4){
|
||||||
param_getstr(Cmd, indx, ctmp3, sizeof(ctmp3));
|
param_getstr(Cmd, indx, ctmp3, sizeof(ctmp3));
|
||||||
|
@ -1040,16 +1040,16 @@ int CmdHF14AMfChk(const char *Cmd)
|
||||||
int keycnt = 0;
|
int keycnt = 0;
|
||||||
char ctmp = 0x00;
|
char ctmp = 0x00;
|
||||||
int clen = 0;
|
int clen = 0;
|
||||||
char ctmp3[3] = {0x00};
|
|
||||||
uint8_t blockNo = 0;
|
uint8_t blockNo = 0;
|
||||||
uint8_t SectorsCnt = 0;
|
uint8_t SectorsCnt = 0;
|
||||||
uint8_t keyType = 0;
|
uint8_t keyType = 0;
|
||||||
uint64_t key64 = 0;
|
uint64_t key64 = 0;
|
||||||
uint32_t timeout14a = 0; // timeout in us
|
// timeout in units. (ms * 106)/10 or us*0.0106
|
||||||
|
uint8_t btimeout14a = MF_CHKKEYS_DEFTIMEOUT; // fast by default
|
||||||
bool param3InUse = false;
|
bool param3InUse = false;
|
||||||
|
|
||||||
int transferToEml = 0;
|
bool transferToEml = 0;
|
||||||
int createDumpFile = 0;
|
bool createDumpFile = 0;
|
||||||
|
|
||||||
sector_t *e_sector = NULL;
|
sector_t *e_sector = NULL;
|
||||||
|
|
||||||
|
@ -1087,32 +1087,12 @@ int CmdHF14AMfChk(const char *Cmd)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// transfer to emulator & create dump file
|
parseParamTDS(Cmd, 2, &transferToEml, &createDumpFile, &btimeout14a);
|
||||||
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;
|
param3InUse = transferToEml | createDumpFile | (btimeout14a != MF_CHKKEYS_DEFTIMEOUT);
|
||||||
|
|
||||||
timeout14a = 500; // fast by default
|
PrintAndLog("--chk keys. sectors:%2d, block no:%3d, key type:%c, eml:%c, dmp=%c checktimeout=%d us",
|
||||||
// double parameters - ts, ds
|
SectorsCnt, blockNo, keyType?'B':'A', transferToEml?'y':'n', createDumpFile?'y':'n', ((int)btimeout14a * 10000) / 106);
|
||||||
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
|
|
||||||
}
|
|
||||||
if (param3InUse && clen == 3 && (ctmp3[2] == 's' || ctmp3[2] == 'S')) {
|
|
||||||
timeout14a = 5000; // very slow
|
|
||||||
}
|
|
||||||
param3InUse = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = param3InUse; param_getchar(Cmd, 2 + i); i++) {
|
for (i = param3InUse; param_getchar(Cmd, 2 + i); i++) {
|
||||||
if (!param_gethex(Cmd, 2 + i, keyBlock + 6 * keycnt, 12)) {
|
if (!param_gethex(Cmd, 2 + i, keyBlock + 6 * keycnt, 12)) {
|
||||||
|
@ -1210,7 +1190,7 @@ int CmdHF14AMfChk(const char *Cmd)
|
||||||
for (uint32_t c = 0; c < keycnt; c += max_keys) {
|
for (uint32_t c = 0; c < keycnt; c += max_keys) {
|
||||||
|
|
||||||
uint32_t size = keycnt-c > max_keys ? max_keys : keycnt-c;
|
uint32_t size = keycnt-c > max_keys ? max_keys : keycnt-c;
|
||||||
res = mfCheckKeysSec(SectorsCnt, keyType, timeout14a * 1.06 / 100, true, size, &keyBlock[6 * c], e_sector); // timeout is (ms * 106)/10 or us*0.0106
|
res = mfCheckKeysSec(SectorsCnt, keyType, btimeout14a, true, size, &keyBlock[6 * c], e_sector); // timeout is (ms * 106)/10 or us*0.0106
|
||||||
|
|
||||||
if (res != 1) {
|
if (res != 1) {
|
||||||
if (!res) {
|
if (!res) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue