Add formatting to DESfire data dump (#1784)
Co-authored-by: gornekich <n.gorbadey@gmail.com>
This commit is contained in:
parent
5bb7cabea6
commit
e6e1e7fe15
@ -209,8 +209,24 @@ void mf_df_cat_file(MifareDesfireFile* file, string_t out) {
|
||||
uint8_t* data = file->contents;
|
||||
if(data) {
|
||||
for(int rec = 0; rec < num; rec++) {
|
||||
for(int ch = 0; ch < size; ch++) {
|
||||
string_cat_printf(out, "%02x", data[rec * size + ch]);
|
||||
string_cat_printf(out, "record %d\n", rec);
|
||||
for(int ch = 0; ch < size; ch += 4) {
|
||||
string_cat_printf(out, "%03x|", ch);
|
||||
for(int i = 0; i < 4; i++) {
|
||||
if(ch + i < size) {
|
||||
string_cat_printf(out, "%02x ", data[rec * size + ch + i]);
|
||||
} else {
|
||||
string_cat_printf(out, " ");
|
||||
}
|
||||
}
|
||||
for(int i = 0; i < 4 && ch + i < size; i++) {
|
||||
if(isprint(data[rec * size + ch + i])) {
|
||||
string_cat_printf(out, "%c", data[rec * size + ch + i]);
|
||||
} else {
|
||||
string_cat_printf(out, ".");
|
||||
}
|
||||
}
|
||||
string_cat_printf(out, "\n");
|
||||
}
|
||||
string_cat_printf(out, " \n");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user