mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-14 02:26:59 -07:00
1. emulator works. tested on ARC1302, NXP pegoda, touchtag, my firm's readers.
2. added increment, decrement, restore, transfer commands 3. fixed several small bugs and small code cleaning 4. there is strange behavier in the emulator: for 7BUID is seems that there is must be a feature that cam make work card withouth 2nd anticollision loop. NXP reader authenticates, but cant read card contents. all the rest readers works, BUT.... my 7BUID mifare card dont work AT ALL .... I dont know what i should do )
This commit is contained in:
parent
51969283ec
commit
0014cb46da
4 changed files with 169 additions and 61 deletions
|
@ -339,6 +339,52 @@ void emlGetMemBt(uint8_t *data, int bytePtr, int byteCount) {
|
|||
memcpy(data, emCARD + bytePtr, byteCount);
|
||||
}
|
||||
|
||||
int emlCheckValBl(int blockNum) {
|
||||
uint8_t* emCARD = eml_get_bigbufptr_cardmem();
|
||||
uint8_t* data = emCARD + blockNum * 16;
|
||||
|
||||
if ((data[0] != (data[4] ^ 0xff)) || (data[0] != data[8]) ||
|
||||
(data[1] != (data[5] ^ 0xff)) || (data[1] != data[9]) ||
|
||||
(data[2] != (data[6] ^ 0xff)) || (data[2] != data[10]) ||
|
||||
(data[3] != (data[7] ^ 0xff)) || (data[3] != data[11]) ||
|
||||
(data[12] != (data[13] ^ 0xff)) || (data[12] != data[14]) ||
|
||||
(data[12] != (data[15] ^ 0xff))
|
||||
)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int emlGetValBl(uint32_t *blReg, uint8_t *blBlock, int blockNum) {
|
||||
uint8_t* emCARD = eml_get_bigbufptr_cardmem();
|
||||
uint8_t* data = emCARD + blockNum * 16;
|
||||
|
||||
if (emlCheckValBl(blockNum)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
memcpy(blReg, data, 4);
|
||||
*blBlock = data[12];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int emlSetValBl(uint32_t blReg, uint8_t blBlock, int blockNum) {
|
||||
uint8_t* emCARD = eml_get_bigbufptr_cardmem();
|
||||
uint8_t* data = emCARD + blockNum * 16;
|
||||
|
||||
memcpy(data + 0, &blReg, 4);
|
||||
memcpy(data + 8, &blReg, 4);
|
||||
blReg = blReg ^ 0xffffffff;
|
||||
memcpy(data + 4, &blReg, 4);
|
||||
|
||||
data[12] = blBlock;
|
||||
data[13] = blBlock ^ 0xff;
|
||||
data[14] = blBlock;
|
||||
data[15] = blBlock ^ 0xff;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t emlGetKey(int sectorNum, int keyType) {
|
||||
uint8_t key[6];
|
||||
uint8_t* emCARD = eml_get_bigbufptr_cardmem();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue