chg: 'hf iclass lookup' adjusted helptext and parameters

This commit is contained in:
iceman1001 2018-01-31 16:50:41 +01:00
commit 50e4d60853

View file

@ -216,18 +216,30 @@ int usage_hf_iclass_loclass(void) {
} }
int usage_hf_iclass_chk(void) { int usage_hf_iclass_chk(void) {
PrintAndLog("Checkkeys loads a dictionary text file with 8byte hex keys to test authenticating against a iClass tag"); PrintAndLog("Checkkeys loads a dictionary text file with 8byte hex keys to test authenticating against a iClass tag");
PrintAndLog("Usage: hf iclass chk [h|e|r] [f (*.dic)] [c <csn>] [p <epurse>] [m <macs>]"); PrintAndLog("Usage: hf iclass chk [h|e|r] [f (*.dic)]");
PrintAndLog("Options:"); PrintAndLog("Options:");
PrintAndLog(" h Show this help"); PrintAndLog(" h Show this help");
PrintAndLog(" f <filename> Dictionary file with default iclass keys"); PrintAndLog(" f <filename> Dictionary file with default iclass keys");
PrintAndLog(" c CSN"); PrintAndLog(" r raw");
PrintAndLog(" p EPURSE"); PrintAndLog(" e elite");
PrintAndLog(" m macs");
PrintAndLog("Samples:"); PrintAndLog("Samples:");
PrintAndLog(" hf iclass chk f default_iclass_keys.dic"); PrintAndLog(" hf iclass chk f default_iclass_keys.dic");
PrintAndLog(" hf iclass chk f default_iclass_keys.dic e"); PrintAndLog(" hf iclass chk f default_iclass_keys.dic e");
return 0; return 0;
} }
int usage_hf_iclass_lookup(void) {
PrintAndLog("Lookup keys takes some sniffed trace data and tries to verify what key was used against a dictionary file");
PrintAndLog("Usage: hf iclass lookup [h|e|r] [f (*.dic)] [c <csn>] [p <epurse>] [m <macs>]");
PrintAndLog("Options:");
PrintAndLog(" h Show this help");
PrintAndLog(" f <filename> Dictionary file with default iclass keys");
PrintAndLog(" u CSN");
PrintAndLog(" p EPURSE");
PrintAndLog(" m macs");
PrintAndLog("Samples:");
PrintAndLog(" hf iclass lookup u 9655a400f8ff12e0 p f0ffffffffffffff m 0000000089cb984b f default_iclass_keys.dic");
return 0;
}
int xorbits_8(uint8_t val) { int xorbits_8(uint8_t val) {
uint8_t res = val ^ (val >> 1); //1st pass uint8_t res = val ^ (val >> 1); //1st pass
@ -1836,6 +1848,10 @@ int CmdHFiClassCheckKeys(const char *Cmd) {
iclass_premac_t *pre = NULL; iclass_premac_t *pre = NULL;
int keycnt = 0; int keycnt = 0;
// if empty string
if (strlen(Cmd) == 0) errors = true;
// time // time
uint64_t t1 = msclock(); uint64_t t1 = msclock();
@ -2030,6 +2046,8 @@ int CmdHFiClassLookUp(const char *Cmd) {
iclass_prekey_t *prekey = NULL; iclass_prekey_t *prekey = NULL;
int keycnt = 0, len = 0; int keycnt = 0, len = 0;
// if empty string
if (strlen(Cmd) == 0) errors = true;
// time // time
uint64_t t1 = msclock(); uint64_t t1 = msclock();
@ -2037,7 +2055,7 @@ int CmdHFiClassLookUp(const char *Cmd) {
switch (param_getchar(Cmd, cmdp)) { switch (param_getchar(Cmd, cmdp)) {
case 'h': case 'h':
case 'H': case 'H':
return usage_hf_iclass_chk(); return usage_hf_iclass_lookup();
case 'f': case 'f':
case 'F': case 'F':
fileNameLen = param_getstr(Cmd, cmdp+1, filename, sizeof(filename)); fileNameLen = param_getstr(Cmd, cmdp+1, filename, sizeof(filename));
@ -2093,7 +2111,8 @@ int CmdHFiClassLookUp(const char *Cmd) {
break; break;
} }
} }
if (errors) return usage_hf_iclass_chk();
if (errors) return usage_hf_iclass_lookup();
PrintAndLog("CSN %s", sprint_hex( CSN, sizeof(CSN) )); PrintAndLog("CSN %s", sprint_hex( CSN, sizeof(CSN) ));
PrintAndLog("Epurse %s", sprint_hex( EPURSE, sizeof(EPURSE) )); PrintAndLog("Epurse %s", sprint_hex( EPURSE, sizeof(EPURSE) ));
@ -2265,26 +2284,25 @@ void PrintPreCalc(iclass_prekey_t* list, int itemcnt) {
} }
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"help", CmdHelp, 1, "This help"}, {"help", CmdHelp, 1, "This help"},
{"calcnewkey", CmdHFiClassCalcNewKey, 1, "[options..] Calc Diversified keys (blocks 3 & 4) to write new keys"}, {"calcnewkey", CmdHFiClassCalcNewKey, 1, "[options..] Calc Diversified keys (blocks 3 & 4) to write new keys"},
{"chk", CmdHFiClassCheckKeys, 0, " Check keys"}, {"chk", CmdHFiClassCheckKeys, 1, " Check keys"},
{"clone", CmdHFiClassCloneTag, 0, "[options..] Authenticate and Clone from iClass bin file"}, {"clone", CmdHFiClassCloneTag, 0, "[options..] Authenticate and Clone from iClass bin file"},
{"decrypt", CmdHFiClassDecrypt, 1, "[f <fname>] Decrypt tagdump" }, {"decrypt", CmdHFiClassDecrypt, 1, "[f <fname>] Decrypt tagdump" },
{"dump", CmdHFiClassReader_Dump, 0, "[options..] Authenticate and Dump iClass tag's AA1"}, {"dump", CmdHFiClassReader_Dump, 0, "[options..] Authenticate and Dump iClass tag's AA1"},
{"eload", CmdHFiClassELoad, 0, "[f <fname>] (experimental) Load data into iClass emulator memory"}, {"eload", CmdHFiClassELoad, 0, "[f <fname>] (experimental) Load data into iClass emulator memory"},
{"encryptblk", CmdHFiClassEncryptBlk, 1, "<BlockData> Encrypt given block data"}, {"encryptblk", CmdHFiClassEncryptBlk, 1, "<BlockData> Encrypt given block data"},
{"list", CmdHFiClassList, 0, " (Deprecated) List iClass history"}, {"list", CmdHFiClassList, 0, " (Deprecated) List iClass history"},
{"loclass", CmdHFiClass_loclass, 1, "[options..] Use loclass to perform bruteforce of reader attack dump"}, {"loclass", CmdHFiClass_loclass, 1, "[options..] Use loclass to perform bruteforce of reader attack dump"},
{"managekeys", CmdHFiClassManageKeys, 1, "[options..] Manage the keys to use with iClass"}, {"lookup", CmdHFiClassLookUp, 0, "[options..] Uses authentication trace to check for key in dictionary file"},
{"readblk", CmdHFiClass_ReadBlock, 0, "[options..] Authenticate and Read iClass block"}, {"managekeys", CmdHFiClassManageKeys, 1, "[options..] Manage the keys to use with iClass"},
{"reader", CmdHFiClassReader, 0, " Act like an iClass reader"}, {"readblk", CmdHFiClass_ReadBlock, 0, "[options..] Authenticate and Read iClass block"},
{"readtagfile", CmdHFiClassReadTagFile, 1, "[options..] Display Content from tagfile"}, {"reader", CmdHFiClassReader, 0, " Act like an iClass reader"},
{"replay", CmdHFiClassReader_Replay, 0, "<mac> Read an iClass tag via Reply Attack"}, {"readtagfile", CmdHFiClassReadTagFile, 1, "[options..] Display Content from tagfile"},
{"sim", CmdHFiClassSim, 0, "[options..] Simulate iClass tag"}, {"replay", CmdHFiClassReader_Replay, 0, "<mac> Read an iClass tag via Reply Attack"},
{"sniff", CmdHFiClassSniff, 0, " Eavesdrop iClass communication"}, {"sim", CmdHFiClassSim, 0, "[options..] Simulate iClass tag"},
{"writeblk", CmdHFiClass_WriteBlock, 0, "[options..] Authenticate and Write iClass block"}, {"sniff", CmdHFiClassSniff, 0, " Eavesdrop iClass communication"},
{"a", CmdHFiClassLookUp, 0, "[options..] A"}, {"writeblk", CmdHFiClass_WriteBlock, 0, "[options..] Authenticate and Write iClass block"},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };