From 8380c02a547d8d71856f43708c6a111ff042c197 Mon Sep 17 00:00:00 2001 From: Antiklesys Date: Fri, 3 Apr 2026 03:22:32 +0800 Subject: [PATCH] Fixed legrec grammar error and checks --- client/src/cmdhficlass.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 944488015..12efaac77 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -6483,7 +6483,7 @@ static int CmdHFiClassLegacyRecover(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf iclass legrec", "Attempts to recover the diversified key of a specific iCLASS card. This may take several days.\n" - "The card must remain be on the PM3 antenna during the whole process.\n" + "The card must remain on the PM3 antenna during the whole process.\n" _RED_(" ! Warning ! ") _WHITE_(" This process may brick the card! ") _RED_(" ! Warning ! "), "hf iclass legrec --macs 0000000089cb984b\n" "hf iclass legrec --macs 0000000089cb984b --index 0 --loop 100 --notest" @@ -6491,7 +6491,7 @@ static int CmdHFiClassLegacyRecover(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str1(NULL, "macs", "", "AA1 Authentication MACs"), + arg_str0(NULL, "macs", "", "AA1 Authentication MACs"), arg_int0(NULL, "index", "", "Where to start from to retrieve the key (def: 0)"), arg_int0(NULL, "loop", "", "The number of key retrieval cycles to perform, max 10000 (def 100)"), arg_lit0(NULL, "debug", "Re-enables tracing for debugging. Limits cycles to 1"), @@ -6525,6 +6525,12 @@ static int CmdHFiClassLegacyRecover(const char *Cmd) { return PM3_SUCCESS; } + if (macs_len == 0) { + PrintAndLogEx(ERR, "Missing required argument: --macs"); + CLIParserFree(ctx); + return PM3_EINVARG; + } + if (no_test) { test = false; }