diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index c2ab80b64..ac4fbb1b5 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -5085,10 +5085,14 @@ static int CmdDesGetSessionParameters(CLIParserContext *ctx, DesfireContext *dct if (appid && aid) { *aid = 0x000000; - - //int arg_get_u32_hexstr_def_nlen(CLIParserContext *ctx, uint8_t paramnum, uint32_t def, uint32_t *out, uint8_t nlen, bool optional); - // if (arg_get_u32_hexstr_def_nlen(ctx, appid, 0x000000, aid, 3, true)) - // return PM3_ESOFT; + int res = arg_get_u32_hexstr_def_nlen(ctx, appid, 0x000000, aid, 3, true); + if (res == 0) + return PM3_ESOFT; + if (res == 2) { + PrintAndLogEx(ERR, "AID length must have 3 bytes length"); + return PM3_EINVARG; + } + PrintAndLogEx(INFO, "--aid: %x", *aid); } DesfireSetKey(dctx, keynum, algores, key); @@ -5178,7 +5182,7 @@ static int CmdHF14ADesGetKeySettings(const char *Cmd) { arg_str0("m", "cmode", "", "Communicaton mode: plain/mac/encrypt"), arg_str0("c", "ccset", "", "Communicaton command set: native/niso/iso"), arg_str0("s", "schann", "", "Secure channel: d40/ev1/ev2"), - arg_int0(NULL, "appid", "", "Application ID (HEX 3 bytes)"), + arg_str0(NULL, "appid", "", "Application ID (HEX 3 bytes)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); diff --git a/client/src/mifare/desfirecore.c b/client/src/mifare/desfirecore.c index fd1fe6256..3d09fc58a 100644 --- a/client/src/mifare/desfirecore.c +++ b/client/src/mifare/desfirecore.c @@ -986,8 +986,9 @@ static void PrintKeySettingsPICC(uint8_t keysettings, uint8_t numkeys) { PrintAndLogEx(SUCCESS, "[.%c..] CMK required for create/delete : %s", (keysettings & (1 << 2)) ? '1' : '0', (keysettings & (1 << 2)) ? _GREEN_("NO") : "YES"); PrintAndLogEx(SUCCESS, "[..%c.] Directory list access with CMK : %s", (keysettings & (1 << 1)) ? '1' : '0', (keysettings & (1 << 1)) ? _GREEN_("NO") : "YES"); PrintAndLogEx(SUCCESS, "[...%c] CMK is changeable : %s", (keysettings & (1 << 0)) ? '1' : '0', (keysettings & (1 << 0)) ? _GREEN_("YES") : "NO (frozen)"); + PrintAndLogEx(SUCCESS, ""); - PrintAndLogEx(SUCCESS, "\nkey count: %d", numkeys & 0x0f); + PrintAndLogEx(SUCCESS, "key count: %d", numkeys & 0x0f); } static void PrintKeySettingsApp(uint8_t keysettings, uint8_t numkeys) { @@ -1017,9 +1018,10 @@ static void PrintKeySettingsApp(uint8_t keysettings, uint8_t numkeys) { PrintAndLogEx(SUCCESS, "[.%c..] AMK required for create/delete : %s", (keysettings & (1 << 2)) ? '1' : '0', (keysettings & (1 << 2)) ? "NO" : "YES"); PrintAndLogEx(SUCCESS, "[..%c.] Directory list access with AMK : %s", (keysettings & (1 << 1)) ? '1' : '0', (keysettings & (1 << 1)) ? "NO" : "YES"); PrintAndLogEx(SUCCESS, "[...%c] AMK is changeable : %s", (keysettings & (1 << 0)) ? '1' : '0', (keysettings & (1 << 0)) ? _GREEN_("YES") : "NO (frozen)"); + PrintAndLogEx(SUCCESS, ""); PrintKeyType(numkeys >> 6); - PrintAndLogEx(SUCCESS, "\nkey count: %d", numkeys & 0x0f); + PrintAndLogEx(SUCCESS, "key count: %d", numkeys & 0x0f); } void PrintKeySettings(uint8_t keysettings, uint8_t numkeys, bool applevel) {