mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 18:48:13 -07:00
fix: 'hf iclass clone' - last block write fails, see (https://github.com/RfidResearchGroup/proxmark3/issues/183)
chg: 'hf iclass clone' - now tries ten times, behavies better, obey verbose nicer, drop field constant. Uses NG. chg: 'hf iclass dump' - now tries ten times, in general nice outputs..
This commit is contained in:
parent
d8217a13d9
commit
9a2a0116e4
3 changed files with 145 additions and 87 deletions
|
@ -2520,23 +2520,19 @@ void iClass_Clone(uint8_t startblock, uint8_t endblock, uint8_t *data) {
|
|||
int total_block = (endblock - startblock) + 1;
|
||||
for (i = 0; i < total_block; i++) {
|
||||
// block number
|
||||
if (iClass_WriteBlock_ext(i + startblock, data + (i * 12))) {
|
||||
Dbprintf("Write block [%02x] successful", i + startblock);
|
||||
if (iClass_WriteBlock_ext(startblock + i, data + (i * 12))) {
|
||||
Dbprintf("Write block [%02x] successful", startblock + i);
|
||||
written++;
|
||||
} else {
|
||||
if (iClass_WriteBlock_ext(i + startblock, data + (i * 12))) {
|
||||
Dbprintf("Write block [%02x] successful", i + startblock);
|
||||
written++;
|
||||
} else {
|
||||
Dbprintf("Write block [%02x] failed", i + startblock);
|
||||
}
|
||||
Dbprintf("Write block [%02x] failed", startblock + i);
|
||||
}
|
||||
}
|
||||
if (written == total_block)
|
||||
DbpString("Clone complete");
|
||||
else
|
||||
DbpString("Clone incomplete");
|
||||
|
||||
reply_mix(CMD_ACK, 1, 0, 0, 0, 0);
|
||||
|
||||
switch_off();
|
||||
|
||||
uint8_t isOK = 0;
|
||||
if (written == total_block)
|
||||
isOK = 1;
|
||||
|
||||
reply_ng(CMD_HF_ICLASS_CLONE, PM3_SUCCESS, (uint8_t *)&isOK, sizeof(uint8_t));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue