- while(!ukbhit()){
- if ( WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
- if ( (resp.arg[0] & 0xffff) == CMD_SIMULATE_MIFARE_CARD ){
- memset(data, 0x00, sizeof(data));
- int len = (resp.arg[1] > sizeof(data)) ? sizeof(data) : resp.arg[1];
- memcpy(data, resp.d.asBytes, len);
- key = 0;
-
- if ( flags & FLAG_NR_AR_ATTACK ) {
- bool found = tryMfk32(data, &key);
- found ^= tryMfk32_moebius(data, &key);
- }
- }
- }
+ nonces_t data[ATTACK_KEY_COUNT*2];
+ UsbCommand resp;
+
+ while( !ukbhit() ){
+ if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500) ) continue;
+
+ if ( !(flags & FLAG_NR_AR_ATTACK) ) break;
+ if ( (resp.arg[0] & 0xffff) != CMD_SIMULATE_MIFARE_CARD ) break;
+
+ memcpy( data, resp.d.asBytes, sizeof(data) );
+ readerAttack(data, TRUE);