Change 'hf 14a list' to annotate more ECP frame formats

This commit is contained in:
kormax 2022-06-14 21:42:50 +03:00
commit b11b4e66af
3 changed files with 14 additions and 3 deletions

View file

@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
## [unreleased][unreleased] ## [unreleased][unreleased]
- Change `trace list -t 14a` to annotate ECP frames of all valid V1 and V2 formats (@kormax)
- Changed `hf mf staticnested` - significant speedups by using two encrypted nonces (@xianglin1998) - Changed `hf mf staticnested` - significant speedups by using two encrypted nonces (@xianglin1998)
- Change use of `sprintf` in code to `snprintf` to fix compilation on macOS (@Doridian) - Change use of `sprintf` in code to `snprintf` to fix compilation on macOS (@Doridian)
- Change `hf mf mad` - it now takes a dump file for offline MAD decoding (@iceman1001) - Change `hf mf mad` - it now takes a dump file for offline MAD decoding (@iceman1001)

View file

@ -181,9 +181,17 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool i
return PM3_SUCCESS; return PM3_SUCCESS;
} }
if (cmdsize > 10 && (memcmp(cmd, "\x6a\x02\xC8\x01\x00\x03\x00\x02\x79", 9) == 0)) { if (cmdsize >= 7 && cmd[0] == ECP_HEADER) {
snprintf(exp, size, "ECP"); // Second byte of ECP frame indicates its version
return PM3_SUCCESS; // Version 0x01 payload is 7 bytes long (including crc)
// Version 0x02 payload is 15 bytes long (including crc)
if (cmd[1] == 0x01 && cmdsize == 7) {
snprintf(exp, size, "ECP1");
return PM3_SUCCESS;
} else if (cmd[1] == 0x02 && cmdsize == 15) {
snprintf(exp, size, "ECP2");
return PM3_SUCCESS;
}
} }
gs_ntag_i2c_state = 0; gs_ntag_i2c_state = 0;

View file

@ -158,6 +158,8 @@ ISO 7816-4 Basic interindustry commands. For command APDU's.
#define ICLASS_DEBIT(x) (((x) & 0x80) == 0x80) #define ICLASS_DEBIT(x) (((x) & 0x80) == 0x80)
#define ECP_HEADER 0x6A
// 7bit Apple Magsafe wake up command // 7bit Apple Magsafe wake up command
#define MAGSAFE_CMD_WUPA_1 0x7A #define MAGSAFE_CMD_WUPA_1 0x7A
#define MAGSAFE_CMD_WUPA_2 0x7B #define MAGSAFE_CMD_WUPA_2 0x7B