From 50a1c63470536d96d59403f81711b341f5bf77f5 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 4 Jan 2024 19:49:59 +0100 Subject: [PATCH] improved the SEOS annotation, also added a trace file to look at --- client/src/cmdhflist.c | 37 ++++++++++++++++++++--- client/src/cmdhfseos.c | 2 +- traces/hf_seos_sniff_fc60_cn640001.trace | Bin 0 -> 1374 bytes 3 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 traces/hf_seos_sniff_fc60_cn640001.trace diff --git a/client/src/cmdhflist.c b/client/src/cmdhflist.c index aaecb3e52..2765363fd 100644 --- a/client/src/cmdhflist.c +++ b/client/src/cmdhflist.c @@ -1685,10 +1685,39 @@ void annotateSeos(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) { // it's basically a ISO14443a tag, so try annotation from there if (applyIso14443a(exp, size, cmd, cmdsize, false) != PM3_SUCCESS) { -// switch (cmd[0]) { -// default: -// break; -// }; + int pos = 0; + switch (cmd[0]) { + case 2: + case 3: + pos = 2; + break; + case 0: + pos = 1; + break; + default: + pos = 2; + break; + } + + if (memcmp(cmd + pos, "\x00\xa4\x04\x00\x0a", 5) == 0) { + snprintf(exp, size, "SELECT AID"); + } + + if (memcmp(cmd + pos, "\x80\xA5\x04\x00", 4) == 0) { + snprintf(exp, size, "SELECT ADF / OID"); + } + + if (memcmp(cmd + pos, "\x00\x87\x00\x01\x04\x7c\x02\x81\x00", 9) == 0) { + snprintf(exp, size, "GET CHALLENGE"); + } + + if (memcmp(cmd + pos, "\x00\x87\x00\x01\x2c", 5) == 0) { + snprintf(exp, size, "MUTUAL AUTHENTICATION"); + } + + if (memcmp(cmd + pos, "\x0c\xcb\x3f\xff", 4) == 0) { + snprintf(exp, size, "GET DATA"); + } // apply ISO7816 annotations? // if (annotateIso7816(exp, size, cmd, cmdsize) == 0) { diff --git a/client/src/cmdhfseos.c b/client/src/cmdhfseos.c index 896157be4..4ab7c1b15 100644 --- a/client/src/cmdhfseos.c +++ b/client/src/cmdhfseos.c @@ -112,7 +112,7 @@ static int CmdHfSeosInfo(const char *Cmd) { } static int CmdHfSeosList(const char *Cmd) { - return CmdTraceListAlias(Cmd, "hf seos", "7816"); + return CmdTraceListAlias(Cmd, "hf seos", "seos -c"); } static command_t CommandTable[] = { diff --git a/traces/hf_seos_sniff_fc60_cn640001.trace b/traces/hf_seos_sniff_fc60_cn640001.trace new file mode 100644 index 0000000000000000000000000000000000000000..78c6d60560e31fc57849615d5708fbf728b166c7 GIT binary patch literal 1374 zcmbRIdjrD*W=4h}hUD1eP!_ZB11Rh9r*BZ!a-Z(yw`Z(y2Z_3ZI1KE?-PtPB?f8G@E&i0|NIJiyD`aG|(e z;qoD2#syI#3|tHhOIR4V7BDcdI503WGB7e^={!G~&>kql*bpVsz{QZy(}E;Bfgyj% z|49!Pi-DCcVySwT%x~ z)cUMBKknB2eyCr=dF1WpK90Z(LXPJH8COkU;MwQGsk6;2>z7wwO>mqnV}d;&$Q$hp zj4U-wjSLKPdVkckbILI~1PV29G1PE1a#RURXH_oZlAgfelzij-f#Nwzj0--SF>o_5 zv@T?1~BGH>S`TH^m z=~omyVL9cpgPl)@vEiXn12+Rm|7!KibwBy0h24yHX}15iWNyc4Fzjga&Dpf;{P~8@kMtQ6CMYm)G4PzW|1Z|c(W$3btX&qOI-Q}9 z@L2f z*_`r#xTI-*>LE(feA3pkEoF11=v^O$Rk_cj4}UNF#2n^1i_Oirr!nq_gvCd{@YkpL z-Huf*tz!FG!1C&-&^i--r>;4D9KxcJu|H#Nbtf>eA9YzURXQj%;%rw*@akvSlV;d+ z#s+xOWcjT0_)(AS{Rs?795+`pe17&CJ!$gRtZDyYJx{^b``h-E`>sMBn)+?Fw!vYs zi$C@XN%Ef-tL=R=>)eDt3 zFW#=LzB-!MF7d;o@RxVEcX)Z7PYIUzeBzl9C-2gxuO(?`TOmpFn%mL7*4+JjCNO+o Qbk;UlqQYRh`RN`50Oig7;s5{u literal 0 HcmV?d00001