mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-16 10:03:04 -07:00
cliparser: generalize ctx usage
This commit is contained in:
parent
569107579e
commit
cb614f3f11
9 changed files with 181 additions and 181 deletions
|
@ -18,21 +18,21 @@
|
|||
#define arg_param_end arg_end(20)
|
||||
|
||||
#define arg_getsize(a) (sizeof(a) / sizeof(a[0]))
|
||||
#define arg_get_lit(n) (((struct arg_lit*)argtable[n])->count)
|
||||
#define arg_get_int_count(n)(((struct arg_int*)argtable[n])->count)
|
||||
#define arg_get_int(n) (((struct arg_int*)argtable[n])->ival[0])
|
||||
#define arg_get_int_def(n, def)(arg_get_int_count(n) ? (arg_get_int(n)) : (def))
|
||||
#define arg_get_str(n) ((struct arg_str*)argtable[n])
|
||||
#define arg_get_str_len(n) (strlen(((struct arg_str*)argtable[n])->sval[0]))
|
||||
#define arg_get_lit(ctx, n) (((struct arg_lit*)((ctx)->argtable)[n])->count)
|
||||
#define arg_get_int_count(ctx, n)(((struct arg_int*)((ctx)->argtable)[n])->count)
|
||||
#define arg_get_int(ctx, n) (((struct arg_int*)((ctx)->argtable)[n])->ival[0])
|
||||
#define arg_get_int_def(ctx, n, def)(arg_get_int_count((ctx), n) ? (arg_get_int((ctx), n)) : (def))
|
||||
#define arg_get_str(ctx, n) ((struct arg_str*)((ctx)->argtable)[n])
|
||||
#define arg_get_str_len(ctx, n) (strlen(((struct arg_str*)((ctx)->argtable)[n])->sval[0]))
|
||||
|
||||
#define arg_strx1(shortopts, longopts, datatype, glossary) (arg_strn((shortopts), (longopts), (datatype), 1, 250, (glossary)))
|
||||
#define arg_strx0(shortopts, longopts, datatype, glossary) (arg_strn((shortopts), (longopts), (datatype), 0, 250, (glossary)))
|
||||
|
||||
#define CLIParserFree(ctx) if ((ctx)) {arg_freetable(ctx->argtable, ctx->argtableLen); free((ctx)); (ctx)=NULL;}
|
||||
#define CLIExecWithReturn(ctx, cmd, atbl, ifempty) if (CLIParserParseString(ctx, cmd, atbl, arg_getsize(atbl), ifempty)) {CLIParserFree((ctx)); return PM3_ESOFT;}
|
||||
#define CLIGetHexBLessWithReturn(ctx, paramnum, data, datalen, delta) if (CLIParamHexToBuf(arg_get_str(paramnum), data, sizeof(data) - (delta), datalen)) {CLIParserFree((ctx)); return PM3_ESOFT;}
|
||||
#define CLIGetHexWithReturn(ctx, paramnum, data, datalen) if (CLIParamHexToBuf(arg_get_str(paramnum), data, sizeof(data), datalen)) {CLIParserFree((ctx)); return PM3_ESOFT;}
|
||||
#define CLIGetStrWithReturn(ctx, paramnum, data, datalen) if (CLIParamStrToBuf(arg_get_str(paramnum), data, sizeof(data), datalen)) {CLIParserFree((ctx)); return PM3_ESOFT;}
|
||||
#define CLIGetHexBLessWithReturn(ctx, paramnum, data, datalen, delta) if (CLIParamHexToBuf(arg_get_str(ctx, paramnum), data, sizeof(data) - (delta), datalen)) {CLIParserFree((ctx)); return PM3_ESOFT;}
|
||||
#define CLIGetHexWithReturn(ctx, paramnum, data, datalen) if (CLIParamHexToBuf(arg_get_str(ctx, paramnum), data, sizeof(data), datalen)) {CLIParserFree((ctx)); return PM3_ESOFT;}
|
||||
#define CLIGetStrWithReturn(ctx, paramnum, data, datalen) if (CLIParamStrToBuf(arg_get_str(ctx, paramnum), data, sizeof(data), datalen)) {CLIParserFree((ctx)); return PM3_ESOFT;}
|
||||
|
||||
typedef struct {
|
||||
void **argtable;
|
||||
|
|
|
@ -378,9 +378,9 @@ static int CmdHF14AInfo(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
verbose = arg_get_lit(1);
|
||||
do_nack_test = arg_get_lit(2);
|
||||
do_aid_search = arg_get_lit(3);
|
||||
verbose = arg_get_lit(ctx, 1);
|
||||
do_nack_test = arg_get_lit(ctx, 2);
|
||||
do_aid_search = arg_get_lit(ctx, 3);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
@ -903,10 +903,10 @@ static int CmdHF14AAPDU(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
activateField = arg_get_lit(1);
|
||||
leaveSignalON = arg_get_lit(2);
|
||||
decodeTLV = arg_get_lit(3);
|
||||
decodeAPDU = arg_get_lit(4);
|
||||
activateField = arg_get_lit(ctx, 1);
|
||||
leaveSignalON = arg_get_lit(ctx, 2);
|
||||
decodeTLV = arg_get_lit(ctx, 3);
|
||||
decodeAPDU = arg_get_lit(ctx, 4);
|
||||
|
||||
CLIGetHexWithReturn(ctx, 5, header, &headerlen);
|
||||
makeAPDU = headerlen > 0;
|
||||
|
@ -915,8 +915,8 @@ static int CmdHF14AAPDU(const char *Cmd) {
|
|||
CLIParserFree(ctx);
|
||||
return 1;
|
||||
}
|
||||
extendedAPDU = arg_get_lit(6);
|
||||
le = arg_get_int_def(7, 0);
|
||||
extendedAPDU = arg_get_lit(ctx, 6);
|
||||
le = arg_get_int_def(ctx, 7, 0);
|
||||
|
||||
if (makeAPDU) {
|
||||
uint8_t apdudata[PM3_CMD_DATA_SIZE] = {0};
|
||||
|
@ -1186,9 +1186,9 @@ static int CmdHF14AAntiFuzz(const char *Cmd) {
|
|||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
uint8_t arg0 = FLAG_4B_UID_IN_DATA;
|
||||
if (arg_get_lit(2))
|
||||
if (arg_get_lit(ctx, 2))
|
||||
arg0 = FLAG_7B_UID_IN_DATA;
|
||||
if (arg_get_lit(3))
|
||||
if (arg_get_lit(ctx, 3))
|
||||
arg0 = FLAG_10B_UID_IN_DATA;
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
@ -1213,8 +1213,8 @@ static int CmdHF14AChaining(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
struct arg_str *str = arg_get_str(1);
|
||||
int len = arg_get_str_len(1);
|
||||
struct arg_str *str = arg_get_str(ctx, 1);
|
||||
int len = arg_get_str_len(ctx, 1);
|
||||
|
||||
if (len && (!strcmp(str->sval[0], "enable") || !strcmp(str->sval[0], "1")))
|
||||
APDUInFramingEnable = true;
|
||||
|
|
|
@ -117,7 +117,7 @@ static json_t *OpenJson(CLIParserContext *ctx, int paramnum, char *fname, void *
|
|||
int jsonnamelen = 0;
|
||||
|
||||
// CLIGetStrWithReturn(ctx, paramnum, jsonname, &jsonnamelen);
|
||||
if (CLIParamStrToBuf(arg_get_str(paramnum), jsonname, sizeof(jsonname), &jsonnamelen)) {
|
||||
if (CLIParamStrToBuf(arg_get_str(ctx, paramnum), jsonname, sizeof(jsonname), &jsonnamelen)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -177,11 +177,11 @@ static int CmdHFFidoRegister(const char *cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, cmd, argtable, true);
|
||||
|
||||
bool APDULogging = arg_get_lit(1);
|
||||
bool verbose = arg_get_lit(2);
|
||||
bool verbose2 = arg_get_lit(2) > 1;
|
||||
bool paramsPlain = arg_get_lit(3);
|
||||
bool showDERTLV = arg_get_lit(4);
|
||||
bool APDULogging = arg_get_lit(ctx, 1);
|
||||
bool verbose = arg_get_lit(ctx, 2);
|
||||
bool verbose2 = arg_get_lit(ctx, 2) > 1;
|
||||
bool paramsPlain = arg_get_lit(ctx, 3);
|
||||
bool showDERTLV = arg_get_lit(ctx, 4);
|
||||
|
||||
char fname[FILE_PATH_SIZE] = {0};
|
||||
bool err;
|
||||
|
@ -418,13 +418,13 @@ static int CmdHFFidoAuthenticate(const char *cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, cmd, argtable, true);
|
||||
|
||||
bool APDULogging = arg_get_lit(1);
|
||||
bool verbose = arg_get_lit(2);
|
||||
bool paramsPlain = arg_get_lit(3);
|
||||
bool APDULogging = arg_get_lit(ctx, 1);
|
||||
bool verbose = arg_get_lit(ctx, 2);
|
||||
bool paramsPlain = arg_get_lit(ctx, 3);
|
||||
uint8_t controlByte = 0x08;
|
||||
if (arg_get_lit(5))
|
||||
if (arg_get_lit(ctx, 5))
|
||||
controlByte = 0x03;
|
||||
if (arg_get_lit(6))
|
||||
if (arg_get_lit(ctx, 6))
|
||||
controlByte = 0x07;
|
||||
|
||||
char fname[250] = {0};
|
||||
|
@ -673,11 +673,11 @@ static int CmdHFFido2MakeCredential(const char *cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, cmd, argtable, true);
|
||||
|
||||
bool APDULogging = arg_get_lit(1);
|
||||
bool verbose = arg_get_lit(2);
|
||||
bool verbose2 = arg_get_lit(2) > 1;
|
||||
bool showDERTLV = arg_get_lit(3);
|
||||
bool showCBOR = arg_get_lit(4);
|
||||
bool APDULogging = arg_get_lit(ctx, 1);
|
||||
bool verbose = arg_get_lit(ctx, 2);
|
||||
bool verbose2 = arg_get_lit(ctx, 2) > 1;
|
||||
bool showDERTLV = arg_get_lit(ctx, 3);
|
||||
bool showCBOR = arg_get_lit(ctx, 4);
|
||||
|
||||
uint8_t jsonname[FILE_PATH_SIZE] = {0};
|
||||
char *cjsonname = (char *)jsonname;
|
||||
|
@ -798,11 +798,11 @@ static int CmdHFFido2GetAssertion(const char *cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, cmd, argtable, true);
|
||||
|
||||
bool APDULogging = arg_get_lit(1);
|
||||
bool verbose = arg_get_lit(2);
|
||||
bool verbose2 = arg_get_lit(2) > 1;
|
||||
bool showCBOR = arg_get_lit(3);
|
||||
bool createAllowList = arg_get_lit(4);
|
||||
bool APDULogging = arg_get_lit(ctx, 1);
|
||||
bool verbose = arg_get_lit(ctx, 2);
|
||||
bool verbose2 = arg_get_lit(ctx, 2) > 1;
|
||||
bool showCBOR = arg_get_lit(ctx, 3);
|
||||
bool createAllowList = arg_get_lit(ctx, 4);
|
||||
|
||||
uint8_t jsonname[FILE_PATH_SIZE] = {0};
|
||||
char *cjsonname = (char *)jsonname;
|
||||
|
|
|
@ -4506,16 +4506,16 @@ static int CmdHF14AMfMAD(const char *Cmd) {
|
|||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
bool verbose = arg_get_lit(1);
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
uint8_t aid[2] = {0};
|
||||
int aidlen;
|
||||
CLIGetHexWithReturn(ctx, 2, aid, &aidlen);
|
||||
uint8_t key[6] = {0};
|
||||
int keylen;
|
||||
CLIGetHexWithReturn(ctx, 3, key, &keylen);
|
||||
bool keyB = arg_get_lit(4);
|
||||
bool swapmad = arg_get_lit(5);
|
||||
bool decodeholder = arg_get_lit(6);
|
||||
bool keyB = arg_get_lit(ctx, 4);
|
||||
bool swapmad = arg_get_lit(ctx, 5);
|
||||
bool decodeholder = arg_get_lit(ctx, 6);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
@ -4637,15 +4637,15 @@ static int CmdHFMFNDEF(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool verbose = arg_get_lit(1);
|
||||
bool verbose2 = arg_get_lit(1) > 1;
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
bool verbose2 = arg_get_lit(ctx, 1) > 1;
|
||||
uint8_t aid[2] = {0};
|
||||
int aidlen;
|
||||
CLIGetHexWithReturn(ctx, 2, aid, &aidlen);
|
||||
uint8_t key[6] = {0};
|
||||
int keylen;
|
||||
CLIGetHexWithReturn(ctx, 3, key, &keylen);
|
||||
bool keyB = arg_get_lit(4);
|
||||
bool keyB = arg_get_lit(ctx, 4);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
@ -4746,7 +4746,7 @@ static int CmdHFMFPersonalize(const char *cmd) {
|
|||
char keytypestr[2] = "a";
|
||||
uint8_t keytype = 0x00;
|
||||
int keytypestr_len;
|
||||
int res = CLIParamStrToBuf(arg_get_str(1), (uint8_t *)keytypestr, 1, &keytypestr_len);
|
||||
int res = CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)keytypestr, 1, &keytypestr_len);
|
||||
str_lower(keytypestr);
|
||||
|
||||
if (res || (keytypestr[0] != 'a' && keytypestr[0] != 'b')) {
|
||||
|
@ -4760,7 +4760,7 @@ static int CmdHFMFPersonalize(const char *cmd) {
|
|||
|
||||
uint8_t key[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
|
||||
int key_len;
|
||||
res = CLIParamHexToBuf(arg_get_str(2), key, 6, &key_len);
|
||||
res = CLIParamHexToBuf(arg_get_str(ctx, 2), key, 6, &key_len);
|
||||
if (res || (!res && key_len > 0 && key_len != 6)) {
|
||||
PrintAndLogEx(ERR, "ERROR: not a valid key. Key must be 12 hex digits");
|
||||
CLIParserFree(ctx);
|
||||
|
@ -4770,7 +4770,7 @@ static int CmdHFMFPersonalize(const char *cmd) {
|
|||
char pers_optionstr[6];
|
||||
int opt_len;
|
||||
uint8_t pers_option;
|
||||
res = CLIParamStrToBuf(arg_get_str(3), (uint8_t *)pers_optionstr, 5, &opt_len);
|
||||
res = CLIParamStrToBuf(arg_get_str(ctx, 3), (uint8_t *)pers_optionstr, 5, &opt_len);
|
||||
str_lower(pers_optionstr);
|
||||
|
||||
if (res || (!res && opt_len > 0 && opt_len != 5)
|
||||
|
|
|
@ -2100,7 +2100,7 @@ static int CmdHF14ADesCreateFile(const char *Cmd) {
|
|||
uint8_t fid[2] = {0};
|
||||
CLIGetHexWithReturn(ctx, 3, fid, &fidlength);
|
||||
|
||||
uint8_t comset = arg_get_int(4);
|
||||
uint8_t comset = arg_get_int(ctx, 4);
|
||||
int arlength = 0;
|
||||
uint8_t ar[2] = {0};
|
||||
CLIGetHexWithReturn(ctx, 5, ar, &arlength);
|
||||
|
@ -2109,7 +2109,7 @@ static int CmdHF14ADesCreateFile(const char *Cmd) {
|
|||
uint8_t filesize[3] = {0};
|
||||
CLIGetHexWithReturn(ctx, 6, filesize, &fsizelen);
|
||||
|
||||
bool isbackup = arg_get_lit(7);
|
||||
bool isbackup = arg_get_lit(ctx, 7);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
swap24(aid);
|
||||
|
@ -2281,7 +2281,7 @@ static int CmdHF14ADesReadData(const char *Cmd) {
|
|||
uint8_t filesize[3] = {0};
|
||||
CLIGetHexWithReturn(ctx, 4, filesize, &flength);
|
||||
|
||||
int type = arg_get_int(5);
|
||||
int type = arg_get_int(ctx, 5);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (type > 1) {
|
||||
|
@ -2385,7 +2385,7 @@ static int CmdHF14ADesChangeValue(const char *Cmd) {
|
|||
int vlength = 0x0;
|
||||
CLIGetHexWithReturn(ctx, 3, value.value, &vlength);
|
||||
|
||||
int mode = arg_get_int(4);
|
||||
int mode = arg_get_int(ctx, 4);
|
||||
CLIParserFree(ctx);
|
||||
swap24(aid);
|
||||
|
||||
|
@ -2485,13 +2485,13 @@ static int CmdHF14ADesWriteData(const char *Cmd) {
|
|||
CLIParserFree(ctx);
|
||||
return PM3_EMALLOC;
|
||||
}
|
||||
if (CLIParamHexToBuf(arg_get_str(4), data, dlength, &dlength)) {
|
||||
if (CLIParamHexToBuf(arg_get_str(ctx, 4), data, dlength, &dlength)) {
|
||||
free(data);
|
||||
CLIParserFree(ctx);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
int type = arg_get_int(5);
|
||||
int type = arg_get_int(ctx, 5);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
@ -2597,7 +2597,7 @@ static int CmdHF14ADesCreateRecordFile(const char *Cmd) {
|
|||
uint8_t fid[2] = {0};
|
||||
CLIGetHexWithReturn(ctx, 3, fid, &fidlength);
|
||||
|
||||
uint8_t comset = arg_get_int(4);
|
||||
uint8_t comset = arg_get_int(ctx, 4);
|
||||
int arlength = 0;
|
||||
uint8_t ar[2] = {0};
|
||||
CLIGetHexWithReturn(ctx, 5, ar, &arlength);
|
||||
|
@ -2610,7 +2610,7 @@ static int CmdHF14ADesCreateRecordFile(const char *Cmd) {
|
|||
uint8_t maxnumrecords[3] = {0};
|
||||
CLIGetHexWithReturn(ctx, 7, maxnumrecords, &msizelen);
|
||||
|
||||
bool cyclic = arg_get_lit(8);
|
||||
bool cyclic = arg_get_lit(ctx, 8);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
swap24(aid);
|
||||
|
@ -2724,7 +2724,7 @@ static int CmdHF14ADesCreateValueFile(const char *Cmd) {
|
|||
uint8_t _fileno[1] = {0};
|
||||
CLIGetHexWithReturn(ctx, 2, _fileno, &filenolen);
|
||||
|
||||
uint8_t comset = arg_get_int(3);
|
||||
uint8_t comset = arg_get_int(ctx, 3);
|
||||
int arlength = 0;
|
||||
uint8_t ar[2] = {0};
|
||||
CLIGetHexWithReturn(ctx, 4, ar, &arlength);
|
||||
|
@ -3452,14 +3452,14 @@ static int CmdHF14ADesAuth(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
uint8_t cmdAuthMode = arg_get_int_def(1, 0);
|
||||
uint8_t cmdAuthAlgo = arg_get_int_def(2, 0);
|
||||
uint8_t cmdAuthMode = arg_get_int_def(ctx, 1, 0);
|
||||
uint8_t cmdAuthAlgo = arg_get_int_def(ctx, 2, 0);
|
||||
|
||||
int aidlength = 3;
|
||||
uint8_t aid[3] = {0};
|
||||
CLIGetHexWithReturn(ctx, 3, aid, &aidlength);
|
||||
swap24(aid);
|
||||
uint8_t cmdKeyNo = arg_get_int_def(4, 0);
|
||||
uint8_t cmdKeyNo = arg_get_int_def(ctx, 4, 0);
|
||||
|
||||
uint8_t key[24] = {0};
|
||||
int keylen = 0;
|
||||
|
@ -3925,14 +3925,14 @@ static int CmdHF14aDesChk(const char *Cmd) {
|
|||
|
||||
uint8_t dict_filename[FILE_PATH_SIZE + 2] = {0};
|
||||
int dict_filenamelen = 0;
|
||||
if (CLIParamStrToBuf(arg_get_str(3), dict_filename, FILE_PATH_SIZE, &dict_filenamelen)) {
|
||||
if (CLIParamStrToBuf(arg_get_str(ctx, 3), dict_filename, FILE_PATH_SIZE, &dict_filenamelen)) {
|
||||
PrintAndLogEx(FAILED, "File name too long or invalid.");
|
||||
CLIParserFree(ctx);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
bool pattern1b = arg_get_lit(4);
|
||||
bool pattern2b = arg_get_lit(5);
|
||||
bool pattern1b = arg_get_lit(ctx, 4);
|
||||
bool pattern2b = arg_get_lit(ctx, 5);
|
||||
|
||||
if (pattern1b && pattern2b) {
|
||||
PrintAndLogEx(ERR, "Pattern search mode must be 2-byte or 1-byte only.");
|
||||
|
@ -3964,14 +3964,14 @@ static int CmdHF14aDesChk(const char *Cmd) {
|
|||
|
||||
uint8_t jsonname[250] = {0};
|
||||
int jsonnamelen = 0;
|
||||
if (CLIParamStrToBuf(arg_get_str(7), jsonname, sizeof(jsonname), &jsonnamelen)) {
|
||||
if (CLIParamStrToBuf(arg_get_str(ctx, 7), jsonname, sizeof(jsonname), &jsonnamelen)) {
|
||||
PrintAndLogEx(ERR, "Invalid json name.");
|
||||
CLIParserFree(ctx);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
jsonname[jsonnamelen] = 0;
|
||||
|
||||
bool verbose = arg_get_lit(8);
|
||||
bool verbose = arg_get_lit(ctx, 8);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
|
|
@ -439,7 +439,7 @@ static int CmdHFMFPWritePerso(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool verbose = arg_get_lit(1);
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
CLIGetHexWithReturn(ctx, 2, keyNum, &keyNumLen);
|
||||
CLIGetHexWithReturn(ctx, 3, key, &keyLen);
|
||||
CLIParserFree(ctx);
|
||||
|
@ -505,8 +505,8 @@ static int CmdHFMFPInitPerso(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool verbose = arg_get_lit(1);
|
||||
bool verbose2 = arg_get_lit(1) > 1;
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
bool verbose2 = arg_get_lit(ctx, 1) > 1;
|
||||
CLIGetHexWithReturn(ctx, 2, key, &keyLen);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
@ -572,7 +572,7 @@ static int CmdHFMFPCommitPerso(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool verbose = arg_get_lit(1);
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
mfpSetVerboseMode(verbose);
|
||||
|
@ -621,7 +621,7 @@ static int CmdHFMFPAuth(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool verbose = arg_get_lit(1);
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
CLIGetHexWithReturn(ctx, 2, keyn, &keynlen);
|
||||
CLIGetHexWithReturn(ctx, 3, key, &keylen);
|
||||
CLIParserFree(ctx);
|
||||
|
@ -662,11 +662,11 @@ static int CmdHFMFPRdbl(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
bool verbose = arg_get_lit(1);
|
||||
int blocksCount = arg_get_int_def(2, 1);
|
||||
bool keyB = arg_get_lit(3);
|
||||
int plain = arg_get_lit(4);
|
||||
uint32_t blockn = arg_get_int(5);
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
int blocksCount = arg_get_int_def(ctx, 2, 1);
|
||||
bool keyB = arg_get_lit(ctx, 3);
|
||||
int plain = arg_get_lit(ctx, 4);
|
||||
uint32_t blockn = arg_get_int(ctx, 5);
|
||||
CLIGetHexWithReturn(ctx, 6, key, &keylen);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
@ -774,10 +774,10 @@ static int CmdHFMFPRdsc(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
bool verbose = arg_get_lit(1);
|
||||
bool keyB = arg_get_lit(2);
|
||||
bool plain = arg_get_lit(3);
|
||||
uint32_t sectorNum = arg_get_int(4);
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
bool keyB = arg_get_lit(ctx, 2);
|
||||
bool plain = arg_get_lit(ctx, 3);
|
||||
uint32_t sectorNum = arg_get_int(ctx, 4);
|
||||
CLIGetHexWithReturn(ctx, 5, key, &keylen);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
@ -873,9 +873,9 @@ static int CmdHFMFPWrbl(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
bool verbose = arg_get_lit(1);
|
||||
bool keyB = arg_get_lit(2);
|
||||
uint32_t blockNum = arg_get_int(3);
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
bool keyB = arg_get_lit(ctx, 2);
|
||||
uint32_t blockNum = arg_get_int(ctx, 3);
|
||||
CLIGetHexWithReturn(ctx, 4, datain, &datainlen);
|
||||
CLIGetHexWithReturn(ctx, 5, key, &keylen);
|
||||
CLIParserFree(ctx);
|
||||
|
@ -1081,10 +1081,10 @@ static int CmdHFMFPChk(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool keyA = arg_get_lit(1);
|
||||
bool keyB = arg_get_lit(2);
|
||||
uint8_t startSector = arg_get_int_def(3, 0);
|
||||
uint8_t endSector = arg_get_int_def(4, 0);
|
||||
bool keyA = arg_get_lit(ctx, 1);
|
||||
bool keyB = arg_get_lit(ctx, 2);
|
||||
uint8_t startSector = arg_get_int_def(ctx, 3, 0);
|
||||
uint8_t endSector = arg_get_int_def(ctx, 4, 0);
|
||||
|
||||
uint8_t vkey[16] = {0};
|
||||
int vkeylen = 0;
|
||||
|
@ -1102,14 +1102,14 @@ static int CmdHFMFPChk(const char *Cmd) {
|
|||
|
||||
uint8_t dict_filename[FILE_PATH_SIZE + 2] = {0};
|
||||
int dict_filenamelen = 0;
|
||||
if (CLIParamStrToBuf(arg_get_str(6), dict_filename, FILE_PATH_SIZE, &dict_filenamelen)) {
|
||||
if (CLIParamStrToBuf(arg_get_str(ctx, 6), dict_filename, FILE_PATH_SIZE, &dict_filenamelen)) {
|
||||
PrintAndLogEx(FAILED, "File name too long or invalid.");
|
||||
CLIParserFree(ctx);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
bool pattern1b = arg_get_lit(7);
|
||||
bool pattern2b = arg_get_lit(8);
|
||||
bool pattern1b = arg_get_lit(ctx, 7);
|
||||
bool pattern2b = arg_get_lit(ctx, 8);
|
||||
|
||||
if (pattern1b && pattern2b) {
|
||||
PrintAndLogEx(ERR, "Pattern search mode must be 2-byte or 1-byte only.");
|
||||
|
@ -1141,14 +1141,14 @@ static int CmdHFMFPChk(const char *Cmd) {
|
|||
|
||||
uint8_t jsonname[250] = {0};
|
||||
int jsonnamelen = 0;
|
||||
if (CLIParamStrToBuf(arg_get_str(10), jsonname, sizeof(jsonname), &jsonnamelen)) {
|
||||
if (CLIParamStrToBuf(arg_get_str(ctx, 10), jsonname, sizeof(jsonname), &jsonnamelen)) {
|
||||
PrintAndLogEx(ERR, "Invalid json name.");
|
||||
CLIParserFree(ctx);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
jsonname[jsonnamelen] = 0;
|
||||
|
||||
bool verbose = arg_get_lit(11);
|
||||
bool verbose = arg_get_lit(ctx, 11);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
@ -1302,15 +1302,15 @@ static int CmdHFMFPMAD(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool verbose = arg_get_lit(1);
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
uint8_t aid[2] = {0};
|
||||
int aidlen;
|
||||
CLIGetHexWithReturn(ctx, 2, aid, &aidlen);
|
||||
uint8_t key[16] = {0};
|
||||
int keylen;
|
||||
CLIGetHexWithReturn(ctx, 3, key, &keylen);
|
||||
bool keyB = arg_get_lit(4);
|
||||
bool swapmad = arg_get_lit(5);
|
||||
bool keyB = arg_get_lit(ctx, 4);
|
||||
bool swapmad = arg_get_lit(ctx, 5);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
@ -1403,15 +1403,15 @@ static int CmdHFMFPNDEF(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool verbose = arg_get_lit(1);
|
||||
bool verbose2 = arg_get_lit(1) > 1;
|
||||
bool verbose = arg_get_lit(ctx, 1);
|
||||
bool verbose2 = arg_get_lit(ctx, 1) > 1;
|
||||
uint8_t aid[2] = {0};
|
||||
int aidlen;
|
||||
CLIGetHexWithReturn(ctx, 2, aid, &aidlen);
|
||||
uint8_t key[16] = {0};
|
||||
int keylen;
|
||||
CLIGetHexWithReturn(ctx, 3, key, &keylen);
|
||||
bool keyB = arg_get_lit(4);
|
||||
bool keyB = arg_get_lit(ctx, 4);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
|
|
@ -2911,7 +2911,7 @@ static int CmdHF14MfuNDEF(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
CLIGetHexWithReturn(ctx, 1, key, &keylen);
|
||||
swapEndian = arg_get_lit(2);
|
||||
swapEndian = arg_get_lit(ctx, 2);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
switch (keylen) {
|
||||
|
|
|
@ -581,22 +581,22 @@ static int CmdIndalaClone(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
is_long_uid = arg_get_lit(1);
|
||||
is_long_uid = arg_get_lit(ctx, 1);
|
||||
|
||||
// raw param
|
||||
CLIGetHexWithReturn(ctx, 3, data, &datalen);
|
||||
|
||||
is_t5555 = arg_get_lit(4);
|
||||
is_t5555 = arg_get_lit(ctx, 4);
|
||||
|
||||
if (is_long_uid == false) {
|
||||
|
||||
// Heden param
|
||||
cardnumber = arg_get_int_def(2, -1);
|
||||
cardnumber = arg_get_int_def(ctx, 2, -1);
|
||||
got_cn = (cardnumber != -1);
|
||||
|
||||
// 26b FC/CN param
|
||||
fc = arg_get_int_def(5, 0);
|
||||
cn = arg_get_int_def(6, 0);
|
||||
fc = arg_get_int_def(ctx, 5, 0);
|
||||
cn = arg_get_int_def(ctx, 6, 0);
|
||||
got_26 = (fc != 0 && cn != 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -85,12 +85,12 @@ static int CmdEMVSelect(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool activateField = arg_get_lit(1);
|
||||
bool leaveSignalON = arg_get_lit(2);
|
||||
bool APDULogging = arg_get_lit(3);
|
||||
bool decodeTLV = arg_get_lit(4);
|
||||
bool activateField = arg_get_lit(ctx, 1);
|
||||
bool leaveSignalON = arg_get_lit(ctx, 2);
|
||||
bool APDULogging = arg_get_lit(ctx, 3);
|
||||
bool decodeTLV = arg_get_lit(ctx, 4);
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(5))
|
||||
if (arg_get_lit(ctx, 5))
|
||||
channel = ECC_CONTACT;
|
||||
PrintChannel(channel);
|
||||
CLIGetHexWithReturn(ctx, 6, data, &datalen);
|
||||
|
@ -134,12 +134,12 @@ static int CmdEMVSearch(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool activateField = arg_get_lit(1);
|
||||
bool leaveSignalON = arg_get_lit(2);
|
||||
bool APDULogging = arg_get_lit(3);
|
||||
bool decodeTLV = arg_get_lit(4);
|
||||
bool activateField = arg_get_lit(ctx, 1);
|
||||
bool leaveSignalON = arg_get_lit(ctx, 2);
|
||||
bool APDULogging = arg_get_lit(ctx, 3);
|
||||
bool decodeTLV = arg_get_lit(ctx, 4);
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(5))
|
||||
if (arg_get_lit(ctx, 5))
|
||||
channel = ECC_CONTACT;
|
||||
PrintChannel(channel);
|
||||
CLIParserFree(ctx);
|
||||
|
@ -186,17 +186,17 @@ static int CmdEMVPPSE(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool activateField = arg_get_lit(1);
|
||||
bool leaveSignalON = arg_get_lit(2);
|
||||
bool activateField = arg_get_lit(ctx, 1);
|
||||
bool leaveSignalON = arg_get_lit(ctx, 2);
|
||||
uint8_t PSENum = 2;
|
||||
if (arg_get_lit(3))
|
||||
if (arg_get_lit(ctx, 3))
|
||||
PSENum = 1;
|
||||
if (arg_get_lit(4))
|
||||
if (arg_get_lit(ctx, 4))
|
||||
PSENum = 2;
|
||||
bool APDULogging = arg_get_lit(5);
|
||||
bool decodeTLV = arg_get_lit(6);
|
||||
bool APDULogging = arg_get_lit(ctx, 5);
|
||||
bool decodeTLV = arg_get_lit(ctx, 6);
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(7))
|
||||
if (arg_get_lit(ctx, 7))
|
||||
channel = ECC_CONTACT;
|
||||
PrintChannel(channel);
|
||||
CLIParserFree(ctx);
|
||||
|
@ -245,13 +245,13 @@ static int CmdEMVGPO(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool leaveSignalON = arg_get_lit(1);
|
||||
bool paramsLoadFromFile = arg_get_lit(2);
|
||||
bool dataMakeFromPDOL = arg_get_lit(3);
|
||||
bool APDULogging = arg_get_lit(4);
|
||||
bool decodeTLV = arg_get_lit(5);
|
||||
bool leaveSignalON = arg_get_lit(ctx, 1);
|
||||
bool paramsLoadFromFile = arg_get_lit(ctx, 2);
|
||||
bool dataMakeFromPDOL = arg_get_lit(ctx, 3);
|
||||
bool APDULogging = arg_get_lit(ctx, 4);
|
||||
bool decodeTLV = arg_get_lit(ctx, 5);
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(6))
|
||||
if (arg_get_lit(ctx, 6))
|
||||
channel = ECC_CONTACT;
|
||||
PrintChannel(channel);
|
||||
CLIGetHexWithReturn(ctx, 7, data, &datalen);
|
||||
|
@ -350,11 +350,11 @@ static int CmdEMVReadRecord(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool leaveSignalON = arg_get_lit(1);
|
||||
bool APDULogging = arg_get_lit(2);
|
||||
bool decodeTLV = arg_get_lit(3);
|
||||
bool leaveSignalON = arg_get_lit(ctx, 1);
|
||||
bool APDULogging = arg_get_lit(ctx, 2);
|
||||
bool decodeTLV = arg_get_lit(ctx, 3);
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(4))
|
||||
if (arg_get_lit(ctx, 4))
|
||||
channel = ECC_CONTACT;
|
||||
PrintChannel(channel);
|
||||
CLIGetHexWithReturn(ctx, 5, data, &datalen);
|
||||
|
@ -413,19 +413,19 @@ static int CmdEMVAC(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
bool leaveSignalON = arg_get_lit(1);
|
||||
bool trTypeCDA = arg_get_lit(2);
|
||||
bool leaveSignalON = arg_get_lit(ctx, 1);
|
||||
bool trTypeCDA = arg_get_lit(ctx, 2);
|
||||
uint8_t termDecision = 0xff;
|
||||
if (arg_get_str_len(3)) {
|
||||
if (!strncmp(arg_get_str(3)->sval[0], "aac", 4))
|
||||
if (arg_get_str_len(ctx, 3)) {
|
||||
if (!strncmp(arg_get_str(ctx, 3)->sval[0], "aac", 4))
|
||||
termDecision = EMVAC_AAC;
|
||||
if (!strncmp(arg_get_str(3)->sval[0], "tc", 4))
|
||||
if (!strncmp(arg_get_str(ctx, 3)->sval[0], "tc", 4))
|
||||
termDecision = EMVAC_TC;
|
||||
if (!strncmp(arg_get_str(3)->sval[0], "arqc", 4))
|
||||
if (!strncmp(arg_get_str(ctx, 3)->sval[0], "arqc", 4))
|
||||
termDecision = EMVAC_ARQC;
|
||||
|
||||
if (termDecision == 0xff) {
|
||||
PrintAndLogEx(ERR, "ERROR: can't find terminal decision '%s'", arg_get_str(3)->sval[0]);
|
||||
PrintAndLogEx(ERR, "ERROR: can't find terminal decision '%s'", arg_get_str(ctx, 3)->sval[0]);
|
||||
CLIParserFree(ctx);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
@ -434,13 +434,13 @@ static int CmdEMVAC(const char *Cmd) {
|
|||
}
|
||||
if (trTypeCDA)
|
||||
termDecision = termDecision | EMVAC_CDAREQ;
|
||||
bool paramsLoadFromFile = arg_get_lit(4);
|
||||
bool dataMakeFromCDOL = arg_get_lit(5);
|
||||
bool APDULogging = arg_get_lit(6);
|
||||
bool decodeTLV = arg_get_lit(7);
|
||||
bool paramsLoadFromFile = arg_get_lit(ctx, 4);
|
||||
bool dataMakeFromCDOL = arg_get_lit(ctx, 5);
|
||||
bool APDULogging = arg_get_lit(ctx, 6);
|
||||
bool decodeTLV = arg_get_lit(ctx, 7);
|
||||
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(8))
|
||||
if (arg_get_lit(ctx, 8))
|
||||
channel = ECC_CONTACT;
|
||||
|
||||
PrintChannel(channel);
|
||||
|
@ -527,10 +527,10 @@ static int CmdEMVGenerateChallenge(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool leaveSignalON = arg_get_lit(1);
|
||||
bool APDULogging = arg_get_lit(2);
|
||||
bool leaveSignalON = arg_get_lit(ctx, 1);
|
||||
bool APDULogging = arg_get_lit(ctx, 2);
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(3))
|
||||
if (arg_get_lit(ctx, 3))
|
||||
channel = ECC_CONTACT;
|
||||
PrintChannel(channel);
|
||||
CLIParserFree(ctx);
|
||||
|
@ -584,13 +584,13 @@ static int CmdEMVInternalAuthenticate(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
bool leaveSignalON = arg_get_lit(1);
|
||||
bool paramsLoadFromFile = arg_get_lit(2);
|
||||
bool dataMakeFromDDOL = arg_get_lit(3);
|
||||
bool APDULogging = arg_get_lit(4);
|
||||
bool decodeTLV = arg_get_lit(5);
|
||||
bool leaveSignalON = arg_get_lit(ctx, 1);
|
||||
bool paramsLoadFromFile = arg_get_lit(ctx, 2);
|
||||
bool dataMakeFromDDOL = arg_get_lit(ctx, 3);
|
||||
bool APDULogging = arg_get_lit(ctx, 4);
|
||||
bool decodeTLV = arg_get_lit(ctx, 5);
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(6))
|
||||
if (arg_get_lit(ctx, 6))
|
||||
channel = ECC_CONTACT;
|
||||
PrintChannel(channel);
|
||||
CLIGetHexWithReturn(ctx, 7, data, &datalen);
|
||||
|
@ -816,23 +816,23 @@ static int CmdEMVExec(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool activateField = arg_get_lit(1);
|
||||
bool showAPDU = arg_get_lit(2);
|
||||
bool decodeTLV = arg_get_lit(3);
|
||||
bool paramLoadJSON = arg_get_lit(4);
|
||||
bool forceSearch = arg_get_lit(5);
|
||||
bool activateField = arg_get_lit(ctx, 1);
|
||||
bool showAPDU = arg_get_lit(ctx, 2);
|
||||
bool decodeTLV = arg_get_lit(ctx, 3);
|
||||
bool paramLoadJSON = arg_get_lit(ctx, 4);
|
||||
bool forceSearch = arg_get_lit(ctx, 5);
|
||||
|
||||
enum TransactionType TrType = TT_MSD;
|
||||
if (arg_get_lit(7))
|
||||
if (arg_get_lit(ctx, 7))
|
||||
TrType = TT_QVSDCMCHIP;
|
||||
if (arg_get_lit(8))
|
||||
if (arg_get_lit(ctx, 8))
|
||||
TrType = TT_CDA;
|
||||
if (arg_get_lit(9))
|
||||
if (arg_get_lit(ctx, 9))
|
||||
TrType = TT_VSDC;
|
||||
|
||||
bool GenACGPO = arg_get_lit(10);
|
||||
bool GenACGPO = arg_get_lit(ctx, 10);
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(11))
|
||||
if (arg_get_lit(ctx, 11))
|
||||
channel = ECC_CONTACT;
|
||||
PrintChannel(channel);
|
||||
uint8_t psenum = (channel == ECC_CONTACT) ? 1 : 2;
|
||||
|
@ -1411,23 +1411,23 @@ static int CmdEMVScan(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool showAPDU = arg_get_lit(1);
|
||||
bool decodeTLV = arg_get_lit(2);
|
||||
bool extractTLVElements = arg_get_lit(3);
|
||||
bool paramLoadJSON = arg_get_lit(4);
|
||||
bool showAPDU = arg_get_lit(ctx, 1);
|
||||
bool decodeTLV = arg_get_lit(ctx, 2);
|
||||
bool extractTLVElements = arg_get_lit(ctx, 3);
|
||||
bool paramLoadJSON = arg_get_lit(ctx, 4);
|
||||
|
||||
enum TransactionType TrType = TT_MSD;
|
||||
if (arg_get_lit(6))
|
||||
if (arg_get_lit(ctx, 6))
|
||||
TrType = TT_QVSDCMCHIP;
|
||||
if (arg_get_lit(7))
|
||||
if (arg_get_lit(ctx, 7))
|
||||
TrType = TT_CDA;
|
||||
if (arg_get_lit(8))
|
||||
if (arg_get_lit(ctx, 8))
|
||||
TrType = TT_VSDC;
|
||||
|
||||
bool GenACGPO = arg_get_lit(9);
|
||||
bool MergeJSON = arg_get_lit(10);
|
||||
bool GenACGPO = arg_get_lit(ctx, 9);
|
||||
bool MergeJSON = arg_get_lit(ctx, 10);
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(11))
|
||||
if (arg_get_lit(ctx, 11))
|
||||
channel = ECC_CONTACT;
|
||||
PrintChannel(channel);
|
||||
uint8_t psenum = (channel == ECC_CONTACT) ? 1 : 2;
|
||||
|
@ -1777,8 +1777,8 @@ static int CmdEMVTest(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
bool ignoreTimeTest = arg_get_lit(1);
|
||||
bool runSlowTests = arg_get_lit(2);
|
||||
bool ignoreTimeTest = arg_get_lit(ctx, 1);
|
||||
bool runSlowTests = arg_get_lit(ctx, 2);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
return ExecuteCryptoTests(true, ignoreTimeTest, runSlowTests);
|
||||
|
@ -1811,15 +1811,15 @@ static int CmdEMVRoca(const char *Cmd) {
|
|||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
if (arg_get_lit(1)) {
|
||||
if (arg_get_lit(ctx, 1)) {
|
||||
CLIParserFree(ctx);
|
||||
return roca_self_test();
|
||||
}
|
||||
|
||||
bool show_apdu = arg_get_lit(2);
|
||||
bool show_apdu = arg_get_lit(ctx, 2);
|
||||
|
||||
EMVCommandChannel channel = ECC_CONTACTLESS;
|
||||
if (arg_get_lit(3))
|
||||
if (arg_get_lit(ctx, 3))
|
||||
channel = ECC_CONTACT;
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue