- while(!ukbhit()){
- if ( WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
- if ( (resp.arg[0] & 0xffff) == CMD_SIMULATE_MIFARE_CARD ){
- memset(data, 0x00, sizeof(data));
- memset(key, 0x00, sizeof(key));
- int len = (resp.arg[1] > sizeof(data)) ? sizeof(data) : resp.arg[1];
- memcpy(data, resp.d.asBytes, len);
- uint32_t cuid = bytes_to_num(data, 4);
- tryMfk32(cuid, data, key); // 201604, iceman, errors!
- //tryMfk32_moebius(cuid, data, key);
- //tryMfk64(cuid, 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);