mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-08-29 01:08:21 +00:00
Annotate FeliCa SEAC request and response traces
This commit is contained in:
+39
-1
@@ -2443,12 +2443,50 @@ 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) {
|
||||
static bool annotateFelicaSeac(char *exp, size_t size, const uint8_t *cmd, uint8_t cmdsize, bool is_response) {
|
||||
if (cmdsize < 7 || cmd[4] != 0x01 || cmd[5] != 0x01 ||
|
||||
(cmd[6] != 0x01 && cmd[6] < 0x0F)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char *operation = NULL;
|
||||
switch (cmd[3]) {
|
||||
case FELICA_SEAC_POLLING_CMD:
|
||||
operation = "POLLING";
|
||||
break;
|
||||
case FELICA_SEAC_AUTHENTICATION1_CMD:
|
||||
operation = "AUTHENTICATION1";
|
||||
break;
|
||||
case FELICA_SEAC_AUTHENTICATION2_CMD:
|
||||
operation = "AUTHENTICATION2";
|
||||
break;
|
||||
case FELICA_SEAC_WRITE_CMD:
|
||||
operation = "WRITE";
|
||||
break;
|
||||
case FELICA_SEAC_READ_CMD:
|
||||
operation = "READ";
|
||||
break;
|
||||
case FELICA_SEAC_EXTENDED_CMD:
|
||||
operation = "EXTENDED";
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
snprintf(exp, size, "SEAC %s %s (SELECTOR %02X)", operation, is_response ? "RES" : "REQ", cmd[6]);
|
||||
return true;
|
||||
}
|
||||
|
||||
void annotateFelica(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response) {
|
||||
if (cmdsize < 4) {
|
||||
snprintf(exp, size, "?");
|
||||
return;
|
||||
}
|
||||
|
||||
if (annotateFelicaSeac(exp, size, cmd, cmdsize, is_response)) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t cmd_code = cmd[3];
|
||||
if (cmd_code >= 0xC0 && cmdsize > 4) {
|
||||
// Command codes >= 0xC0 include a second-byte subcommand/function code.
|
||||
|
||||
@@ -54,7 +54,7 @@ void annotateIclass(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool
|
||||
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 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, bool is_response);
|
||||
void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response);
|
||||
void annotateCalypso(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, bool is_response);
|
||||
|
||||
@@ -839,6 +839,9 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
case PROTO_HITAGS:
|
||||
annotateHitagS(explanation, sizeof(explanation), frame, (data_len * 8) - ((8 - parityBytes[0]) % 8), hdr->isResponse);
|
||||
break;
|
||||
case FELICA:
|
||||
annotateFelica(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
|
||||
break;
|
||||
case PROTO_HITAGU:
|
||||
annotateHitagU(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
|
||||
break;
|
||||
@@ -872,9 +875,6 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
case ISO_15693:
|
||||
annotateIso15693(explanation, sizeof(explanation), frame, data_len);
|
||||
break;
|
||||
case FELICA:
|
||||
annotateFelica(explanation, sizeof(explanation), frame, data_len);
|
||||
break;
|
||||
case LTO:
|
||||
annotateLTO(explanation, sizeof(explanation), frame, data_len);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user