From b797c2ff9d765b760a886ba73bb4a8f4d7e475c1 Mon Sep 17 00:00:00 2001 From: Eric Betts Date: Tue, 27 Jul 2021 19:54:55 -0700 Subject: [PATCH] Add format parameter --- client/src/cmdhficlass.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 1b903d3f2..54f0c6039 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -3598,6 +3598,7 @@ static int CmdHFiClassEncode(const char *Cmd) { arg_str0(NULL, "enckey", "", "3DES transport key, 16 hex bytes"), arg_u64_0(NULL, "fc", "", "facility code"), arg_u64_0(NULL, "cn", "", "card number"), + arg_str0("w", "wiegand", "", "see " _YELLOW_("`wiegand list`") " for available formats"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -3638,6 +3639,10 @@ static int CmdHFiClassEncode(const char *Cmd) { card.FacilityCode = arg_get_u32_def(ctx, 7, 0); card.CardNumber = arg_get_u32_def(ctx, 8, 0); + char format[16] = {0}; + int format_len = 0; + CLIParamStrToBuf(arg_get_str(ctx, 9), (uint8_t *)format, sizeof(format), &format_len); + CLIParserFree(ctx); if ((rawkey + elite) > 1) { @@ -3717,8 +3722,9 @@ static int CmdHFiClassEncode(const char *Cmd) { wiegand_message_t packed; memset(&packed, 0, sizeof(wiegand_message_t)); - int format_idx = HIDFindCardFormat("H10301"); + int format_idx = HIDFindCardFormat((char *)format); if (format_idx == -1) { + PrintAndLogEx(WARNING, "Unknown format: " _YELLOW_("%s"), format); return PM3_EINVARG; }