mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-30 19:40:37 -07:00
cmdhf15: addapt eview to new iso15sim eml format
This commit is contained in:
parent
0bbb054b33
commit
e6bca3221d
1 changed files with 33 additions and 17 deletions
|
@ -1279,6 +1279,13 @@ static void print_blocks_15693(uint8_t *data, uint16_t bytes, int blocksize, boo
|
||||||
PrintAndLogEx(INFO, "----------- " _CYAN_("Tag Memory") " ---------------");
|
PrintAndLogEx(INFO, "----------- " _CYAN_("Tag Memory") " ---------------");
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
|
||||||
|
if (blocksize == 0 || bytes == 0)
|
||||||
|
{
|
||||||
|
PrintAndLogEx(INFO, "Tag is empty!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
print_hrule(blocksize);
|
print_hrule(blocksize);
|
||||||
|
|
||||||
char spaces[] = " ";
|
char spaces[] = " ";
|
||||||
|
@ -1336,38 +1343,46 @@ static void print_blocks_15693(uint8_t *data, uint16_t bytes, int blocksize, boo
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void print_emltag_info_15693(iso15_tag_t *tag) {
|
||||||
|
PrintAndLogEx(SUCCESS, " TYPE... " _YELLOW_("%s"), getTagInfo_15(tag->uid));
|
||||||
|
PrintAndLogEx(SUCCESS, " UID... " _GREEN_("%s"), iso15693_sprintUID(NULL, tag->uid));
|
||||||
|
PrintAndLogEx(SUCCESS, " - DSFID [0x%02X]", tag->dsfid);
|
||||||
|
PrintAndLogEx(SUCCESS, " - AFI [0x%02X]", tag->afi);
|
||||||
|
PrintAndLogEx(SUCCESS, " - IC reference [0x%02X]", tag->ic);
|
||||||
|
PrintAndLogEx(SUCCESS, " - Tag memory layout");
|
||||||
|
PrintAndLogEx(SUCCESS, " %u bytes/blocks x %u blocks", tag->bytesPerPage, tag->pagesCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void print_emltag_15693(iso15_tag_t *tag, bool dense_output) {
|
||||||
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
PrintAndLogEx(INFO, "--- " _CYAN_("Emulator Tag Information") " ---------------------------");
|
||||||
|
|
||||||
|
print_emltag_info_15693(tag);
|
||||||
|
|
||||||
|
print_blocks_15693(tag->data, (tag->pagesCount * tag->bytesPerPage),
|
||||||
|
tag->bytesPerPage, dense_output);
|
||||||
|
}
|
||||||
|
|
||||||
static int CmdHF15EView(const char *Cmd) {
|
static int CmdHF15EView(const char *Cmd) {
|
||||||
|
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf 15 eview",
|
CLIParserInit(&ctx, "hf 15 eview",
|
||||||
"It displays emulator memory",
|
"It displays emulator memory",
|
||||||
"hf 15 eview\n"
|
"hf 15 eview\n"
|
||||||
"hf 15 eview -b 8 -c 60\n"
|
"hf 15 eview -z\n"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_int0("b", "blocksize", "<dec>", "block size (def 4)"),
|
|
||||||
arg_int0("c", "count", "<dec>", "number of blocks to display (def all)"),
|
|
||||||
arg_lit0("z", "dense", "dense dump output style"),
|
arg_lit0("z", "dense", "dense dump output style"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
int blocksize = arg_get_int_def(ctx, 1, 4);
|
bool dense_output = (g_session.dense_output || arg_get_lit(ctx, 1));
|
||||||
int count = arg_get_int_def(ctx, 2, -1);
|
|
||||||
bool dense_output = (g_session.dense_output || arg_get_lit(ctx, 3));
|
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
// santity checks
|
int bytes = sizeof(iso15_tag_t);
|
||||||
if (blocksize < 4) {
|
|
||||||
PrintAndLogEx(WARNING, "Blocksize too small, using default 4 bytes");
|
|
||||||
blocksize = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
int bytes = CARD_MEMORY_SIZE;
|
|
||||||
if (count > 0 && count * blocksize <= bytes) {
|
|
||||||
bytes = count * blocksize;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// reserve memory
|
||||||
uint8_t *dump = calloc(bytes, sizeof(uint8_t));
|
uint8_t *dump = calloc(bytes, sizeof(uint8_t));
|
||||||
if (dump == NULL) {
|
if (dump == NULL) {
|
||||||
PrintAndLogEx(WARNING, "Fail, cannot allocate memory");
|
PrintAndLogEx(WARNING, "Fail, cannot allocate memory");
|
||||||
|
@ -1381,7 +1396,8 @@ static int CmdHF15EView(const char *Cmd) {
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_blocks_15693(dump, bytes, blocksize, dense_output);
|
print_emltag_15693((iso15_tag_t *)dump, dense_output);
|
||||||
|
|
||||||
free(dump);
|
free(dump);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue