chg: 'hf iclass sim' - sim2, 4 get less default output, set DBG 4 for verbose

This commit is contained in:
iceman1001 2018-02-01 16:10:24 +01:00
commit e0373212a3
3 changed files with 42 additions and 35 deletions

View file

@ -350,6 +350,8 @@ int CmdHFiClassSim(const char *Cmd) {
* <4 byte NR><4 byte MAC>
* CC are all zeroes, CSN is the same as was sent in
**/
uint8_t tries = 0;
switch(simType) {
case 2: {
@ -361,14 +363,17 @@ int CmdHFiClassSim(const char *Cmd) {
clearCommandBuffer();
SendCommand(&c);
while (true) {
while ( !WaitForResponseTimeout(CMD_ACK, &resp, 2000) ) {
tries++;
printf(".");
fflush(stdout);
if (ukbhit()) {
int gc = getchar(); (void)gc;
PrintAndLog("[!] aborted via keyboard.");
return 0;
}
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
if ( tries > 20) {
PrintAndLog("[!] timeout while waiting for reply.");
return 0;
}
@ -406,7 +411,7 @@ int CmdHFiClassSim(const char *Cmd) {
break;
}
case 4: {
PrintAndLog("[+] Starting the sim 4 keyroll attack");
PrintAndLog("[+] Starting the sim 4 key roll attack");
PrintAndLog("[+] press keyboard to cancel");
UsbCommand c = {CMD_SIMULATE_TAG_ICLASS, {simType, NUM_CSNS}};
UsbCommand resp = {0};
@ -414,14 +419,17 @@ int CmdHFiClassSim(const char *Cmd) {
clearCommandBuffer();
SendCommand(&c);
while (true) {
while ( !WaitForResponseTimeout(CMD_ACK, &resp, 2000) ) {
tries++;
printf(".");
fflush(stdout);
if (ukbhit()) {
int gc = getchar(); (void)gc;
PrintAndLog("[!] aborted via keyboard.");
return 0;
}
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
if ( tries > 20) {
PrintAndLog("[!] timeout while waiting for reply.");
return 0;
}