mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
added some error handling
This commit is contained in:
parent
a861d2971c
commit
8e6f08835d
1 changed files with 15 additions and 3 deletions
|
@ -751,13 +751,26 @@ static int CmdHFMFPChk(const char *cmd) {
|
|||
|
||||
bool pattern1b = arg_get_lit(7);
|
||||
bool pattern2b = arg_get_lit(8);
|
||||
|
||||
if (pattern1b && pattern2b) {
|
||||
PrintAndLogEx(ERROR, "Pattern search mode must be 2-byte or 1-byte only.");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
uint16_t startPattern = 0x0000;
|
||||
uint8_t vpattern[2];
|
||||
int vpatternlen = 0;
|
||||
CLIGetHexWithReturn(9, vpattern, &vpatternlen);
|
||||
if (vpatternlen > 0 && vpatternlen <= 2)
|
||||
startPattern = (vpattern[0] << 8) + vpattern[1];
|
||||
if (vpatternlen > 0) {
|
||||
if (vpatternlen > 0 && vpatternlen <= 2) {
|
||||
startPattern = (vpattern[0] << 8) + vpattern[1];
|
||||
} else {
|
||||
PrintAndLogEx(ERROR, "Pattern must be 2-byte length.");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
if (!pattern2b)
|
||||
PrintAndLogEx(WARNING, "Pattern entered, but search mode not is 2-byte search.");
|
||||
}
|
||||
|
||||
CLIParserFree();
|
||||
|
||||
|
@ -809,7 +822,6 @@ static int CmdHFMFPChk(const char *cmd) {
|
|||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
|
||||
res = MFPKeyCheck(startSector, endSector, startKeyAB, endKeyAB, keyList, keyListLen, foundKeys);
|
||||
printf("--- res: %d\n", res);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue