From c32f655023d63565597d1c14dcfd540ac4e30583 Mon Sep 17 00:00:00 2001 From: Antiklesys Date: Fri, 30 May 2025 13:00:35 +0800 Subject: [PATCH] Improved hf iclass tear erase phase readability Improved readability of erase phase during iclass tear (client and arm side). It is redundant to see a list of FF during the erase phase (which can be pretty lengthy), so it will only show it once when all bits are FF and then will resume printing the moment bits start changing again post erase phase. --- armsrc/iclass.c | 10 ++++++---- client/src/cmdhficlass.c | 9 ++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/armsrc/iclass.c b/armsrc/iclass.c index bcf5df684..4b6097712 100644 --- a/armsrc/iclass.c +++ b/armsrc/iclass.c @@ -2311,11 +2311,13 @@ void iClass_TearBlock(iclass_tearblock_req_t *msg) { if (memcmp(data_read, ff_data, PICOPASS_BLOCK_SIZE) == 0 && memcmp(data_read_orig, ff_data, PICOPASS_BLOCK_SIZE) != 0) { - erase_phase = true; - DbpString(""); - DbpString(_CYAN_("Erase phase hit... ALL ONES")); + if(erase_phase == false){ + DbpString(""); + DbpString(_CYAN_("Erase phase hit... ALL ONES")); - iclass_cmp_print(data_read_orig, data_read, "Original: ", "Read: "); + iclass_cmp_print(data_read_orig, data_read, "Original: ", "Read: "); + } + erase_phase = true; } else { diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index b127cb5bf..a60df6ebb 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -3340,10 +3340,13 @@ static int CmdHFiClass_TearBlock(const char *Cmd) { if (memcmp(data_read, ff_data, 8) == 0 && memcmp(data_read_orig, ff_data, 8) != 0) { + + if (erase_phase == false){ + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(SUCCESS, _CYAN_("Erase phase hit... ALL ONES")); + iclass_cmp_print(data_read_orig, data_read, "Original: ", "Read: "); + } erase_phase = true; - PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(SUCCESS, _CYAN_("Erase phase hit... ALL ONES")); - iclass_cmp_print(data_read_orig, data_read, "Original: ", "Read: "); } else { if (erase_phase) {