X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/2e9d4b3ff492826eeaa7c5eefb905fcff3eb003c..e069d740e376914c9d639630e04898e28918f1ff:/client/cmdhficlass.c diff --git a/client/cmdhficlass.c b/client/cmdhficlass.c index 19ec57d2..90856e91 100644 --- a/client/cmdhficlass.c +++ b/client/cmdhficlass.c @@ -10,281 +10,267 @@ // High frequency iClass commands //----------------------------------------------------------------------------- -#include -#include -#include -#include -#include "iso14443crc.h" // Can also be used for iClass, using 0xE012 as CRC-type -#include "data.h" -//#include "proxusb.h" -#include "proxmark3.h" -#include "ui.h" -#include "cmdparser.h" #include "cmdhficlass.h" -#include "common.h" -#include "util.h" -#include "cmdmain.h" -#include "loclass/des.h" -#include "loclass/cipherutils.h" -#include "loclass/cipher.h" -#include "loclass/ikeys.h" -#include "loclass/elite_crack.h" -#include "loclass/fileutils.h" static int CmdHelp(const char *Cmd); -int xorbits_8(uint8_t val) -{ - uint8_t res = val ^ (val >> 1); //1st pass - res = res ^ (res >> 1); // 2nd pass - res = res ^ (res >> 2); // 3rd pass - res = res ^ (res >> 4); // 4th pass - return res & 1; -} - -void explain(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize) -{ - - switch(cmd[0]) - { - case 0x0a: snprintf(exp,size,"WUP"); break; - case 0x0f: snprintf(exp,size,"SOF"); break; - case 0x0c: snprintf(exp,size,"Read config"); break; - case 0x81: snprintf(exp,size,"SELECT"); break; - case 0x88: snprintf(exp,size,"Read E-purse (CC)"); break; - case 0x05: snprintf(exp,size,"Reader challenge"); break; - case 0x00: snprintf(exp,size,"End"); break; - default: snprintf(exp,size,"?"); break; - } - return; -} - -int CmdHFiClassList(const char *Cmd) -{ - bool ShowWaitCycles = false; - char param = param_getchar(Cmd, 0); - - if (param != 0) { - PrintAndLog("List data in trace buffer."); - PrintAndLog("Usage: hf iclass list"); - PrintAndLog("h - help"); - PrintAndLog("sample: hf iclass list"); - return 0; - } - -// for the time being. Need better Bigbuf handling. -#define TRACE_SIZE 3000 +#define NUM_CSNS 15 +#define ICLASS_KEYS_MAX 8 +static uint8_t iClass_Key_Table[ICLASS_KEYS_MAX][8] = { + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }, + { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 } +}; - uint8_t trace[TRACE_SIZE]; - GetFromBigBuf(trace, TRACE_SIZE, 0); - WaitForResponse(CMD_ACK, NULL); +typedef struct iclass_block { + uint8_t d[8]; +} iclass_block_t; - PrintAndLog("Recorded Activity"); +int usage_hf_iclass_sim(void) { + PrintAndLog("Usage: hf iclass sim