mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 15:26:13 +08:00
ntag i2c 2k - fast write
This commit is contained in:
parent
9c2cbe9fbb
commit
e811b35a6f
|
@ -45,6 +45,9 @@ void ClearAuthData(void) {
|
|||
AuthData.ks3 = 0;
|
||||
}
|
||||
|
||||
|
||||
static int gs_ntag_i2c_state = 0;
|
||||
|
||||
/**
|
||||
* @brief iso14443A_CRC_check Checks CRC in command or response
|
||||
* @param isResponse
|
||||
|
@ -158,13 +161,17 @@ uint8_t iclass_CRC_check(bool isResponse, uint8_t *d, uint8_t n) {
|
|||
return check_crc(CRC_ICLASS, d, n);
|
||||
}
|
||||
|
||||
|
||||
int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
||||
|
||||
if ((cmdsize == 6) && (memcmp(cmd+1, "\x00\x00\x00", 3) == 0)) {
|
||||
if ((gs_ntag_i2c_state == 1) && (cmdsize == 6) && (memcmp(cmd+1, "\x00\x00\x00", 3) == 0)) {
|
||||
snprintf(exp, size, "SECTOR(%d)", cmd[0]);
|
||||
gs_ntag_i2c_state = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
gs_ntag_i2c_state = 0;
|
||||
|
||||
switch (cmd[0]) {
|
||||
case ISO14443A_CMD_WUPA:
|
||||
snprintf(exp, size, "WUPA");
|
||||
|
@ -240,6 +247,7 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
|||
// high probability its SELECT SECTOR COMMAND:
|
||||
if (cmd[1] == 0xFF) {
|
||||
snprintf(exp, size, "SELECT SECTOR");
|
||||
gs_ntag_i2c_state = 1;
|
||||
} else {
|
||||
snprintf(exp, size, "RESTORE(%d)", cmd[1]);
|
||||
}
|
||||
|
@ -336,6 +344,11 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
|||
snprintf(exp, size, "?");
|
||||
break;
|
||||
}
|
||||
case NTAG_I2C_FASTWRITE:
|
||||
if (size == 69) {
|
||||
snprintf(exp, size, "FAST WRITE (%d - %d)", cmd[1], cmd[2]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -195,6 +195,7 @@ ISO 7816-4 Basic interindustry commands. For command APDU's.
|
|||
// NTAG i2k 2K uses sector 0, and sector 1 to have access to
|
||||
// block 0x00-0xFF.
|
||||
#define NTAG_I2C_SELECT_SECTOR 0xC2
|
||||
#define NTAG_I2C_FASTWRITE 0xA6
|
||||
|
||||
// mifare 4bit card answers
|
||||
#define CARD_ACK 0x0A // 1010 - ACK
|
||||
|
|
Loading…
Reference in a new issue