trace list - now colors whole reader line output. Also little nasty buff-underflow bug fixed

This commit is contained in:
iceman1001 2021-04-19 22:18:37 +02:00
parent 1d69cabd54
commit 5604afce7a
2 changed files with 61 additions and 25 deletions

View file

@ -3,6 +3,8 @@ 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...
## [unreleased][unreleased]
- Change `hf 14a/14b/15 list etc alias commands now unified helptext (@doegox)
- Change `trace list` - now colors whole reader line (@iceman1001)
- Change `lf search` - add option `-c` to continue searching after first hit (@doegox)
- Fix DESFire mis-annotation (@VortixDev)
- Change `lf pac demod` - now also search for inverted bitstreams (@iceman1001)

View file

@ -308,9 +308,12 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
}
m--;
}
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 2] = '(';
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 3] = m + 0x30;
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 4] = ')';
if (data_len) {
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 2] = '(';
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 3] = m + 0x30;
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 4] = ')';
}
}
}
@ -400,32 +403,63 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
time2 = duration;
}
if (use_us) {
PrintAndLogEx(NORMAL, " %10.1f | %10.1f | %s |%-72s | %s| %s",
(float)time1 / 13.56,
(float)time2 / 13.56,
(hdr->isResponse ? "Tag" : _YELLOW_("Rdr")),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
if (hdr->isResponse) {
// tag row
if (use_us) {
PrintAndLogEx(NORMAL, " %10.1f | %10.1f | Tag |%-72s | %s| %s",
(float)time1 / 13.56,
(float)time2 / 13.56,
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
} else {
PrintAndLogEx(NORMAL, " %10u | %10u | Tag |%-72s | %s| %s",
(hdr->timestamp - first_hdr->timestamp),
(end_of_transmission_timestamp - first_hdr->timestamp),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
}
} else {
PrintAndLogEx(NORMAL, " %10u | %10u | %s |%-72s | %s| %s",
(hdr->timestamp - first_hdr->timestamp),
(end_of_transmission_timestamp - first_hdr->timestamp),
(hdr->isResponse ? "Tag" : _YELLOW_("Rdr")),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
// reader row
if (use_us) {
PrintAndLogEx(NORMAL,
_YELLOW_(" %10.1f") " | " _YELLOW_("%10.1f") " | " _YELLOW_("Rdr") " |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
(float)time1 / 13.56,
(float)time2 / 13.56,
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
} else {
PrintAndLogEx(NORMAL,
_YELLOW_(" %10u") " | " _YELLOW_("%10u") " | " _YELLOW_("Rdr") " |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
(hdr->timestamp - first_hdr->timestamp),
(end_of_transmission_timestamp - first_hdr->timestamp),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
}
}
} else {
PrintAndLogEx(NORMAL, " | | |%-72s | %s| %s",
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
if (hdr->isResponse) {
PrintAndLogEx(NORMAL, " | | |%-72s | %s| %s",
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
} else {
PrintAndLogEx(NORMAL, " | | |" _YELLOW_("%-72s")" | " _YELLOW_("%s") "| " _YELLOW_("%s"),
line[j],
(j == num_lines - 1) ? crc : " ",
(j == num_lines - 1) ? explanation : ""
);
}
}
}