From c1ed65bc4c808bee7534dc88e434323d5037f330 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 30 Oct 2020 02:12:36 +0100 Subject: [PATCH] added reset state --- client/src/cmdhfmf.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index cc99df4b7..69994fdc4 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -5282,13 +5282,12 @@ static int CmdHf14AMfSuperCard(const char *Cmd) { void *argtable[] = { arg_param_begin, + arg_lit0("r", "reset", "reset card"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); + bool reset_card = arg_get_lit(ctx, 1); CLIParserFree(ctx); -/* - uint8_t reset[] = { 0x02, 0x00, 0xa6, 0xc0, 0x00 }; -*/ bool activate_field = true; bool keep_field_on = true; @@ -5379,6 +5378,22 @@ static int CmdHf14AMfSuperCard(const char *Cmd) { else PrintAndLogEx(FAILED, "failed to recover any key"); + + if (reset_card) { + + activate_field = true; + uint8_t response[6]; + int resplen = 0; + + // --------------- RESET CARD ---------------- + uint8_t aRESET[] = { 0x00, 0xa6, 0xc0, 0x00 }; + res = ExchangeAPDU14a(aRESET, sizeof(aRESET), activate_field, keep_field_on, response, sizeof(response), &resplen); + if (res) { + DropField(); + return res; + } + } + return PM3_SUCCESS; }