From d8294a958b0a801e90d6cd85f390762a191642db Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 20 Oct 2020 17:36:01 +0200 Subject: [PATCH] hf 14a antifuzz - now uses NG --- armsrc/appmain.c | 6 +++++- armsrc/iso14443a.c | 2 +- client/src/cmdhf14a.c | 18 +++++++++++------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 5399b326a..f5eacc363 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -1259,7 +1259,11 @@ static void PacketReceived(PacketCommandNG *packet) { break; } case CMD_HF_ISO14443A_ANTIFUZZ: { - iso14443a_antifuzz(packet->oldarg[0]); + struct p { + uint8_t flag; + } PACKED; + struct p *payload = (struct p *) packet->data.asBytes; + iso14443a_antifuzz(payload->flag); break; } case CMD_HF_EPA_COLLECT_NONCE: { diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c index 6e1e22738..cf0bce153 100644 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@ -2390,7 +2390,7 @@ void iso14443a_antifuzz(uint32_t flags) { } } - reply_old(CMD_ACK, 1, 0, 0, 0, 0); + reply_ng(CMD_HF_ISO14443A_ANTIFUZZ, PM3_SUCCESS, NULL, 0); switch_off(); BigBuf_free_keep_EM(); } diff --git a/client/src/cmdhf14a.c b/client/src/cmdhf14a.c index dac2193c6..00b7d9484 100644 --- a/client/src/cmdhf14a.c +++ b/client/src/cmdhf14a.c @@ -1338,7 +1338,7 @@ static int CmdHF14ACmdRaw(const char *Cmd) { if (!res && datalen > 0) waitCmd(0, timeout); } - return 0; + return PM3_SUCCESS; } static int waitCmd(uint8_t iSelect, uint32_t timeout) { @@ -1398,16 +1398,20 @@ static int CmdHF14AAntiFuzz(const char *Cmd) { }; CLIExecWithReturn(ctx, Cmd, argtable, false); - uint8_t arg0 = FLAG_4B_UID_IN_DATA; + struct { + uint8_t flag; + } PACKED param; + param.flag = FLAG_4B_UID_IN_DATA; + if (arg_get_lit(ctx, 2)) - arg0 = FLAG_7B_UID_IN_DATA; + param.flag = FLAG_7B_UID_IN_DATA; if (arg_get_lit(ctx, 3)) - arg0 = FLAG_10B_UID_IN_DATA; + param.flag = FLAG_10B_UID_IN_DATA; CLIParserFree(ctx); clearCommandBuffer(); - SendCommandMIX(CMD_HF_ISO14443A_ANTIFUZZ, arg0, 0, 0, NULL, 0); - return 0; + SendCommandNG(CMD_HF_ISO14443A_ANTIFUZZ, (uint8_t*)¶m, sizeof(param)); + return PM3_SUCCESS; } static int CmdHF14AChaining(const char *Cmd) { @@ -1438,7 +1442,7 @@ static int CmdHF14AChaining(const char *Cmd) { PrintAndLogEx(INFO, "\nISO 14443-4 input chaining %s.\n", APDUInFramingEnable ? "enabled" : "disabled"); - return 0; + return PM3_SUCCESS; } static void printTag(const char *tag) {