From fee9648b530bf7fa23801d5b2581aa11d62d1075 Mon Sep 17 00:00:00 2001 From: Mistial Developer Date: Wed, 16 Sep 2026 12:02:10 -0700 Subject: [PATCH] hf mfdes etest: place the command doc entry at top level, state the draw order The regenerated `hf mfdes etest` object had been spliced inside the `hf mfdes esave` object in doc/commands.json, so catalog consumers did not see it. Moved by hand to its place among the commands, matching what `make commands` produces for that entry. Help and how-to said a recorded session replays byte for byte. It does only when the queue is filled in draw order: the random UID takes 3 bytes at --scan on a random-id image, then each authentication takes its RndB. Say so. Co-Authored-By: Claude Fable 5.1 (claude-fable-5-1) --- client/src/cmdhfmfdes.c | 4 ++-- doc/commands.json | 18 +++++++++--------- doc/desfire.md | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index fdf37fd9a..da872445b 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -9260,8 +9260,8 @@ static int CmdHF14ADesETest(const char *Cmd) { "Drive the DESFire simulation from the host over USB, no RF involved.\n" "The card image in emulator memory answers each --apdu, native or ISO 7816\n" "wrapped, as `hf mfdes sim` would over the air. Bytes given with --random are\n" - "used for the next RndB and random UID draws, so a recorded session replays\n" - "byte for byte.\n" + "drawn in order by the next random UID (3, at --scan on a random-id image) and\n" + "RndB (8 or 16, at the next authentication), so a recorded session can be replayed.\n" "\n" "One action per call. Load an image first with `hf mfdes eload`", "hf mfdes etest --begin\n" diff --git a/doc/commands.json b/doc/commands.json index dd6b32234..d3d433ced 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -7899,9 +7899,17 @@ "hf mfdes esave -f myfile --keep -> keep applications and files a reader deleted" ], "offline": false, + "options": [ + "-h, --help This help", + "-f, --file Filename, if no UID will be used as filename", + "-v, --verbose Verbose output", + "--keep Keep applications and files that were deleted" + ], + "usage": "hf mfdes esave [-hv] [-f ] [--keep]" + }, "hf mfdes etest": { "command": "hf mfdes etest", - "description": "Drive the DESFire simulation from the host over USB, no RF involved. The card image in emulator memory answers each --apdu, native or ISO 7816 wrapped, as `hf mfdes sim` would over the air. Bytes given with --random are used for the next RndB and random UID draws, so a recorded session replays byte for byte. One action per call. Load an image first with `hf mfdes eload`", + "description": "Drive the DESFire simulation from the host over USB, no RF involved. The card image in emulator memory answers each --apdu, native or ISO 7816 wrapped, as `hf mfdes sim` would over the air. Bytes given with --random are drawn in order by the next random UID (3, at --scan on a random-id image) and RndB (8 or 16, at the next authentication), so a recorded session can be replayed. One action per call. Load an image first with `hf mfdes eload`", "notes": [ "hf mfdes etest --begin", "hf mfdes etest --scan", @@ -7923,14 +7931,6 @@ "-j, --json One line of JSON instead of text" ], "usage": "hf mfdes etest [-hj] [--begin] [--end] [--scan] [--apdu ] [--random ] [--fieldoff] [--state]" - }, - "options": [ - "-h, --help This help", - "-f, --file Filename, if no UID will be used as filename", - "-v, --verbose Verbose output", - "--keep Keep applications and files that were deleted" - ], - "usage": "hf mfdes esave [-hv] [-f ] [--keep]" }, "hf mfdes eview": { "command": "hf mfdes eview", diff --git a/doc/desfire.md b/doc/desfire.md index 937f57181..9aadaf70b 100644 --- a/doc/desfire.md +++ b/doc/desfire.md @@ -602,7 +602,7 @@ Switch LRP mode on `hf mfdes etest --end` - drop the state and the random queue -The simulation normally uses a fixed RndB. Queued bytes are drawn in order by the next authentication and by the next activation of a random-id card (3 bytes). A draw that finds the queue short takes nothing, falls back to the fixed value and sets the underflow flag `--state` shows. +The simulation normally uses a fixed RndB and a tick-derived random UID. Queued bytes are drawn in order: `--scan` takes 3 for the UID when the image has random ID switched on, then each authentication takes its RndB, 8 or 16 bytes by key type. On a random-id image queue the UID bytes before `--scan` and the RndB before the authentication; queuing only the RndB first would spend it on the UID. A draw that finds the queue short takes nothing, falls back to the fixed or tick-derived value and sets the underflow flag `--state` shows. `hf mfdes etest --apdu 900A0000010000 -j` - the same, as one line of JSON for a script