This commit is contained in:
iceman1001 2025-06-07 11:50:03 +02:00
commit 6fbb13ba41
3 changed files with 25 additions and 23 deletions

View file

@ -607,13 +607,13 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
trace_data = ff_data;
trace_data_size = sizeof(ff_data);
} else { // use data from emulator memory
if (simulationMode == ICLASS_SIM_MODE_FULL_GLITCH){
if (simulationMode == ICLASS_SIM_MODE_FULL_GLITCH) {
//Jam the read based on the last SIO block
if (memcmp(emulator + (current_page * page_size) + (5 * 8), ff_data, PICOPASS_BLOCK_SIZE) == 0){ //SR card
if (block == 16){ //SR cards use a standard legth SIO
if (memcmp(emulator + (current_page * page_size) + (5 * 8), ff_data, PICOPASS_BLOCK_SIZE) == 0) { //SR card
if (block == 16) { //SR cards use a standard legth SIO
goto send;
}
}else{ //For SE cards we have to account for different SIO lengths depending if a standard or custom key is used
} else { //For SE cards we have to account for different SIO lengths depending if a standard or custom key is used
uint8_t *sio = emulator + (current_page * page_size) + (6 * 8);
if (block == (5 + ((sio[1] + 12) / 8))) {
goto send;
@ -730,7 +730,7 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
chip_state = HALTED;
goto send;
} else if ((simulationMode == ICLASS_SIM_MODE_FULL || simulationMode == ICLASS_SIM_MODE_FULL_GLITCH)&& cmd == ICLASS_CMD_READ4 && len == 4) { // 0x06
} else if ((simulationMode == ICLASS_SIM_MODE_FULL || simulationMode == ICLASS_SIM_MODE_FULL_GLITCH) && cmd == ICLASS_CMD_READ4 && len == 4) { // 0x06
if (chip_state != SELECTED) {
goto send;
@ -803,16 +803,16 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
memcpy(emulator + (current_page * page_size) + (8 * block), receivedCmd + 2, 8);
}
if (simulationMode == ICLASS_SIM_MODE_FULL_GLITCH){
if (simulationMode == ICLASS_SIM_MODE_FULL_GLITCH) {
//Jam the read based on the last SIO block
uint8_t *sr_or_sio = emulator + (current_page * page_size) + (6 * 8);
if (memcmp(emulator + (current_page * page_size) + (5 * 8), ff_data, PICOPASS_BLOCK_SIZE) == 0){ //SR card
if (block == 16){ //SR cards use a standard legth SIO
if (memcmp(emulator + (current_page * page_size) + (5 * 8), ff_data, PICOPASS_BLOCK_SIZE) == 0) { //SR card
if (block == 16) { //SR cards use a standard legth SIO
//update block 6 byte 1 from 03 to A3
sr_or_sio[0] |= 0xA0;
goto send;
}
}else{ //For SE cards we have to account for different SIO lengths depending if a standard or custom key is used
} else { //For SE cards we have to account for different SIO lengths depending if a standard or custom key is used
if (block == (5 + ((sr_or_sio[1] + 12) / 8))) {
goto send;
}
@ -838,7 +838,7 @@ int do_iclass_simulation(int simulationMode, uint8_t *reader_mac_buf) {
goto send;
}
if ((simulationMode == ICLASS_SIM_MODE_FULL || simulationMode == ICLASS_SIM_MODE_FULL_GLITCH)&& max_page > 0) {
if ((simulationMode == ICLASS_SIM_MODE_FULL || simulationMode == ICLASS_SIM_MODE_FULL_GLITCH) && max_page > 0) {
// if on 2k, always ignore 3msb, & 0x1F)
uint8_t page = receivedCmd[1] & 0x1F;