X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/76c7e6c36368c3fc23dc4fab1fe5852023c78fac..b82c2f85e457f361b119d21a31f3263ac3489cc8:/client/cmdhficlass.c diff --git a/client/cmdhficlass.c b/client/cmdhficlass.c index e32664f5..a46b7741 100644 --- a/client/cmdhficlass.c +++ b/client/cmdhficlass.c @@ -20,7 +20,7 @@ #include "ui.h" #include "cmdparser.h" #include "cmdhficlass.h" -#include "../include/common.h" +#include "common.h" #include "util.h" #include "cmdmain.h" #include "loclass/des.h" @@ -29,11 +29,30 @@ #include "loclass/ikeys.h" #include "loclass/elite_crack.h" #include "loclass/fileutils.h" +#include "protocols.h" +#include "usb_cmd.h" +#include "cmdhfmfu.h" +#include "cmdhf.h" static int CmdHelp(const char *Cmd); -int xorbits_8(uint8_t val) -{ +#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 } +}; + +typedef struct iclass_block { + uint8_t d[8]; +} iclass_block_t; + +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 @@ -41,629 +60,1639 @@ int xorbits_8(uint8_t val) return res & 1; } -int CmdHFiClassList(const char *Cmd) -{ +int CmdHFiClassList(const char *Cmd) { + //PrintAndLog("Deprecated command, use 'hf list iclass' instead"); + CmdHFList("iclass"); + return 0; +} + +int CmdHFiClassSnoop(const char *Cmd) { + UsbCommand c = {CMD_SNOOP_ICLASS}; + SendCommand(&c); + return 0; +} + +int usage_hf_iclass_sim(void) { + PrintAndLog("Usage: hf iclass sim