updated trace list -t seos to also annotate ISO7816

This commit is contained in:
iceman1001 2025-03-20 20:01:04 +01:00
commit ccef511dec
4 changed files with 24 additions and 10 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]
- Changed `trace list -t seos` - now annotate ISO7816 (@iceman1001)
- Updated aid and mad json files (@iceman1001) - Updated aid and mad json files (@iceman1001)
- Changed `hf 14a apdu` - now can be interrupted and dynamically adds time (@iceman1001) - Changed `hf 14a apdu` - now can be interrupted and dynamically adds time (@iceman1001)
- Changed `trace list -t` - shortend the hitag types (@iceman1001) - Changed `trace list -t` - shortend the hitag types (@iceman1001)

View file

@ -799,14 +799,20 @@ void annotateTopaz(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
} }
// iso 7816-3 // iso 7816-3
void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) { void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response) {
if (cmdsize < 2) if (cmdsize < 2) {
return; return;
}
if (is_response) {
return;
}
// S-block // S-block
if ((cmd[0] & 0xC0) && (cmdsize == 3)) { if ((cmd[0] & 0xC0) && ((cmdsize == 3) || (cmdsize == 4))) {
switch ((cmd[0] & 0x3f)) {
switch ((cmd[0] & 0x3F)) {
case 0x00 : case 0x00 :
snprintf(exp, size, "S-block RESYNCH req"); snprintf(exp, size, "S-block RESYNCH req");
break; break;
@ -831,6 +837,9 @@ void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
case 0x23 : case 0x23 :
snprintf(exp, size, "S-block WTX resp"); snprintf(exp, size, "S-block WTX resp");
break; break;
case 0x32:
snprintf(exp, size, "S-block WTX req");
break;
default : default :
snprintf(exp, size, "S-block"); snprintf(exp, size, "S-block");
break; break;
@ -845,6 +854,7 @@ void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
} }
// I-block // I-block
else { else {
int pos = 0; int pos = 0;
switch (cmd[0]) { switch (cmd[0]) {
case 2: case 2:
@ -858,6 +868,7 @@ void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
pos = 3; pos = 3;
break; break;
} }
switch (cmd[pos]) { switch (cmd[pos]) {
case ISO7816_READ_BINARY: case ISO7816_READ_BINARY:
snprintf(exp, size, "READ BIN"); snprintf(exp, size, "READ BIN");
@ -1788,6 +1799,8 @@ void annotateSeos(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is
// it's basically a ISO14443a tag, so try annotation from there // it's basically a ISO14443a tag, so try annotation from there
if (applyIso14443a(exp, size, cmd, cmdsize, false) != PM3_SUCCESS) { if (applyIso14443a(exp, size, cmd, cmdsize, false) != PM3_SUCCESS) {
annotateIso7816(exp, size, cmd, cmdsize, isResponse);
int pos = 0; int pos = 0;
switch (cmd[0]) { switch (cmd[0]) {
case 0: case 0:

View file

@ -55,7 +55,7 @@ void annotateIso15693(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
void annotateTopaz(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); void annotateTopaz(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
void annotateLegic(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); void annotateLegic(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
void annotateFelica(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); void annotateFelica(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response);
void annotateIso14443b(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); void annotateIso14443b(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
void annotateIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response); void annotateIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response);
void annotateMfDesfire(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize); void annotateMfDesfire(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);

View file

@ -840,7 +840,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
annotateTopaz(explanation, sizeof(explanation), frame, data_len); annotateTopaz(explanation, sizeof(explanation), frame, data_len);
break; break;
case ISO_7816_4: case ISO_7816_4:
annotateIso7816(explanation, sizeof(explanation), frame, data_len); annotateIso7816(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
break; break;
case ISO_15693: case ISO_15693:
annotateIso15693(explanation, sizeof(explanation), frame, data_len); annotateIso15693(explanation, sizeof(explanation), frame, data_len);
@ -1070,13 +1070,13 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
} }
if (use_us) { if (use_us) {
PrintAndLogEx(NORMAL, " %10.1f | %10.1f | %s |fdt (Frame Delay Time): " _YELLOW_("%.1f"), PrintAndLogEx(NORMAL, " %10.1f | %10.1f | %s |Frame Delay Time " _CYAN_("%.1f"),
(float)time1 / 13.56, (float)time1 / 13.56,
(float)time2 / 13.56, (float)time2 / 13.56,
" ", " ",
(float)(next_hdr->timestamp - end_of_transmission_timestamp) / 13.56); (float)(next_hdr->timestamp - end_of_transmission_timestamp) / 13.56);
} else { } else {
PrintAndLogEx(NORMAL, " %10u | %10u | %s |fdt (Frame Delay Time): " _YELLOW_("%d"), PrintAndLogEx(NORMAL, " %10u | %10u | %s |Frame Delay Time " _CYAN_("%d"),
time1, time1,
time2, time2,
" ", " ",
@ -1317,7 +1317,7 @@ int CmdTraceList(const char *Cmd) {
"trace list -t 14b -> interpret as " _YELLOW_("ISO14443-B") "\n" "trace list -t 14b -> interpret as " _YELLOW_("ISO14443-B") "\n"
"trace list -t 15 -> interpret as " _YELLOW_("ISO15693") "\n" "trace list -t 15 -> interpret as " _YELLOW_("ISO15693") "\n"
"trace list -t 7816 -> interpret as " _YELLOW_("ISO7816-4") "\n" "trace list -t 7816 -> interpret as " _YELLOW_("ISO7816-4") "\n"
"trace list -t cryptorf -> interpret as " _YELLOW_("CryptoRF") "\n\n" "trace list -t cryptorf -> interpret as " _YELLOW_("CryptoRF") "\n"
"trace list -t des -> interpret as " _YELLOW_("MIFARE DESFire") "\n" "trace list -t des -> interpret as " _YELLOW_("MIFARE DESFire") "\n"
"trace list -t felica -> interpret as " _YELLOW_("ISO18092 / FeliCa") "\n" "trace list -t felica -> interpret as " _YELLOW_("ISO18092 / FeliCa") "\n"
"trace list -t ht1 -> interpret as " _YELLOW_("Hitag 1") "\n" "trace list -t ht1 -> interpret as " _YELLOW_("Hitag 1") "\n"
@ -1348,7 +1348,7 @@ int CmdTraceList(const char *Cmd) {
arg_lit0("u", NULL, "display times in microseconds instead of clock cycles"), arg_lit0("u", NULL, "display times in microseconds instead of clock cycles"),
arg_lit0("x", NULL, "show hexdump to convert to pcap(ng)\n" arg_lit0("x", NULL, "show hexdump to convert to pcap(ng)\n"
" or to import into Wireshark using encapsulation type \"ISO 14443\""), " or to import into Wireshark using encapsulation type \"ISO 14443\""),
arg_str0("t", "type", NULL, "protocol to annotate the trace"), arg_str0("t", "type", "<str>", "protocol to annotate the trace"),
arg_str0("f", "file", "<fn>", "filename of dictionary"), arg_str0("f", "file", "<fn>", "filename of dictionary"),
arg_param_end arg_param_end
}; };