chg: 'hf iclass sim' textual

This commit is contained in:
iceman1001 2018-02-01 17:58:50 +01:00
parent 111b55d850
commit 8380743a42

View file

@ -365,28 +365,24 @@ int CmdHFiClassSim(const char *Cmd) {
while ( !WaitForResponseTimeout(CMD_ACK, &resp, 2000) ) { while ( !WaitForResponseTimeout(CMD_ACK, &resp, 2000) ) {
tries++; tries++;
if (ukbhit()) { if (ukbhit()) {
int gc = getchar(); (void)gc; int gc = getchar(); (void)gc;
PrintAndLog("\n[!] aborted via keyboard."); PrintAndLog("\n[!] aborted via keyboard.");
return 0; return 0;
} }
if ( tries > 20) { if ( tries > 20) {
PrintAndLog("\n[!] timeout while waiting for reply."); PrintAndLog("\n[!] timeout while waiting for reply.");
return 0; return 0;
} }
} }
uint8_t num_mac = resp.arg[1]; uint8_t num_mac = resp.arg[1];
bool success = ( NUM_CSNS == num_mac ); bool success = ( NUM_CSNS == num_mac );
PrintAndLog("[+] %d out of %d MAC obtained [%s]", num_mac, NUM_CSNS, (success) ? "OK" : "FAIL"); PrintAndLog("[%c] %d out of %d MAC obtained [%s]", (success) ? '+':'!', num_mac, NUM_CSNS, (success) ? "OK" : "FAIL");
if ( num_mac == 0 ) if ( num_mac == 0 )
break; break;
size_t datalen = NUM_CSNS * 24; size_t datalen = NUM_CSNS * 24;
void* dump = malloc(datalen); void* dump = malloc(datalen);
if ( !dump ) { if ( !dump ) {
PrintAndLog("[!] Failed to allocate memory"); PrintAndLog("[!] Failed to allocate memory");
@ -417,23 +413,19 @@ int CmdHFiClassSim(const char *Cmd) {
while ( !WaitForResponseTimeout(CMD_ACK, &resp, 2000) ) { while ( !WaitForResponseTimeout(CMD_ACK, &resp, 2000) ) {
tries++; tries++;
if (ukbhit()) { if (ukbhit()) {
int gc = getchar(); (void)gc; int gc = getchar(); (void)gc;
PrintAndLog("\n[!] aborted via keyboard."); PrintAndLog("\n[!] aborted via keyboard.");
return 0; return 0;
} }
if ( tries > 20) { if ( tries > 20) {
PrintAndLog("\n[!] timeout while waiting for reply."); PrintAndLog("\n[!] timeout while waiting for reply.");
return 0; return 0;
} }
} }
uint8_t num_mac = resp.arg[1]; uint8_t num_mac = resp.arg[1];
bool success = ( (NUM_CSNS * 2) == num_mac ); bool success = ( (NUM_CSNS * 2) == num_mac );
PrintAndLog("[+] %d out of %d MAC obtained [%s]", num_mac, NUM_CSNS * 2, (success) ? "OK" : "FAIL"); PrintAndLog("[%c] %d out of %d MAC obtained [%s]", (success) ? '+':'!', num_mac, NUM_CSNS, (success) ? "OK" : "FAIL");
if ( num_mac == 0 ) if ( num_mac == 0 )
break; break;
@ -470,9 +462,7 @@ int CmdHFiClassSim(const char *Cmd) {
resp_index++; resp_index++;
} }
saveFile("iclass_mac_attack_keyroll_B", "bin", dump, datalen); saveFile("iclass_mac_attack_keyroll_B", "bin", dump, datalen);
free(dump); free(dump);
break; break;
} }
case 1: case 1: