From 3ec375ab41c1ae50057f2d11c7a6f61e1ab6b678 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sat, 20 Sep 2025 21:37:57 +0200 Subject: [PATCH] hf 14b info: add ATR fingerprinting --- CHANGELOG.md | 2 +- client/src/cmdhf14b.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a7dce0cb..94795cd30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +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] -- Added ATR fingerprinting to `hf 14a info` (@doegox) +- Added ATR fingerprinting to `hf 14a/14b info` (@doegox) ## [Phrack.4.20728][2025-09-11] - Change `lf t55xx restore` - now skips writing block0 if its all zeros (@iceman1001) diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c index d64d200a7..f90f01b55 100644 --- a/client/src/cmdhf14b.c +++ b/client/src/cmdhf14b.c @@ -34,7 +34,8 @@ #include "aidsearch.h" #include "fileutils.h" // saveFile #include "iclass_cmd.h" // picopass defines -#include "cmdhf.h" // handle HF plot +#include "cmdhf.h" // handle HF plot +#include "atrs.h" // atqbToEmulatedAtr #define MAX_14B_TIMEOUT_MS (4949U) @@ -467,8 +468,8 @@ static int print_atqb_resp(uint8_t *data, uint8_t cid) { PrintAndLogEx(SUCCESS, " CID : %u", cid & 0x0f); PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "--- " _CYAN_("Fingerprint")); if (memcmp(data, "\x54\x43\x4F\x53", 4) == 0) { + PrintAndLogEx(INFO, "--- " _CYAN_("Fingerprint") " -------------------------------"); int outlen = 0; uint8_t out[PM3_CMD_DATA_SIZE] = {0}; @@ -483,7 +484,17 @@ static int print_atqb_resp(uint8_t *data, uint8_t cid) { } } else { - PrintAndLogEx(INFO, "n/a"); + PrintAndLogEx(INFO, "--- " _CYAN_("ATR fingerprint") " ---------------------------"); + uint8_t atr[256] = {0}; + int atrLen = 0; + atqbToEmulatedAtr(data, cid, atr, &atrLen); + char *copy = str_dup(getAtrInfo(sprint_hex_inrow(atr, atrLen))); + char *token = strtok(copy, "\n"); + while (token != NULL) { + PrintAndLogEx(INFO, " %s", token); + token = strtok(NULL, "\n"); + } + free(copy); } PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS;