diff --git a/CHANGELOG.md b/CHANGELOG.md index 51a06b0db..bb0835a11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ 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] + - Added `hf 15 vie` - view ISO15693 dump files (@iceman1001) - Fixed `hf iclass config` - now loops correct in keyroll generation (@iceman1001) - Added `hf iclass sam` - skeleton command (@iceman1001) - Changed `lf cotag demo` - a new decoder (@iceman1001) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index c16bfb10b..63ed2dd09 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -2820,10 +2820,45 @@ static int CmdHF15EASPassProtect(const char *Cmd) { return resp.status; } +static int CmdHF15View(const char *Cmd) { + CLIParserContext *ctx; + CLIParserInit(&ctx, "hf 15 view", + "Print a ISO-15693 tag dump file (bin/eml/json)", + "hf 15 view -f hf-iclass-AA162D30F8FF12F1-dump.bin\n" + ); + void *argtable[] = { + arg_param_begin, + arg_str1("f", "file", "", "filename of dump (bin/eml/json)"), +// arg_lit0("z", "dense", "dense dump output style"), + arg_param_end + }; + CLIExecWithReturn(ctx, Cmd, argtable, false); + + int fnlen = 0; + char filename[FILE_PATH_SIZE]; + CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen); +// bool dense_output = g_session.dense_output || arg_get_lit(ctx, 2); + CLIParserFree(ctx); + + // read dump file + uint8_t *dump = NULL; + size_t bytes_read = CARD_MEMORY_SIZE; + int res = pm3_load_dump(filename, (void **)&dump, &bytes_read, CARD_MEMORY_SIZE); + if (res != PM3_SUCCESS) { + return res; + } + + PrintAndLogEx(NORMAL, ""); + print_blocks_15693(dump, bytes_read, 4); + + free(dump); + return PM3_SUCCESS; +} + static command_t CommandTable[] = { - {"-----------", CmdHF15Help, AlwaysAvailable, "--------------------- " _CYAN_("General") " ---------------------"}, {"help", CmdHF15Help, AlwaysAvailable, "This help"}, {"list", CmdHF15List, AlwaysAvailable, "List ISO-15693 history"}, + {"-----------", CmdHF15Help, AlwaysAvailable, "----------------------- " _CYAN_("general") " -----------------------"}, {"demod", CmdHF15Demod, AlwaysAvailable, "Demodulate ISO-15693 from tag"}, {"dump", CmdHF15Dump, IfPm3Iso15693, "Read all memory pages of an ISO-15693 tag, save to file"}, {"info", CmdHF15Info, IfPm3Iso15693, "Tag information"}, @@ -2834,10 +2869,14 @@ static command_t CommandTable[] = { {"reader", CmdHF15Reader, IfPm3Iso15693, "Act like an ISO-15693 reader"}, {"restore", CmdHF15Restore, IfPm3Iso15693, "Restore from file to all memory pages of an ISO-15693 tag"}, {"samples", CmdHF15Samples, IfPm3Iso15693, "Acquire samples as reader (enables carrier, sends inquiry)"}, + {"view", CmdHF15View, AlwaysAvailable, "Display content from tag dump file"}, + {"wrbl", CmdHF15Write, IfPm3Iso15693, "Write a block"}, + {"-----------", CmdHF15Help, IfPm3Iso15693, "--------------------- " _CYAN_("simulation") " ----------------------"}, + {"sim", CmdHF15Sim, IfPm3Iso15693, "Fake an ISO-15693 tag"}, {"eload", CmdHF15ELoad, IfPm3Iso15693, "Load image file into emulator to be used by 'sim' command"}, {"esave", CmdHF15ESave, IfPm3Iso15693, "Save emulator memory into image file"}, {"eview", CmdHF15EView, IfPm3Iso15693, "View emulator memory"}, - {"sim", CmdHF15Sim, IfPm3Iso15693, "Fake an ISO-15693 tag"}, + {"-----------", CmdHF15Help, IfPm3Iso15693, "------------------------ " _CYAN_("SLIX") " -------------------------"}, {"slixwritepwd", CmdHF15SlixWritePassword, IfPm3Iso15693, "Writes a password on a SLIX ISO-15693 tag"}, {"slixeasdisable", CmdHF15SlixEASDisable, IfPm3Iso15693, "Disable EAS mode on SLIX ISO-15693 tag"}, {"slixeasenable", CmdHF15SlixEASEnable, IfPm3Iso15693, "Enable EAS mode on SLIX ISO-15693 tag"}, @@ -2845,12 +2884,11 @@ static command_t CommandTable[] = { {"slixprivacyenable", CmdHF15SlixEnable, IfPm3Iso15693, "Enable privacy mode on SLIX ISO-15693 tag"}, {"passprotectafi", CmdHF15AFIPassProtect, IfPm3Iso15693, "Password protect AFI - Cannot be undone"}, {"passprotecteas", CmdHF15EASPassProtect, IfPm3Iso15693, "Password protect EAS - Cannot be undone"}, - {"wrbl", CmdHF15Write, IfPm3Iso15693, "Write a block"}, - {"-----------", CmdHF15Help, IfPm3Iso15693, "----------------------- " _CYAN_("afi") " -----------------------"}, + {"-----------", CmdHF15Help, IfPm3Iso15693, "-------------------------- " _CYAN_("afi") " ------------------------"}, {"findafi", CmdHF15FindAfi, IfPm3Iso15693, "Brute force AFI of an ISO-15693 tag"}, {"writeafi", CmdHF15WriteAfi, IfPm3Iso15693, "Writes the AFI on an ISO-15693 tag"}, {"writedsfid", CmdHF15WriteDsfid, IfPm3Iso15693, "Writes the DSFID on an ISO-15693 tag"}, - {"-----------", CmdHF15Help, IfPm3Iso15693, "----------------------- " _CYAN_("magic") " -----------------------"}, + {"-----------", CmdHF15Help, IfPm3Iso15693, "------------------------- " _CYAN_("magic") " -----------------------"}, {"csetuid", CmdHF15CSetUID, IfPm3Iso15693, "Set UID for magic card"}, {NULL, NULL, NULL, NULL} };