From 2790bc0c16933fc7710291d92ce05e20d051a8ed Mon Sep 17 00:00:00 2001 From: Antiklesys Date: Fri, 20 Oct 2023 20:30:16 +0800 Subject: [PATCH] Modified hf iclass calcnewkey Added support for a scenario in which the old key is elite and the new key is not elite. --- CHANGELOG.md | 1 + client/src/cmdhficlass.c | 6 ++++++ doc/commands.json | 6 +++--- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe36c3236f..a9336c3524 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] + - Modified `hf iclass calcnewkey` - Added calculations for old key elite and new key non elite (@Antiklesys) - Changed the CLI prompt to show tcp/udp if used (@iceman1001) - Changed `hw ping` - now shows transfer time (@doegox) - Added `hf mf encodehid` - writes HID legacy credential to a empty MFC (@iceman1001) diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 19a319db53..2a66634ace 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -3215,6 +3215,7 @@ static int CmdHFiClassCalcNewKey(const char *Cmd) { arg_str0(NULL, "csn", "", "Specify a Card Serial Number (CSN) to diversify the key (if omitted will attempt to read a CSN)"), arg_lit0(NULL, "elite", "Elite computations applied to new key"), arg_lit0(NULL, "elite2", "Elite computations applied to both old and new key"), + arg_lit0(NULL, "oldelite", "Elite computations applied only to old key"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -3307,6 +3308,11 @@ static int CmdHFiClassCalcNewKey(const char *Cmd) { old_elite = true; } + if (arg_get_lit(ctx, 8)) { + elite = false; + old_elite = true; + } + CLIParserFree(ctx); uint8_t xor_div_key[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/doc/commands.json b/doc/commands.json index 7e27429f13..96ecb5e320 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -2986,10 +2986,10 @@ "--new Specify key as 8 hex bytes", "--nki New key index to select key from memory 'hf iclass managekeys'", "--csn Specify a Card Serial Number (CSN) to diversify the key (if omitted will attempt to read a CSN)", - "--elite Elite computations applied to new key", - "--elite2 Elite computations applied to both old and new key" + "--elite2 Elite computations applied to both old and new key", + "--oldelite Elite computations applied only to old key" ], - "usage": "hf iclass calcnewkey [-h] [--old ] [--oki ] [--new ] [--nki ] [--csn ] [--elite] [--elite2]" + "usage": "hf iclass calcnewkey [-h] [--old ] [--oki ] [--new ] [--nki ] [--csn ] [--elite] [--elite2] [--oldelite]" }, "hf iclass chk": { "command": "hf iclass chk",