From 7484af6c87d04bbd0b2418724994dcd65fcf0381 Mon Sep 17 00:00:00 2001 From: kormax <3392860+kormax@users.noreply.github.com> Date: Sun, 3 May 2026 08:08:15 +0300 Subject: [PATCH] Drop old 'hf 14b calypso' and 'hf 14b mobib' commands --- client/src/cmdhf14b.c | 286 -------------------------------- client/src/pm3line_vocabulary.h | 2 - doc/commands.json | 27 +-- doc/commands.md | 2 - 4 files changed, 1 insertion(+), 316 deletions(-) diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c index 7f231e4ea..11533c706 100644 --- a/client/src/cmdhf14b.c +++ b/client/src/cmdhf14b.c @@ -59,13 +59,6 @@ #define ST25_SIZE_4K 5 -typedef struct { - const char *desc; - const char *apdu; - const uint8_t apdulen; -} transport_14b_apdu_t; - - // iso14b apdu input frame length static uint16_t apdu_frame_length = 0; //static uint16_t ats_fsc[] = {16, 24, 32, 40, 48, 64, 96, 128, 256}; @@ -2919,282 +2912,6 @@ static int CmdHF14BView(const char *Cmd) { return PM3_SUCCESS; } -static int CmdHF14BCalypsoRead(const char *Cmd) { - - CLIParserContext *ctx; - CLIParserInit(&ctx, "hf 14b calypso", - "Reads out the contents of a ISO14443B Calypso card\n", - "hf 14b calypso" - ); - void *argtable[] = { - arg_param_begin, - arg_param_end - }; - CLIExecWithReturn(ctx, Cmd, argtable, true); - CLIParserFree(ctx); - - transport_14b_apdu_t cmds[] = { - {"Select ICC", "\x94\xa4\x08\x00\x04\x3f\x00\x00\x02", 9}, - {"- ICC", "\x94\xb2\x01\x04\x1d", 5}, - {"Select EnvHol", "\x94\xa4\x08\x00\x04\x20\x00\x20\x01", 9}, - {"- EnvHol1", "\x94\xb2\x01\x04\x1d", 5}, - {"Select EvLog", "\x94\xa4\x08\x00\x04\x20\x00\x20\x10", 9}, - {"- EvLog1", "\x94\xb2\x01\x04\x1d", 5}, - {"- EvLog2", "\x94\xb2\x02\x04\x1d", 5}, - {"- EvLog3", "\x94\xb2\x03\x04\x1d", 5}, - {"Select ConList", "\x94\xa4\x08\x00\x04\x20\x00\x20\x50", 9}, - {"- ConList", "\x94\xb2\x01\x04\x1d", 5}, - {"Select Contra", "\x94\xa4\x08\x00\x04\x20\x00\x20\x20", 9}, - {"- Contra1", "\x94\xb2\x01\x04\x1d", 5}, - {"- Contra2", "\x94\xb2\x02\x04\x1d", 5}, - {"- Contra3", "\x94\xb2\x03\x04\x1d", 5}, - {"- Contra4", "\x94\xb2\x04\x04\x1d", 5}, - {"Select Counter", "\x94\xa4\x08\x00\x04\x20\x00\x20\x69", 9}, - {"- Counter", "\x94\xb2\x01\x04\x1d", 5}, - {"Select SpecEv", "\x94\xa4\x08\x00\x04\x20\x00\x20\x40", 9}, - {"- SpecEv1", "\x94\xb2\x01\x04\x1d", 5}, - {"Select Purse", "\x00\xa4\x00\x00\x02\x10\x15", 7}, - {"- Purse1", "\x00\xb2\x01\x04\x1d", 5}, - {"- Purse2", "\x00\xb2\x02\x04\x1d", 5}, - {"- Purse3", "\x00\xb2\x03\x04\x1d", 5}, - {"Select Top Up", "\x00\xa4\x00\x00\x02\x10\x14", 7}, - {"- Topup1", "\x00\xb2\x01\x04\x1d", 5}, - {"Select 1TIC.ICA", "\x00\xa4\x04\x00\x08\x31\x54\x49\x43\x2e\x49\x43\x41", 13}, - }; - - /* - local CLA = '94' - local _calypso_cmds = { - - -- Break down of command bytes: - -- A4 = select - -- Master File 3F00 - -- 0x3F = master file - -- 0x00 = master file id, is constant to 0x00. - - -- DF Dedicated File 38nn - -- can be seen as directories - -- 0x38 - -- 0xNN id - -- ["01.Select ICC file"] = '0294 a4 080004 3f00 0002', - - -- EF Elementary File - -- EF1 Pin file - -- EF2 Key file - -- Grey Lock file - -- Electronic deposit file - -- Electronic Purse file - -- Electronic Transaction log file - */ - bool activate_field = true; - bool leave_signal_on = true; - uint8_t response[PM3_CMD_DATA_SIZE] = { 0x00 }; - - for (int i = 0; i < ARRAYLEN(cmds); i++) { - - int user_timeout = -1; - int resplen = 0; - int res = exchange_14b_apdu( - (uint8_t *)cmds[i].apdu, - cmds[i].apdulen, - activate_field, - leave_signal_on, - response, - PM3_CMD_DATA_SIZE, - &resplen, - user_timeout - ); - - if (res != PM3_SUCCESS) { - PrintAndLogEx(FAILED, "sending command failed, aborting!"); - switch_off_field_14b(); - return res; - } - - uint16_t sw = get_sw(response, resplen); - if (sw == ISO7816_OK) { - PrintAndLogEx(SUCCESS, "%-22s - %s", cmds[i].desc, sprint_hex(response, resplen - 2)); - } else { - PrintAndLogEx(INFO, "%-22s - Sending command failed (%04x - %s).", cmds[i].desc, sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff)); - } - - activate_field = false; - } - - switch_off_field_14b(); - return PM3_SUCCESS; -} - -static int CmdHF14BMobibRead(const char *Cmd) { - - CLIParserContext *ctx; - CLIParserInit(&ctx, "hf 14b mobib", - "Reads out the contents of a ISO14443B Mobib card\n", - "hf 14b mobib" - ); - void *argtable[] = { - arg_param_begin, - arg_lit0("o", "old", "for old cards"), - arg_param_end - }; - CLIExecWithReturn(ctx, Cmd, argtable, true); - bool old = arg_get_lit(ctx, 1); - CLIParserFree(ctx); - - transport_14b_apdu_t cmds_v1[] = { - {"SELECT AID 1TIC.ICA", "\x00\xa4\x04\x00\x08\x31\x54\x49\x43\x2e\x49\x43\x41", 13}, - {"Select ICC file a", "\x00\xa4\x00\x00\x02\x3f\x00", 7}, - {"Select ICC file b", "\x00\xa4\x00\x00\x02\x00\x02", 7}, - {"- ICC", "\x00\xb2\x01\x04\x1d", 5}, - {"Select Holder file", "\x00\xa4\x00\x00\x02\x3f\x1c", 7}, - {"- Holder1", "\x00\xb2\x01\x04\x1d", 5}, - {"- Holder2", "\x00\xb2\x02\x04\x1d", 5}, - {"Select EnvHol file a", "\x00\xa4\x00\x00\x00", 5}, - {"Select EnvHol file b", "\x00\xa4\x00\x00\x02\x20\x00", 7}, - {"Select EnvHol file c", "\x00\xa4\x00\x00\x02\x20\x01", 7}, - {"- EnvHol1", "\x00\xb2\x01\x04\x1D", 5}, - {"- EnvHol2", "\x00\xb2\x02\x04\x1D", 5}, - {"Select EvLog file", "\x00\xa4\x00\x00\x02\x20\x10", 7}, - {"- EvLog1", "\x00\xb2\x01\x04\x1D", 5}, - {"- EvLog2", "\x00\xb2\x02\x04\x1D", 5}, - {"- EvLog3", "\x00\xb2\x03\x04\x1D", 5}, - {"Select ConList file", "\x00\xa4\x00\x00\x02\x20\x50", 7}, - {"- ConList", "\x00\xb2\x01\x04\x1D", 5}, - {"Select Contra file", "\x00\xa4\x00\x00\x02\x20\x20", 7}, - {"- Contra1", "\x00\xb2\x01\x04\x1D", 5}, - {"- Contra2", "\x00\xb2\x02\x04\x1D", 5}, - {"- Contra3", "\x00\xb2\x03\x04\x1D", 5}, - {"- Contra4", "\x00\xb2\x04\x04\x1D", 5}, - {"- Contra5", "\x00\xb2\x05\x04\x1D", 5}, - {"- Contra6", "\x00\xb2\x06\x04\x1D", 5}, - {"- Contra7", "\x00\xb2\x07\x04\x1D", 5}, - {"- Contra8", "\x00\xb2\x08\x04\x1D", 5}, - {"- Contra9", "\x00\xb2\x09\x04\x1D", 5}, - {"- ContraA", "\x00\xb2\x0a\x04\x1D", 5}, - {"- ContraB", "\x00\xb2\x0b\x04\x1D", 5}, - {"- ContraC", "\x00\xb2\x0c\x04\x1D", 5}, - {"Select Counter file", "\x00\xa4\x00\x00\x02\x20\x69", 7}, - {"- Counter", "\x00\xb2\x01\x04\x1D", 5}, - {"Select LoadLog file a", "\x00\xa4\x00\x00\x00", 5}, - {"Select LoadLog file b", "\x00\xa4\x00\x00\x02\x10\x00", 7}, - {"Select LoadLog file c", "\x00\xa4\x00\x00\x02\x10\x14", 7}, - {"- LoadLog", "\x00\xb2\x01\x04\x1D", 5}, - {"Select Purcha file", "\x00\xa4\x00\x00\x02\x10\x15", 7}, - {"- Purcha1", "\x00\xb2\x01\x04\x1D", 5}, - {"- Purcha2", "\x00\xb2\x02\x04\x1D", 5}, - {"- Purcha3", "\x00\xb2\x03\x04\x1D", 5}, - {"Select SpecEv file a", "\x00\xa4\x00\x00\x00", 5}, - {"Select SpecEv file b", "\x00\xa4\x00\x00\x02\x20\x00", 7}, - {"Select SpecEv file c", "\x00\xa4\x00\x00\x02\x20\x40", 7}, - {"- SpecEv1", "\x00\xb2\x01\x04\x1D", 5}, - {"- SpecEv2", "\x00\xb2\x02\x04\x1D", 5}, - {"- SpecEv3", "\x00\xb2\x03\x04\x1D", 5}, - {"- SpecEv4", "\x00\xb2\x04\x04\x1d", 5}, - }; - transport_14b_apdu_t cmds_v2[] = { - {"SELECT AID ??", "\x00\xa4\x04\x00\x0b\xa0\x00\x00\x02\x91\xd0\x56\x00\x01\x90\x01", 16}, - // ShortEF=02: ICC - {"- ICC", "\x00\xb2\x01\x14\x1d", 5}, - // ShortEF=06: ??, records length up to 0x20? - //{"- ShortEF=06", "\x00\xb2\x01\x34\x1d", 5}, - // ShortEF=1C: Holder, records length up to 0x30? - {"- Holder1", "\x00\xb2\x01\xe4\x1d", 5}, - {"- Holder2", "\x00\xb2\x02\xe4\x1d", 5}, // extra - {"SELECT AID 1TIC.ICA", "\x00\xa4\x04\x00\x0e\x31\x54\x49\x43\x2e\x49\x43\x41\xd0\x56\x00\x01\x91\x01\x00", 20}, - // ShortEF=09: Contracts - {"- Contra1", "\x00\xb2\x01\x4c\x1d", 5}, - {"- Contra2", "\x00\xb2\x02\x4c\x1d", 5}, - {"- Contra3", "\x00\xb2\x03\x4c\x1d", 5}, - {"- Contra4", "\x00\xb2\x04\x4c\x1d", 5}, - {"- Contra5", "\x00\xb2\x05\x4c\x1d", 5}, - {"- Contra6", "\x00\xb2\x06\x4c\x1d", 5}, - {"- Contra7", "\x00\xb2\x07\x4c\x1d", 5}, - {"- Contra8", "\x00\xb2\x08\x4c\x1d", 5}, - {"- Contra9", "\x00\xb2\x09\x4c\x1d", 5}, - {"- ContraA", "\x00\xb2\x0a\x4c\x1d", 5}, // extra - {"- ContraB", "\x00\xb2\x0b\x4c\x1d", 5}, // extra - {"- ContraC", "\x00\xb2\x0c\x4c\x1d", 5}, // extra - // ShortEF=19: Counter, length up to 0x24? - {"- Counter", "\x00\xb2\x01\xcc\x1d", 5}, - // ShortEF=17: Events - // ShortEF=1d: Special Events - {"- ? Ev1", "\x00\xb2\x01\xbc\x1d", 5}, - {"- SpecEv1", "\x00\xb2\x01\xec\x1d", 5}, - {"- ? Ev2", "\x00\xb2\x02\xbc\x1d", 5}, - {"- SpecEv2", "\x00\xb2\x02\xec\x1d", 5}, - {"- ? Ev3", "\x00\xb2\x03\xbc\x1d", 5}, - {"- SpecEv3", "\x00\xb2\x03\xec\x1d", 5}, - {"- ? Ev4", "\x00\xb2\x04\xbc\x1d", 5}, - {"- SpecEv4", "\x00\xb2\x04\xec\x1d", 5}, - // ShortEF=16: Contract Extensions - //{"- ? ContraExt", "\x00\xb2\x0c\x4c\x1d", 5}, == ContraC - {"- ? ContraExt1", "\x00\xb2\x01\xb4\x1d", 5}, - {"- ? ContraExt2", "\x00\xb2\x02\xb4\x1d", 5}, - {"- ? ContraExt3", "\x00\xb2\x03\xb4\x1d", 5}, - {"- ? ContraExt4", "\x00\xb2\x04\xb4\x1d", 5}, - {"- ? ContraExt5", "\x00\xb2\x05\xb4\x1d", 5}, - {"- ? ContraExt6", "\x00\xb2\x06\xb4\x1d", 5}, - {"- ? ContraExt7", "\x00\xb2\x07\xb4\x1d", 5}, - {"- ? ContraExt8", "\x00\xb2\x08\xb4\x1d", 5}, - // ShortEF=1E: Best Contract?, length up to 0x30? - {"- ConList", "\x00\xb2\x01\xf4\x1d", 5}, - // ShortEF=01: ??, 1 records length up to 0x30? - // ShortEF=07: ??, 2 records length up to 0x30? - {"- ShortEF=07, rec1", "\x00\xb2\x01\x3c\x1d", 5}, - {"- ShortEF=07, rec2", "\x00\xb2\x02\x3c\x1d", 5}, - // ShortEF=08: ??, 3 records length up to 0x30? - // ShortEF=10: ??, 1 records length up to 0x24? - // ShortEF=11: ??, 1 records length up to 0x30? - // ShortEF=12: ??, 12 records length up to 0x15? - // ShortEF=13: ??, 4 records length up to 0x30? - // ShortEF=14: ??, 1 records length up to 0x20? - // ShortEF=15: ??, 8 records length up to 0x40? - // ShortEF=18: ??, 8 records length up to 0x40? - // ShortEF=1A: ??, 8 records length up to 0x30? - // ShortEF=1B: ??, 1 records length up to 0x18? - // ShortEF=1C: ??, 1 records length up to 0x18? - }; - bool activate_field = true; - bool leave_signal_on = true; - uint8_t response[PM3_CMD_DATA_SIZE] = { 0x00 }; - - transport_14b_apdu_t *cmds = old ? cmds_v1 : cmds_v2; - int cmds_count = old ? ARRAYLEN(cmds_v1) : ARRAYLEN(cmds_v2); - - for (int i = 0; i < cmds_count; i++) { - - int user_timeout = -1; - int resplen = 0; - int res = exchange_14b_apdu( - (uint8_t *)cmds[i].apdu, - cmds[i].apdulen, - activate_field, - leave_signal_on, - response, - PM3_CMD_DATA_SIZE, - &resplen, - user_timeout - ); - - if (res != PM3_SUCCESS) { - PrintAndLogEx(FAILED, "sending command failed, aborting!"); - switch_off_field_14b(); - return res; - } - - uint16_t sw = get_sw(response, resplen); - if (sw == ISO7816_OK) { - PrintAndLogEx(SUCCESS, "%-22s - %s", cmds[i].desc, sprint_hex(response, resplen - 2)); - } else { - PrintAndLogEx(INFO, "%-22s - Sending command failed (%04x - %s).", cmds[i].desc, sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff)); - } - activate_field = false; - } - - switch_off_field_14b(); - return PM3_SUCCESS; -} - static int CmdHF14BSriTearoff(const char *Cmd) { CLIParserContext *ctx; @@ -3423,9 +3140,6 @@ static command_t CommandTable[] = { {"tearoff", CmdHF14BSriTearoff, IfPm3Iso14443b, "Tear-off attack on ST25TB/SRx counter blocks"}, {"view", CmdHF14BView, AlwaysAvailable, "Display content from tag dump file"}, {"valid", CmdSRIX4kValid, AlwaysAvailable, "SRIX4 checksum test"}, - {"---------", CmdHelp, AlwaysAvailable, "------------------ " _CYAN_("Calypso / Mobib") " ------------------"}, - {"calypso", CmdHF14BCalypsoRead, IfPm3Iso14443b, "Read contents of a Calypso card"}, - {"mobib", CmdHF14BMobibRead, IfPm3Iso14443b, "Read contents of a Mobib card"}, {"---------", CmdHelp, IfPm3Iso14443b, "------------------------- " _CYAN_("Magic") " -----------------------"}, {"setuid", CmdHF14BSetUID, IfPm3Iso14443b, "Set UID for magic card"}, {NULL, NULL, NULL, NULL} diff --git a/client/src/pm3line_vocabulary.h b/client/src/pm3line_vocabulary.h index 44a0ff5fc..712dd1774 100644 --- a/client/src/pm3line_vocabulary.h +++ b/client/src/pm3line_vocabulary.h @@ -183,8 +183,6 @@ const static vocabulary_t vocabulary[] = { { 0, "hf 14b tearoff" }, { 1, "hf 14b view" }, { 1, "hf 14b valid" }, - { 0, "hf 14b calypso" }, - { 0, "hf 14b mobib" }, { 0, "hf 14b setuid" }, { 1, "hf 15 help" }, { 1, "hf 15 list" }, diff --git a/doc/commands.json b/doc/commands.json index b937bb6cd..3929a090f 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -1501,18 +1501,6 @@ ], "usage": "hf 14b apdu [-hskte] [--decode] [-m ] [-l ] -d [--timeout ]" }, - "hf 14b calypso": { - "command": "hf 14b calypso", - "description": "Reads out the contents of a ISO14443B Calypso card", - "notes": [ - "hf 14b calypso" - ], - "offline": false, - "options": [ - "-h, --help This help" - ], - "usage": "hf 14b calypso [-h]" - }, "hf 14b dump": { "command": "hf 14b dump", "description": "This command dumps the contents of a ISO-14443-B tag and save it to file Tries to autodetect cardtype, memory size defaults to SRI4K", @@ -1531,7 +1519,7 @@ }, "hf 14b help": { "command": "hf 14b help", - "description": "--------- ----------------------- General ----------------------- help This help list List ISO-14443-B history --------- ----------------------- Operations ----------------------- view Display content from tag dump file valid SRIX4 checksum test --------- ------------------ Calypso / Mobib ------------------ --------------------------------------------------------------------------------------- hf 14b config available offline: no --------------------------------------------------------------------------------------- hf 14b list available offline: yes Alias of `trace list -t 14b -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", + "description": "--------- ----------------------- General ----------------------- help This help list List ISO-14443-B history --------- ----------------------- Operations ----------------------- view Display content from tag dump file valid SRIX4 checksum test --------------------------------------------------------------------------------------- hf 14b config available offline: no --------------------------------------------------------------------------------------- hf 14b list available offline: yes Alias of `trace list -t 14b -c` with selected protocol data to annotate trace buffer You can load a trace from file (see `trace load -h`) or it be downloaded from device by default It accepts all other arguments of `trace list`. Note that some might not be relevant for this specific protocol", "notes": [ "hf 14b list --frame -> show frame delay times", "hf 14b list -1 -> use trace buffer" @@ -1564,19 +1552,6 @@ ], "usage": "hf 14b info [-hsv]" }, - "hf 14b mobib": { - "command": "hf 14b mobib", - "description": "Reads out the contents of a ISO14443B Mobib card", - "notes": [ - "hf 14b mobib" - ], - "offline": false, - "options": [ - "-h, --help This help", - "-o, --old for old cards" - ], - "usage": "hf 14b mobib [-ho]" - }, "hf 14b ndefread": { "command": "hf 14b ndefread", "description": "Print NFC Data Exchange Format (NDEF)", diff --git a/doc/commands.md b/doc/commands.md index 298b7d865..30d4d73f2 100644 --- a/doc/commands.md +++ b/doc/commands.md @@ -234,8 +234,6 @@ Check column "offline" for their availability. |`hf 14b tearoff `|N |`Tear-off attack on ST25TB/SRx counter blocks` |`hf 14b view `|Y |`Display content from tag dump file` |`hf 14b valid `|Y |`SRIX4 checksum test` -|`hf 14b calypso `|N |`Read contents of a Calypso card` -|`hf 14b mobib `|N |`Read contents of a Mobib card` |`hf 14b setuid `|N |`Set UID for magic card`