From 93c99e9f7a2e63538cd07568a650649bc8eff765 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 9 Jan 2021 22:47:04 +0100 Subject: [PATCH] lf hid clone - wip take binary string as input --- client/src/cmdlfhid.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/src/cmdlfhid.c b/client/src/cmdlfhid.c index 108550539..46a8febbe 100644 --- a/client/src/cmdlfhid.c +++ b/client/src/cmdlfhid.c @@ -344,6 +344,7 @@ static int CmdHIDClone(const char *Cmd) { arg_strx0("r", "raw", "", "raw bytes"), arg_lit0(NULL, "q5", "optional - specify writing to Q5/T5555 tag"), arg_lit0(NULL, "em", "optional - specify writing to EM4305/4469 tag"), + arg_str0(NULL, "bin", "", "Binary string i.e 0001001001"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -365,6 +366,12 @@ static int CmdHIDClone(const char *Cmd) { bool q5 = arg_get_lit(ctx, 7); bool em = arg_get_lit(ctx, 8); + + + int bin_len = 63; + uint8_t bin[70] = {0}; + CLIGetStrWithReturn(ctx, 9, bin, &bin_len); + CLIParserFree(ctx); if (q5 && em) { @@ -372,6 +379,11 @@ static int CmdHIDClone(const char *Cmd) { return PM3_EINVARG; } + if (bin_len > 127) { + PrintAndLogEx(ERR, "Binary wiegand string must be less than 128 bits"); + return PM3_EINVARG; + } + wiegand_message_t packed; memset(&packed, 0, sizeof(wiegand_message_t));