mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 23:36:31 +08:00
chg: trace list color in list
This commit is contained in:
parent
c1a5f93dab
commit
ffa27049b7
|
@ -641,7 +641,7 @@ static int CmdLFHitagCheckChallenges(const char *Cmd) {
|
|||
}
|
||||
|
||||
//Validations
|
||||
if (errors) {
|
||||
if (errors || strlen(Cmd) == 0) {
|
||||
free(data);
|
||||
return usage_hitag_checkchallenges();
|
||||
}
|
||||
|
@ -734,10 +734,14 @@ static int CmdLFHitag2Dump(const char *Cmd) {
|
|||
|
||||
|
||||
// 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;
|
||||
|
||||
|
@ -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) {
|
||||
// C 1 C 0
|
||||
// 1100 0 00 1 1100 000
|
||||
|
@ -768,9 +772,23 @@ void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
|||
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[] = {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
int CmdLFHitag(const char *Cmd);
|
||||
|
||||
int readHitagUid(void);
|
||||
void annotateHitag1(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
|
||||
void annotateHitag2(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize);
|
||||
void annotateHitagS(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, bool is_reader);
|
||||
void annotateHitagS(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool is_reader);
|
||||
#endif
|
||||
|
|
|
@ -356,7 +356,17 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
|||
if (protocol == FELICA)
|
||||
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) {
|
||||
case ICLASS:
|
||||
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:
|
||||
annotateLTO(explanation, sizeof(explanation), frame, data_len);
|
||||
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:
|
||||
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",
|
||||
(float)time1/13.56,
|
||||
(float)time2/13.56,
|
||||
(hdr->isResponse ? "Tag" : "Rdr"),
|
||||
(hdr->isResponse ? "Tag" : _YELLOW_("Rdr")),
|
||||
line[j],
|
||||
(j == num_lines - 1) ? crc : " ",
|
||||
(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",
|
||||
(hdr->timestamp - first_hdr->timestamp),
|
||||
(end_of_transmission_timestamp - first_hdr->timestamp),
|
||||
(hdr->isResponse ? "Tag" : "Rdr"),
|
||||
(hdr->isResponse ? "Tag" : _YELLOW_("Rdr")),
|
||||
line[j],
|
||||
(j == num_lines - 1) ? crc : " ",
|
||||
(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 (DecodeMifareData(frame, data_len, parityBytes, hdr->isResponse, mfData, &mfDataLen)) {
|
||||
memset(explanation, 0x00, sizeof(explanation));
|
||||
if (!hdr->isResponse) {
|
||||
if (hdr->isResponse == false) {
|
||||
annotateIso14443a(explanation, sizeof(explanation), 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;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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),
|
||||
(next_hdr->timestamp - first_hdr->timestamp),
|
||||
" ",
|
||||
|
@ -534,10 +535,10 @@ static int SanityOfflineCheck( bool useTraceBuffer ){
|
|||
|
||||
static int CmdTraceLoad(const char *Cmd) {
|
||||
|
||||
char filename[FILE_PATH_SIZE];
|
||||
char cmdp = tolower(param_getchar(Cmd, 0));
|
||||
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));
|
||||
|
||||
if (g_trace)
|
||||
|
@ -557,6 +558,9 @@ static int CmdTraceLoad(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) {
|
||||
download_trace();
|
||||
}
|
||||
|
@ -567,9 +571,6 @@ static int CmdTraceSave(const char *Cmd) {
|
|||
}
|
||||
|
||||
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));
|
||||
saveFile(filename, ".trace", g_trace, g_traceLen);
|
||||
return PM3_SUCCESS;
|
||||
|
|
Loading…
Reference in a new issue