diff --git a/CHANGELOG.md b/CHANGELOG.md index e1e2b5994..73dcf3e25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] -- Changed `hf iclass wrbl` - replay behavior to use privilege escalation instead of having to generate specific block/content macs(@antiklesys) +- Changed `hf iclass wrbl` - replay behavior to use privilege escalation if the macs field is not passed empty(@antiklesys) - Changed `hf iclass restore` - it now supports privilege escalation to restore card content using replay (@antiklesys) - Fixed `hf 15 dump` - now reads sysinfo response correct (@iceman1001) - Changed `make clean` - it now removes all __pycache__ folders (@iceman1001) diff --git a/armsrc/iclass.c b/armsrc/iclass.c index 191d0194f..522dfdfe9 100644 --- a/armsrc/iclass.c +++ b/armsrc/iclass.c @@ -1938,6 +1938,9 @@ void iClass_WriteBlock(uint8_t *msg) { write_len -= 2; } else { + if (payload->req.use_replay && sizeof(payload->mac) > 0) { + memcpy(write + 10, payload->mac, sizeof(payload->mac)); + } else { // Secure tags uses MAC uint8_t wb[9]; wb[0] = payload->req.blockno; @@ -1954,8 +1957,9 @@ void iClass_WriteBlock(uint8_t *msg) { }else{ doMAC_N(wb, sizeof(wb), hdr.key_d, mac); } - memcpy(write + 10, mac, sizeof(mac)); + memcpy(write + 10, mac, sizeof(mac)); + } } start_time = eof_time + DELAY_ICLASS_VICC_TO_VCD_READER; diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 584edf662..f305c33e5 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -2329,7 +2329,7 @@ static int CmdHFiClass_WriteBlock(const char *Cmd) { arg_lit0(NULL, "credit", "key is assumed to be the credit key"), arg_lit0(NULL, "elite", "elite computations applied to key"), arg_lit0(NULL, "raw", "no computations applied to key"), - arg_lit0(NULL, "nr", "replay of NR/MAC using privilege escalation"), + arg_lit0(NULL, "nr", "replay of NR/MAC block write or use privilege escalation if mac is empty"), arg_lit0("v", "verbose", "verbose output"), arg_lit0(NULL, "shallow", "use shallow (ASK) reader modulation instead of OOK"), arg_param_end