Fix broken older functionality

Updated to still maintain older functionality when the macs field is passed
This commit is contained in:
Antiklesys 2025-07-05 19:26:22 +08:00
parent 7ad3f6eaf2
commit 33c3988a94
3 changed files with 7 additions and 3 deletions

View file

@ -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... 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] ## [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) - 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) - Fixed `hf 15 dump` - now reads sysinfo response correct (@iceman1001)
- Changed `make clean` - it now removes all __pycache__ folders (@iceman1001) - Changed `make clean` - it now removes all __pycache__ folders (@iceman1001)

View file

@ -1938,6 +1938,9 @@ void iClass_WriteBlock(uint8_t *msg) {
write_len -= 2; write_len -= 2;
} else { } else {
if (payload->req.use_replay && sizeof(payload->mac) > 0) {
memcpy(write + 10, payload->mac, sizeof(payload->mac));
} else {
// Secure tags uses MAC // Secure tags uses MAC
uint8_t wb[9]; uint8_t wb[9];
wb[0] = payload->req.blockno; wb[0] = payload->req.blockno;
@ -1954,8 +1957,9 @@ void iClass_WriteBlock(uint8_t *msg) {
}else{ }else{
doMAC_N(wb, sizeof(wb), hdr.key_d, mac); 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; start_time = eof_time + DELAY_ICLASS_VICC_TO_VCD_READER;

View file

@ -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, "credit", "key is assumed to be the credit key"),
arg_lit0(NULL, "elite", "elite computations applied to key"), arg_lit0(NULL, "elite", "elite computations applied to key"),
arg_lit0(NULL, "raw", "no 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("v", "verbose", "verbose output"),
arg_lit0(NULL, "shallow", "use shallow (ASK) reader modulation instead of OOK"), arg_lit0(NULL, "shallow", "use shallow (ASK) reader modulation instead of OOK"),
arg_param_end arg_param_end