added skeleton command for ICT

This commit is contained in:
iceman1001 2024-02-01 10:05:04 +01:00
commit 2d4597d89b
5 changed files with 188 additions and 14 deletions

View file

@ -336,6 +336,7 @@ set (TARGET_SOURCES
${PM3_ROOT}/client/src/cmdhfgallagher.c
${PM3_ROOT}/client/src/cmdhfcipurse.c
${PM3_ROOT}/client/src/cmdhficlass.c
${PM3_ROOT}/client/src/cmdhfict.c
${PM3_ROOT}/client/src/cmdhfjooki.c
${PM3_ROOT}/client/src/cmdhfksx6924.c
${PM3_ROOT}/client/src/cmdhflegic.c

View file

@ -612,6 +612,7 @@ SRCS = mifare/aiddesfire.c \
cmdhfksx6924.c \
cmdhfcipurse.c \
cmdhficlass.c \
cmdhfict.c \
cmdhflegic.c \
cmdhfjooki.c \
cmdhflist.c \

View file

@ -25,30 +25,31 @@
#include "cmdhf14a.h" // ISO14443-A
#include "cmdhf14b.h" // ISO14443-B
#include "cmdhf15.h" // ISO15693
#include "cmdhfepa.h"
#include "cmdhfcipurse.h" // CIPURSE transport cards
#include "cmdhfcryptorf.h" // CryptoRF
#include "cmdhfepa.h" // German Identification Card
#include "cmdhfemrtd.h" // eMRTD
#include "cmdhflegic.h" // LEGIC
#include "cmdhffelica.h" // ISO18092 / FeliCa
#include "cmdhffido.h" // FIDO authenticators
#include "cmdhffudan.h" // Fudan cards
#include "cmdhfgallagher.h" // Gallagher DESFire cards
#include "cmdhficlass.h" // ICLASS
#include "cmdhfict.h" // ICT MFC / DESfire cards
#include "cmdhfjooki.h" // MFU based Jooki
#include "cmdhfksx6924.h" // KS X 6924
#include "cmdhflegic.h" // LEGIC
#include "cmdhflto.h" // LTO-CM
#include "cmdhfmf.h" // CLASSIC
#include "cmdhfmfu.h" // ULTRALIGHT/NTAG etc
#include "cmdhfmfp.h" // Mifare Plus
#include "cmdhfmfdes.h" // DESFIRE
#include "cmdhfntag424.h" // NTAG 424 DNA
#include "cmdhftopaz.h" // TOPAZ
#include "cmdhffelica.h" // ISO18092 / FeliCa
#include "cmdhffido.h" // FIDO authenticators
#include "cmdhffudan.h" // Fudan cards
#include "cmdhfgallagher.h" // Gallagher DESFire cards
#include "cmdhfksx6924.h" // KS X 6924
#include "cmdhfcipurse.h" // CIPURSE transport cards
#include "cmdhfthinfilm.h" // Thinfilm
#include "cmdhflto.h" // LTO-CM
#include "cmdhfcryptorf.h" // CryptoRF
#include "cmdhfseos.h" // SEOS
#include "cmdhfst25ta.h" // ST25TA
#include "cmdhftesla.h" // Tesla
#include "cmdhftexkom.h" // Texkom
#include "cmdhfthinfilm.h" // Thinfilm
#include "cmdhftopaz.h" // TOPAZ
#include "cmdhfvas.h" // Value added services
#include "cmdhfwaveshare.h" // Waveshare
#include "cmdhfxerox.h" // Xerox
@ -118,6 +119,19 @@ int CmdHFSearch(const char *Cmd) {
}
}
// ICT
if (IfPm3Iso14443a()) {
int sel_state = infoHF14A(false, false, false);
if (sel_state > 0) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO 14443-A tag") " found\n");
success[ISO_14443A] = true;
res = PM3_SUCCESS;
if (sel_state == 1)
infoHF14A4Applications(verbose);
}
}
PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, " Searching for LEGIC tag...");
if (IfPm3Legicrf()) {
@ -565,9 +579,10 @@ static command_t CommandTable[] = {
{"fido", CmdHFFido, AlwaysAvailable, "{ FIDO and FIDO2 authenticators... }"},
{"fudan", CmdHFFudan, AlwaysAvailable, "{ Fudan RFIDs... }"},
{"gallagher", CmdHFGallagher, AlwaysAvailable, "{ Gallagher DESFire RFIDs... }"},
{"ksx6924", CmdHFKSX6924, AlwaysAvailable, "{ KS X 6924 (T-Money, Snapper+) RFIDs }"},
{"jooki", CmdHF_Jooki, AlwaysAvailable, "{ Jooki RFIDs... }"},
{"iclass", CmdHFiClass, AlwaysAvailable, "{ ICLASS RFIDs... }"},
{"ict", CmdHFICT, AlwaysAvailable, "{ ICT MFC/DESfire RFIDs... }"},
{"jooki", CmdHF_Jooki, AlwaysAvailable, "{ Jooki RFIDs... }"},
{"ksx6924", CmdHFKSX6924, AlwaysAvailable, "{ KS X 6924 (T-Money, Snapper+) RFIDs }"},
{"legic", CmdHFLegic, AlwaysAvailable, "{ LEGIC RFIDs... }"},
{"lto", CmdHFLTO, AlwaysAvailable, "{ LTO Cartridge Memory RFIDs... }"},
{"mf", CmdHFMF, AlwaysAvailable, "{ MIFARE RFIDs... }"},

130
client/src/cmdhfict.c Normal file
View file

@ -0,0 +1,130 @@
//-----------------------------------------------------------------------------
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// See LICENSE.txt for the text of the license.
//-----------------------------------------------------------------------------
// SEOS commands
//-----------------------------------------------------------------------------
#include "cmdhfict.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h> // tolower
#include "cliparser.h"
#include "cmdparser.h" // command_t
#include "comms.h" // clearCommandBuffer
#include "cmdtrace.h"
#include "ui.h"
#include "cmdhf14a.h" // manufacture
#include "protocols.h" // definitions of ISO14A/7816 protocol
#include "iso7816/apduinfo.h" // GetAPDUCodeDescription
#include "commonutil.h" // get_sw
#include "protocols.h" // ISO7816 APDU return codes
static int CmdHelp(const char *Cmd);
static int ict_select(void) {
bool activate_field = true;
bool keep_field_on = true;
uint8_t response[PM3_CMD_DATA_SIZE];
int resplen = 0;
// --------------- Select SEOS applet ----------------
uint8_t aSELECT_AID[80];
int aSELECT_AID_n = 0;
param_gethex_to_eol("00a404000aa000000440000101000100", 0, aSELECT_AID, sizeof(aSELECT_AID), &aSELECT_AID_n);
int res = ExchangeAPDU14a(aSELECT_AID, aSELECT_AID_n, activate_field, keep_field_on, response, sizeof(response), &resplen);
if (res != PM3_SUCCESS) {
DropField();
return res;
}
if (resplen < 2) {
DropField();
return PM3_ESOFT;
}
uint16_t sw = get_sw(response, resplen);
if (sw != ISO7816_OK) {
PrintAndLogEx(ERR, "Selecting SEOS applet aid failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
DropField();
return PM3_ESOFT;
}
activate_field = false;
keep_field_on = false;
// --------------- CC file reading ----------------
uint8_t aSELECT_FILE_ADF[30];
int aSELECT_FILE_ADF_n = 0;
param_gethex_to_eol("80a504001306112b0601040181e43801010201180101020200", 0, aSELECT_FILE_ADF, sizeof(aSELECT_FILE_ADF), &aSELECT_FILE_ADF_n);
res = ExchangeAPDU14a(aSELECT_FILE_ADF, aSELECT_FILE_ADF_n, activate_field, keep_field_on, response, sizeof(response), &resplen);
if (res != PM3_SUCCESS) {
DropField();
return res;
}
sw = get_sw(response, resplen);
if (sw != ISO7816_OK) {
PrintAndLogEx(ERR, "Selecting ADF file failed (%04x - %s).", sw, GetAPDUCodeDescription(sw >> 8, sw & 0xff));
DropField();
return PM3_ESOFT;
}
return PM3_SUCCESS;
}
int infoICT(bool verbose) {
int res = ict_select();
if (res == PM3_SUCCESS) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------");
}
return PM3_SUCCESS;
}
static int CmdHfIctInfo(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "hf ict info",
"Get info from ICT encoded credential tags (MIFARE Classic / DESfire)",
"hf ict info");
void *argtable[] = {
arg_param_begin,
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, true);
CLIParserFree(ctx);
return infoICT(true);
}
static int CmdHfIctList(const char *Cmd) {
return CmdTraceListAlias(Cmd, "hf ict", "14a -c");
}
static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"},
{"info", CmdHfIctInfo, IfPm3NfcBarcode, "Tag information"},
{"list", CmdHfIctList, AlwaysAvailable, "List ICT history"},
{NULL, NULL, NULL, NULL}
};
static int CmdHelp(const char *Cmd) {
(void)Cmd; // Cmd is not used so far
CmdsHelp(CommandTable);
return PM3_SUCCESS;
}
int CmdHFICT(const char *Cmd) {
clearCommandBuffer();
return CmdsParse(CommandTable, Cmd);
}

27
client/src/cmdhfict.h Normal file
View file

@ -0,0 +1,27 @@
//-----------------------------------------------------------------------------
// Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// See LICENSE.txt for the text of the license.
//-----------------------------------------------------------------------------
// ICT commands
//-----------------------------------------------------------------------------
#ifndef CMDHFICT_H__
#define CMDHFICT_H__
#include "common.h"
int infoICT(bool verbose);
int CmdHFICT(const char *Cmd);
#endif