diff --git a/armsrc/iclass.c b/armsrc/iclass.c index 3837d6931..3eb9df188 100644 --- a/armsrc/iclass.c +++ b/armsrc/iclass.c @@ -1941,24 +1941,24 @@ void iClass_WriteBlock(uint8_t *msg) { if (payload->req.use_replay && (memcmp(payload->mac, "\x00\x00\x00\x00", 4) != 0)) { memcpy(write + 10, payload->mac, sizeof(payload->mac)); } else { - // Secure tags uses MAC - uint8_t wb[9]; - wb[0] = payload->req.blockno; - memcpy(wb + 1, payload->data, PICOPASS_BLOCK_SIZE); + // Secure tags uses MAC + uint8_t wb[9]; + wb[0] = payload->req.blockno; + memcpy(wb + 1, payload->data, PICOPASS_BLOCK_SIZE); - if (payload->req.use_credit_key){ - doMAC_N(wb, sizeof(wb), hdr.key_c, mac); - } else if (payload->req.use_replay) { - priv_esc = do_privilege_escalation(read_check_cc, sizeof(read_check_cc), &eof_time); - if (priv_esc == false) { - goto out; + if (payload->req.use_credit_key) { + doMAC_N(wb, sizeof(wb), hdr.key_c, mac); + } else if (payload->req.use_replay) { + priv_esc = do_privilege_escalation(read_check_cc, sizeof(read_check_cc), &eof_time); + if (priv_esc == false) { + goto out; + } + doMAC_N(wb, sizeof(wb), div_cc, mac); + } else { + doMAC_N(wb, sizeof(wb), hdr.key_d, mac); } - doMAC_N(wb, sizeof(wb), div_cc, mac); - }else{ - doMAC_N(wb, sizeof(wb), hdr.key_d, mac); - } - memcpy(write + 10, mac, sizeof(mac)); + memcpy(write + 10, mac, sizeof(mac)); } } diff --git a/client/src/flash.c b/client/src/flash.c index 1672a4497..25edb7c0f 100644 --- a/client/src/flash.c +++ b/client/src/flash.c @@ -698,8 +698,13 @@ int flash_write(flash_file_t *ctx) { PrintAndLogEx(SUCCESS, " 0x%08x..0x%08x [0x%x / %u blocks]", seg->start, end - 1, length, blocks); if (is_loaded) { - fprintf(stdout, "\n\n"); + if (blocks < 50) { + PrintAndLogEx(SUCCESS, "" NOLF); + } else { + fprintf(stdout, "\n\n"); + } } + fflush(stdout); int block = 0; uint8_t *data = seg->data; @@ -721,6 +726,15 @@ int flash_write(flash_file_t *ctx) { length -= block_size; block++; + // small files, like bootrom + if (blocks < 50) { + fprintf(stdout, "."); + len++; + fflush(stdout); + continue; + } + + // large fullimage write if (is_loaded) { if (len < ice3len) { fprintf(stdout, "%c", ice3[len++]); diff --git a/doc/commands.json b/doc/commands.json index 8bc8b21f2..bcc254785 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -3810,7 +3810,7 @@ "--credit key is assumed to be the credit key", "--elite elite computations applied to key", "--raw no computations applied to key", - "--nr replay of NR/MAC", + "--nr replay of NR/MAC block write or use privilege escalation if mac is empty", "-v, --verbose verbose output", "--shallow use shallow (ASK) reader modulation instead of OOK" ], @@ -13377,6 +13377,6 @@ "metadata": { "commands_extracted": 768, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2025-07-04T10:19:21" + "extracted_on": "2025-07-06T18:10:18" } }