ADD: hooking up the new felica commands

This commit is contained in:
iceman1001 2017-10-10 14:59:58 +02:00
commit 8136decadd
5 changed files with 33 additions and 14 deletions

View file

@ -129,6 +129,7 @@ CMDSRCS = crapto1/crapto1.c \
cmdhfmfdes.c \ cmdhfmfdes.c \
cmdhftopaz.c \ cmdhftopaz.c \
cmdhfemv.c \ cmdhfemv.c \
cmdhffelica.c \
cmdhw.c \ cmdhw.c \
cmdlf.c \ cmdlf.c \
cmdlfawid.c \ cmdlfawid.c \

View file

@ -404,6 +404,12 @@ void annotateLegic(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize){
} }
} }
void annotateFelica(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize){
switch(cmd[0]){
default : snprintf(exp,size ,"?");break;
}
}
/** /**
* @brief iso14443A_CRC_check Checks CRC in command or response * @brief iso14443A_CRC_check Checks CRC in command or response
* @param isResponse * @param isResponse
@ -633,6 +639,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
break; break;
case ISO_14443B: case ISO_14443B:
case TOPAZ: case TOPAZ:
case FELICA:
crcStatus = iso14443B_CRC_check(isResponse, frame, data_len); crcStatus = iso14443B_CRC_check(isResponse, frame, data_len);
break; break;
case ISO_14443A: case ISO_14443A:
@ -701,6 +708,7 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
case TOPAZ: annotateTopaz(explanation,sizeof(explanation),frame,data_len); break; case TOPAZ: annotateTopaz(explanation,sizeof(explanation),frame,data_len); break;
case ISO_7816_4: annotateIso7816(explanation,sizeof(explanation),frame,data_len); break; case ISO_7816_4: annotateIso7816(explanation,sizeof(explanation),frame,data_len); break;
case ISO_15693: annotateIso15693(explanation,sizeof(explanation),frame,data_len); break; case ISO_15693: annotateIso15693(explanation,sizeof(explanation),frame,data_len); break;
case FELICA: annotateFelica(explanation,sizeof(explanation),frame,data_len); break;
default: break; default: break;
} }
} }
@ -756,6 +764,7 @@ int usage_hf_list(){
PrintAndLog(" topaz - interpret data as topaz communications"); PrintAndLog(" topaz - interpret data as topaz communications");
PrintAndLog(" 7816 - interpret data as iso7816-4 communications"); PrintAndLog(" 7816 - interpret data as iso7816-4 communications");
PrintAndLog(" legic - interpret data as LEGIC communications"); PrintAndLog(" legic - interpret data as LEGIC communications");
PrintAndLog(" felica - interpret data as ISO18092 / FeliCa communications");
PrintAndLog(""); PrintAndLog("");
PrintAndLog("example: hf list 14a f"); PrintAndLog("example: hf list 14a f");
PrintAndLog(" hf list iclass"); PrintAndLog(" hf list iclass");
@ -818,6 +827,7 @@ int CmdHFList(const char *Cmd) {
else if(strcmp(type, "des")== 0) protocol = MFDES; else if(strcmp(type, "des")== 0) protocol = MFDES;
else if(strcmp(type, "legic")==0) protocol = LEGIC; else if(strcmp(type, "legic")==0) protocol = LEGIC;
else if(strcmp(type, "15")==0) protocol = ISO_15693; else if(strcmp(type, "15")==0) protocol = ISO_15693;
else if(strcmp(type, "felica")==0) protocol = FELICA;
else if(strcmp(type, "raw")== 0) protocol = -1;//No crc, no annotations else if(strcmp(type, "raw")== 0) protocol = -1;//No crc, no annotations
else errors = true; else errors = true;
@ -862,6 +872,8 @@ int CmdHFList(const char *Cmd) {
PrintAndLog("LEGIC - Timings are in ticks (1us == 1.5ticks)"); PrintAndLog("LEGIC - Timings are in ticks (1us == 1.5ticks)");
if ( protocol == ISO_15693 ) if ( protocol == ISO_15693 )
PrintAndLog("ISO15693 - Timings are not as accurate"); PrintAndLog("ISO15693 - Timings are not as accurate");
if ( protocol == FELICA )
PrintAndLog("ISO18092 / FeliCa - Timings are not as accurate");
PrintAndLog(""); PrintAndLog("");
PrintAndLog(" Start | End | Src | Data (! denotes parity error) | CRC | Annotation |"); PrintAndLog(" Start | End | Src | Data (! denotes parity error) | CRC | Annotation |");
@ -912,6 +924,14 @@ int CmdHFSearch(const char *Cmd){
PrintAndLog("\nValid iClass Tag (or PicoPass Tag) Found - Quiting Search\n"); PrintAndLog("\nValid iClass Tag (or PicoPass Tag) Found - Quiting Search\n");
return ans; return ans;
} }
/*
ans = CmdHFFelicaReader("s");
if (ans) {
PrintAndLog("\nValid ISO18092 / FeliCa Found - Quiting Search\n");
return ans;
}
*/
PrintAndLog("\nno known/supported 13.56 MHz tags found\n"); PrintAndLog("\nno known/supported 13.56 MHz tags found\n");
return 0; return 0;
@ -939,6 +959,7 @@ static command_t CommandTable[] = {
#ifdef WITH_EMV #ifdef WITH_EMV
{"emv", CmdHFEmv, 1, "{ EMV RFIDs... }"}, {"emv", CmdHFEmv, 1, "{ EMV RFIDs... }"},
#endif #endif
{"felica", CmdHFFelica, 1, "{ ISO18092 / Felica RFIDs... }"},
{"legic", CmdHFLegic, 1, "{ LEGIC RFIDs... }"}, {"legic", CmdHFLegic, 1, "{ LEGIC RFIDs... }"},
{"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"}, {"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"},
{"mf", CmdHFMF, 1, "{ MIFARE RFIDs... }"}, {"mf", CmdHFMF, 1, "{ MIFARE RFIDs... }"},

View file

@ -18,8 +18,8 @@
#include "graph.h" #include "graph.h"
#include "ui.h" #include "ui.h"
#include "cmdparser.h" #include "cmdparser.h"
#include "cmdhf14a.h" // 14443 a #include "cmdhf14a.h" // ISO14443-A
#include "cmdhf14b.h" // 14443 b #include "cmdhf14b.h" // ISO14443-B
#include "cmdhf15.h" // ISO15693 #include "cmdhf15.h" // ISO15693
#include "cmdhfepa.h" #include "cmdhfepa.h"
#include "cmdhflegic.h" // LEGIC #include "cmdhflegic.h" // LEGIC
@ -29,9 +29,10 @@
#include "cmdhfmfdes.h" // DESFIRE #include "cmdhfmfdes.h" // DESFIRE
#include "cmdhftopaz.h" // TOPAZ #include "cmdhftopaz.h" // TOPAZ
#include "cmdhfemv.h" // EMV #include "cmdhfemv.h" // EMV
#include "cmdhffelica.h" // ISO18092 / FeliCa
#include "protocols.h" #include "protocols.h"
#include "parity.h" // oddparity #include "parity.h" // oddparity
#include "iso15693tools.h" // iso15693 crc #include "iso15693tools.h" // ISO15693 crc
extern int CmdHF(const char *Cmd); extern int CmdHF(const char *Cmd);
extern int CmdHFTune(const char *Cmd); extern int CmdHFTune(const char *Cmd);

View file

@ -96,10 +96,7 @@ int CmdHFFelicaSim(const char *Cmd) {
uint8_t cmdp = 0; uint8_t cmdp = 0;
uint8_t uid[10] = {0,0,0,0,0,0,0,0,0,0}; uint8_t uid[10] = {0,0,0,0,0,0,0,0,0,0};
int uidlen = 0; int uidlen = 0;
bool useUIDfromEML = true; bool verbose = false;
bool setEmulatorMem = false;
bool verbose = false;
nonces_t data[1];
while(param_getchar(Cmd, cmdp) != 0x00 && !errors) { while(param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch(param_getchar(Cmd, cmdp)) { switch(param_getchar(Cmd, cmdp)) {
@ -120,7 +117,6 @@ int CmdHFFelicaSim(const char *Cmd) {
param_gethex_ex(Cmd, cmdp+1, uid, &uidlen); param_gethex_ex(Cmd, cmdp+1, uid, &uidlen);
if (!errors) { if (!errors) {
PrintAndLog("Emulating ISO18092/FeliCa tag with %d byte UID (%s)", uidlen>>1, sprint_hex(uid, uidlen>>1)); PrintAndLog("Emulating ISO18092/FeliCa tag with %d byte UID (%s)", uidlen>>1, sprint_hex(uid, uidlen>>1));
useUIDfromEML = false;
} }
cmdp += 2; cmdp += 2;
break; break;
@ -131,7 +127,6 @@ int CmdHFFelicaSim(const char *Cmd) {
break; break;
case 'e': case 'e':
case 'E': case 'E':
setEmulatorMem = true;
cmdp++; cmdp++;
break; break;
default: default:
@ -150,7 +145,8 @@ int CmdHFFelicaSim(const char *Cmd) {
SendCommand(&c); SendCommand(&c);
UsbCommand resp; UsbCommand resp;
PrintAndLog("Press pm3-button to abort simulation"); if ( verbose )
PrintAndLog("Press pm3-button to abort simulation");
while( !ukbhit() ){ while( !ukbhit() ){
if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500) ) continue; if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500) ) continue;
@ -304,14 +300,14 @@ int CmdHFFelicaCmdRaw(const char *cmd) {
if (reply) { if (reply) {
if (active_select) if (active_select)
waitCmd(1); waitCmdFelica(1);
if (datalen > 0) if (datalen > 0)
waitCmd(0); waitCmdFelica(0);
} }
return 0; return 0;
} }
void waitCmd(uint8_t iSelect) { void waitCmdFelica(uint8_t iSelect) {
UsbCommand resp; UsbCommand resp;
uint16_t len = 0; uint16_t len = 0;

View file

@ -37,5 +37,5 @@ extern int usage_hf_felica_sim(void);
extern int usage_hf_felica_sniff(void); extern int usage_hf_felica_sniff(void);
extern int usage_hf_fFelica_raw(void); extern int usage_hf_fFelica_raw(void);
void waitCmd(uint8_t iSelect); void waitCmdFelica(uint8_t iSelect);
#endif #endif