From d465c5a9217711d8a8c6c1bf269ea3f59aa500f8 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 12 Nov 2022 06:32:08 +0100 Subject: [PATCH] a test thingy --- client/src/cmdhficlass.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 5757fcadd..fa118ff52 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -1607,6 +1607,7 @@ static int CmdHFiClassDump(const char *Cmd) { arg_lit0(NULL, "raw", "raw, the key is interpreted as raw block 3/4"), arg_lit0(NULL, "nr", "replay of NR/MAC"), arg_lit0("z", "dense", "dense dump output style"), + arg_lit0(NULL, "force", "force unsecure card read"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -1691,6 +1692,7 @@ static int CmdHFiClassDump(const char *Cmd) { bool rawkey = arg_get_lit(ctx, 7); bool use_replay = arg_get_lit(ctx, 8); bool dense_output = g_session.dense_output || arg_get_lit(ctx, 9); + bool force = arg_get_lit(ctx, 10); CLIParserFree(ctx); @@ -1757,6 +1759,12 @@ static int CmdHFiClassDump(const char *Cmd) { } } + // + if (force) { + pagemap |= PICOPASS_NON_SECURE_PAGEMODE; + PrintAndLogEx(INFO, "Forcing NON SECURE PAGE dumping"); + } + if (pagemap == PICOPASS_NON_SECURE_PAGEMODE) { PrintAndLogEx(INFO, "Dumping all available memory, block 3 - %u (0x%02x)", app_limit1, app_limit1); if (auth) { @@ -3773,7 +3781,7 @@ static int CmdHFiClassEncode(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf iclass encode", - "Encode binary wiegand to block 7\n" + "Encode binary wiegand to block 7,8,9\n" "Use either --bin or --wiegand/--fc/--cn", "hf iclass encode --bin 10001111100000001010100011 --ki 0 -> FC 31 CN 337\n" "hf iclass encode --fc 31 --cn 337 --ki 0 -> FC 31 CN 337\n" @@ -3925,8 +3933,12 @@ static int CmdHFiClassEncode(const char *Cmd) { return PM3_ESOFT; } + // iceman: only for formats w length smaller than 37. + // Needs a check. + + // increase length to allow setting bit just above real data + packed.Length++; // Set sentinel bit - packed.Length++;// increase length to allow setting bit just above real data set_bit_by_position(&packed, true, 0); #ifdef HOST_LITTLE_ENDIAN @@ -3958,7 +3970,7 @@ static int CmdHFiClassEncode(const char *Cmd) { PrintAndLogEx(SUCCESS, "Write block %d/0x0%x ( " _GREEN_("ok") " ) --> " _YELLOW_("%s"), 6 + i, 6 + i, sprint_hex_inrow(credential + (i * 8), 8)); break; default: - PrintAndLogEx(SUCCESS, "Write block %d/0x0%x ( " _RED_("fail") " )", 6 + i, 6 + i); + PrintAndLogEx(INFO, "Write block %d/0x0%x ( " _RED_("fail") " )", 6 + i, 6 + i); break; } }