diff --git a/CHANGELOG.md b/CHANGELOG.md index 787846939..87a7a2d64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,13 +3,15 @@ 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] + - Fixed `hf mfu chk` - Enter or a timeout during a chunk stops it (@matrix) - Fixed `hf mfu chk` - no "-nan" speed when no chunk ran, the progress line counts the keys tested (@matrix) +- Fixed `hf 15 dump` - a dump that stops early no longer prints and saves the unread blocks as zeros; it shows the blocks it read, says how many of the total, saves nothing and returns PM3_EPARTIAL (@iceman1001) - Fixed `hf mf brute` - Enter or a chunk timeout stops it, no division by zero on a stage under 1 s (@matrix) - Fixed `hf mf brute` - `--emu` checks the trailer read, `--dump` keeps the keys when the card is gone and reports a failed save (@matrix) - Fixed `hf mf fchk` - Enter or a timeout during a chunk stops it, `--emu` checks the trailer read (@matrix) - Fixed `hf mf fchk` - `--dump` keeps the keys when the card is gone and reports a failed save, `--blk` no longer ignores `--emu` and `--dump` (@matrix) -- Fixed `hf mfp chk` - a failed exchange no longer abandons every remaining sector with a success exit code; the key is counted as untested and the search goes on, a key slot is given up after 3 unanswered keys, and an incomplete search says so and returns PM3_EPARTIAL (@iceman1001) +- Fixed `hf mfp chk` - a failed exchange no longer abandons every remaining sector with a success exit code (@iceman1001) - Fixed `hf mf autopwn` - reports failed emulator memory transfers, fills and file saves, keeps the trailers' access bits (@matrix) - Fixed `hf mf autopwn` - a failed attack keeps the keys found so far, the dump is saved without the card, Mini dump size (@matrix) - Fixed `hf mf autopwn` - Enter stops the dictionary, `-k` buffer overflow, memory leaks (@matrix) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index aaf4fb901..e428cfe3a 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -2450,6 +2450,7 @@ static int CmdHF15Dump(const char *Cmd) { PrintAndLogEx(SUCCESS, "Reading memory"); int blocknum = 0; + bool end_of_memory = false; for (int retry = 0; (retry < 2 && blocknum < tag->pagesCount); retry++) { if (used_uid) { @@ -2483,6 +2484,7 @@ static int CmdHF15Dump(const char *Cmd) { // heuristic determine end of available memory if (d[1] == 0x0F || d[1] == 0x10) { + end_of_memory = true; break; } @@ -2508,6 +2510,19 @@ static int CmdHF15Dump(const char *Cmd) { // done reading tag memory + // The tag has no more blocks than this, the rest of the default range doesn't exist + if (end_of_memory) { + tag->pagesCount = blocknum; + } + + // Anything else that ended the loop early left the remaining blocks unread. They + // must not be shown as data, nor saved as a dump + bool incomplete = (blocknum < tag->pagesCount); + uint32_t expected = tag->pagesCount; + if (incomplete) { + tag->pagesCount = blocknum; + } + if (tag->bytesPerPage != blocksize) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, _YELLOW_("%u") " bytes block length detected, called with " _YELLOW_("%d"), tag->bytesPerPage, blocksize); @@ -2516,6 +2531,14 @@ static int CmdHF15Dump(const char *Cmd) { print_tag_15693(tag, dense_output, verbose); + if (incomplete) { + PrintAndLogEx(WARNING, "Dump " _RED_("incomplete") ", read %d of %u blocks, not saved", blocknum, expected); + PrintAndLogEx(HINT, "Hint: reposition the card and run the dump again"); + PrintAndLogEx(NORMAL, ""); + free(tag); + return PM3_EPARTIAL; + } + if (no_save) { PrintAndLogEx(INFO, "Called with no save option"); PrintAndLogEx(NORMAL, "");