mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-25 08:35:56 +08:00
add offset print buffer to util
This commit is contained in:
parent
8f9e3977d4
commit
9a822ea087
2 changed files with 15 additions and 0 deletions
|
@ -249,6 +249,20 @@ void print_buffer(const uint8_t *data, const size_t len, int level) {
|
|||
print_buffer_ex(data, len, level, 16);
|
||||
}
|
||||
|
||||
void print_buffer_with_offset(const uint8_t *data, const size_t len, int offset) {
|
||||
PrintAndLogEx(INFO, " Offset | Data | Ascii");
|
||||
PrintAndLogEx(INFO, "----------------------------------------------------------------------------");
|
||||
|
||||
for (uint32_t i = 0; i < len; i += 16) {
|
||||
uint32_t l = len - i;
|
||||
PrintAndLogEx(INFO, "%3d/0x%02X | %s" NOLF, offset + i, offset + i, sprint_hex(&data[i], l > 16 ? 16 : l));
|
||||
if (l < 16)
|
||||
PrintAndLogEx(NORMAL, "%*s" NOLF, 3 * (16 - l), " ");
|
||||
PrintAndLogEx(NORMAL, "| %s", sprint_ascii(&data[i], l > 16 ? 16 : l));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void print_blocks(uint32_t *data, size_t len) {
|
||||
PrintAndLogEx(SUCCESS, "Blk | Data ");
|
||||
PrintAndLogEx(SUCCESS, "----+------------");
|
||||
|
|
|
@ -52,6 +52,7 @@ char *sprint_hex_ascii(const uint8_t *data, const size_t len);
|
|||
char *sprint_ascii(const uint8_t *data, const size_t len);
|
||||
char *sprint_ascii_ex(const uint8_t *data, const size_t len, const size_t min_str_len);
|
||||
|
||||
void print_buffer_with_offset(const uint8_t *data, const size_t len, int offset);
|
||||
void print_buffer(const uint8_t *data, const size_t len, int level);
|
||||
void print_blocks(uint32_t *data, size_t len);
|
||||
|
||||
|
|
Loading…
Reference in a new issue