readerAttack: inject only found key

This commit is contained in:
Philippe Teuwen 2024-10-15 23:57:57 +02:00
commit c1a038aa56

View file

@ -4059,9 +4059,15 @@ void readerAttack(sector_t *k_sector, size_t k_sectors_cnt, nonces_t data, bool
//set emulator memory for keys //set emulator memory for keys
if (setEmulatorMem) { if (setEmulatorMem) {
uint8_t memBlock[16] = {0, 0, 0, 0, 0, 0, 0xFF, 0x07, 0x80, 0x69, 0, 0, 0, 0, 0, 0}; uint8_t memBlock[16];
num_to_bytes(k_sector[sector].Key[0], 6, memBlock); mfEmlGetMem(memBlock, (sector * 4) + 3, 1);
num_to_bytes(k_sector[sector].Key[1], 6, memBlock + 10); if ((memBlock[6]==0) && (memBlock[7]==0) && (memBlock[8]==0)) {
// ACL not yet set?
memBlock[6] = 0xFF;
memBlock[7] = 0x07;
memBlock[8] = 0x80;
}
num_to_bytes(k_sector[sector].Key[keytype], 6, memBlock + ((keytype == MF_KEY_B) ? 10 : 0));
//iceman, guessing this will not work so well for 4K tags. //iceman, guessing this will not work so well for 4K tags.
PrintAndLogEx(INFO, "Setting Emulator Memory Block %02d: [%s]" PrintAndLogEx(INFO, "Setting Emulator Memory Block %02d: [%s]"
, (sector * 4) + 3 , (sector * 4) + 3