mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
chg: trace list color in list
This commit is contained in:
parent
c1a5f93dab
commit
ffa27049b7
3 changed files with 80 additions and 61 deletions
|
@ -641,7 +641,7 @@ static int CmdLFHitagCheckChallenges(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//Validations
|
//Validations
|
||||||
if (errors) {
|
if (errors || strlen(Cmd) == 0) {
|
||||||
free(data);
|
free(data);
|
||||||
return usage_hitag_checkchallenges();
|
return usage_hitag_checkchallenges();
|
||||||
}
|
}
|
||||||
|
@ -734,10 +734,14 @@ static int CmdLFHitag2Dump(const char *Cmd) {
|
||||||
|
|
||||||
|
|
||||||
// Annotate HITAG protocol
|
// Annotate HITAG protocol
|
||||||
void annotateHitag1(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
void annotateHitag1(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_reader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_response) {
|
||||||
|
|
||||||
|
// iceman: live decrypt of trace?
|
||||||
|
if (is_response) {
|
||||||
|
|
||||||
|
|
||||||
uint8_t cmdbits = (cmd[0] & 0xC0) >> 6;
|
uint8_t cmdbits = (cmd[0] & 0xC0) >> 6;
|
||||||
|
|
||||||
|
@ -752,7 +756,7 @@ void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmdsize == 2) {
|
if (cmdsize == 3) {
|
||||||
if (cmdbits == HITAG2_START_AUTH) {
|
if (cmdbits == HITAG2_START_AUTH) {
|
||||||
// C 1 C 0
|
// C 1 C 0
|
||||||
// 1100 0 00 1 1100 000
|
// 1100 0 00 1 1100 000
|
||||||
|
@ -768,9 +772,23 @@ void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cmdsize == 9) {
|
||||||
|
snprintf(exp, size, "Nr Ar Is response");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if (cmdsize == 9) {
|
||||||
|
snprintf(exp, size, "Nr Ar");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void annotateHitagS(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
|
||||||
|
void annotateHitagS(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_reader) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static command_t CommandTable[] = {
|
static command_t CommandTable[] = {
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
int CmdLFHitag(const char *Cmd);
|
int CmdLFHitag(const char *Cmd);
|
||||||
|
|
||||||
int readHitagUid(void);
|
int readHitagUid(void);
|
||||||
void annotateHitag1(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
|
void annotateHitag1(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_reader);
|
||||||
void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
|
void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_reader);
|
||||||
void annotateHitagS(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
|
void annotateHitagS(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_reader);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -356,7 +356,17 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||||
if (protocol == FELICA)
|
if (protocol == FELICA)
|
||||||
annotateFelica(explanation, sizeof(explanation), frame, data_len);
|
annotateFelica(explanation, sizeof(explanation), frame, data_len);
|
||||||
|
|
||||||
if (!hdr->isResponse) {
|
if (protocol == PROTO_HITAG1) {
|
||||||
|
annotateHitag1(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
|
||||||
|
}
|
||||||
|
if (protocol == PROTO_HITAG2) {
|
||||||
|
annotateHitag2(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
|
||||||
|
}
|
||||||
|
if (protocol == PROTO_HITAGS) {
|
||||||
|
annotateHitagS(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hdr->isResponse == false) {
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
case ICLASS:
|
case ICLASS:
|
||||||
annotateIclass(explanation, sizeof(explanation), frame, data_len);
|
annotateIclass(explanation, sizeof(explanation), frame, data_len);
|
||||||
|
@ -385,15 +395,6 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||||
case LTO:
|
case LTO:
|
||||||
annotateLTO(explanation, sizeof(explanation), frame, data_len);
|
annotateLTO(explanation, sizeof(explanation), frame, data_len);
|
||||||
break;
|
break;
|
||||||
case PROTO_HITAG1:
|
|
||||||
annotateHitag1(explanation, sizeof(explanation), frame, data_len);
|
|
||||||
break;
|
|
||||||
case PROTO_HITAG2:
|
|
||||||
annotateHitag2(explanation, sizeof(explanation), frame, data_len);
|
|
||||||
break;
|
|
||||||
case PROTO_HITAGS:
|
|
||||||
annotateHitagS(explanation, sizeof(explanation), frame, data_len);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +415,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||||
PrintAndLogEx(NORMAL, " %10.1f | %10.1f | %s |%-72s | %s| %s",
|
PrintAndLogEx(NORMAL, " %10.1f | %10.1f | %s |%-72s | %s| %s",
|
||||||
(float)time1/13.56,
|
(float)time1/13.56,
|
||||||
(float)time2/13.56,
|
(float)time2/13.56,
|
||||||
(hdr->isResponse ? "Tag" : "Rdr"),
|
(hdr->isResponse ? "Tag" : _YELLOW_("Rdr")),
|
||||||
line[j],
|
line[j],
|
||||||
(j == num_lines - 1) ? crc : " ",
|
(j == num_lines - 1) ? crc : " ",
|
||||||
(j == num_lines - 1) ? explanation : ""
|
(j == num_lines - 1) ? explanation : ""
|
||||||
|
@ -423,7 +424,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||||
PrintAndLogEx(NORMAL, " %10u | %10u | %s |%-72s | %s| %s",
|
PrintAndLogEx(NORMAL, " %10u | %10u | %s |%-72s | %s| %s",
|
||||||
(hdr->timestamp - first_hdr->timestamp),
|
(hdr->timestamp - first_hdr->timestamp),
|
||||||
(end_of_transmission_timestamp - first_hdr->timestamp),
|
(end_of_transmission_timestamp - first_hdr->timestamp),
|
||||||
(hdr->isResponse ? "Tag" : "Rdr"),
|
(hdr->isResponse ? "Tag" : _YELLOW_("Rdr")),
|
||||||
line[j],
|
line[j],
|
||||||
(j == num_lines - 1) ? crc : " ",
|
(j == num_lines - 1) ? crc : " ",
|
||||||
(j == num_lines - 1) ? explanation : ""
|
(j == num_lines - 1) ? explanation : ""
|
||||||
|
@ -442,7 +443,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||||
if (protocol == PROTO_MIFARE) {
|
if (protocol == PROTO_MIFARE) {
|
||||||
if (DecodeMifareData(frame, data_len, parityBytes, hdr->isResponse, mfData, &mfDataLen)) {
|
if (DecodeMifareData(frame, data_len, parityBytes, hdr->isResponse, mfData, &mfDataLen)) {
|
||||||
memset(explanation, 0x00, sizeof(explanation));
|
memset(explanation, 0x00, sizeof(explanation));
|
||||||
if (!hdr->isResponse) {
|
if (hdr->isResponse == false) {
|
||||||
annotateIso14443a(explanation, sizeof(explanation), mfData, mfDataLen);
|
annotateIso14443a(explanation, sizeof(explanation), mfData, mfDataLen);
|
||||||
}
|
}
|
||||||
uint8_t crcc = iso14443A_CRC_check(hdr->isResponse, mfData, mfDataLen);
|
uint8_t crcc = iso14443A_CRC_check(hdr->isResponse, mfData, mfDataLen);
|
||||||
|
@ -457,11 +458,11 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||||
return traceLen;
|
return traceLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showWaitCycles && !hdr->isResponse && next_record_is_response(tracepos, trace)) {
|
if (showWaitCycles && hdr->isResponse == false && next_record_is_response(tracepos, trace)) {
|
||||||
|
|
||||||
tracelog_hdr_t *next_hdr = (tracelog_hdr_t *)(trace + tracepos);
|
tracelog_hdr_t *next_hdr = (tracelog_hdr_t *)(trace + tracepos);
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, " %10u | %10u | %s |fdt (Frame Delay Time): %d",
|
PrintAndLogEx(NORMAL, " %10u | %10u | %s |fdt (Frame Delay Time): " _YELLOW_("%d"),
|
||||||
(end_of_transmission_timestamp - first_hdr->timestamp),
|
(end_of_transmission_timestamp - first_hdr->timestamp),
|
||||||
(next_hdr->timestamp - first_hdr->timestamp),
|
(next_hdr->timestamp - first_hdr->timestamp),
|
||||||
" ",
|
" ",
|
||||||
|
@ -534,10 +535,10 @@ static int SanityOfflineCheck( bool useTraceBuffer ){
|
||||||
|
|
||||||
static int CmdTraceLoad(const char *Cmd) {
|
static int CmdTraceLoad(const char *Cmd) {
|
||||||
|
|
||||||
char filename[FILE_PATH_SIZE];
|
|
||||||
char cmdp = tolower(param_getchar(Cmd, 0));
|
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||||
if (strlen(Cmd) < 1 || (strlen(Cmd) == 1 && cmdp == 'h')) return usage_trace_load();
|
if (strlen(Cmd) < 1 || (strlen(Cmd) == 1 && cmdp == 'h')) return usage_trace_load();
|
||||||
|
|
||||||
|
char filename[FILE_PATH_SIZE];
|
||||||
param_getstr(Cmd, 0, filename, sizeof(filename));
|
param_getstr(Cmd, 0, filename, sizeof(filename));
|
||||||
|
|
||||||
if (g_trace)
|
if (g_trace)
|
||||||
|
@ -557,6 +558,9 @@ static int CmdTraceLoad(const char *Cmd) {
|
||||||
|
|
||||||
static int CmdTraceSave(const char *Cmd) {
|
static int CmdTraceSave(const char *Cmd) {
|
||||||
|
|
||||||
|
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||||
|
if (strlen(Cmd) < 1 || (strlen(Cmd) == 1 && cmdp == 'h')) return usage_trace_save();
|
||||||
|
|
||||||
if (g_traceLen == 0) {
|
if (g_traceLen == 0) {
|
||||||
download_trace();
|
download_trace();
|
||||||
}
|
}
|
||||||
|
@ -567,9 +571,6 @@ static int CmdTraceSave(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char filename[FILE_PATH_SIZE];
|
char filename[FILE_PATH_SIZE];
|
||||||
char cmdp = tolower(param_getchar(Cmd, 0));
|
|
||||||
if (strlen(Cmd) < 1 || (strlen(Cmd) == 1 && cmdp == 'h')) return usage_trace_save();
|
|
||||||
|
|
||||||
param_getstr(Cmd, 0, filename, sizeof(filename));
|
param_getstr(Cmd, 0, filename, sizeof(filename));
|
||||||
saveFile(filename, ".trace", g_trace, g_traceLen);
|
saveFile(filename, ".trace", g_trace, g_traceLen);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue