-
- 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);
- }
- }
+ UsbCommand resp;
+
+ PrintAndLog("Press pm3-button to abort simulation");
+
+ 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[0], setEmulatorMem, verbose);