\r
if(flags & FLAG_INTERACTIVE)\r
{ \r
- PrintAndLog("Press pm3-button to abort simulation");\r
- \r
uint8_t data[40];\r
uint8_t key[6];\r
\r
UsbCommand resp; \r
+ PrintAndLog("Press pm3-button or send another cmd to abort simulation");\r
+ //while(! WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
+ //We're waiting only 1.5 s at a time, otherwise we get the\r
+ // annoying message about "Waiting for a response... "\r
+ //}\r
while(!ukbhit() ){\r
- if ( WaitForResponseTimeout(CMD_ACK,&resp,1500) ) {\r
- if ( (resp.arg[0] & 0xffff) == CMD_SIMULATE_MIFARE_CARD ){\r
+ if (!WaitForResponseTimeout(CMD_ACK,&resp,1500) ) continue;\r
+\r
+ if ( !(flags & FLAG_NR_AR_ATTACK) ) break;\r
+ if ( (resp.arg[0] & 0xffff) != CMD_SIMULATE_MIFARE_CARD ) break;\r
+\r
memset(data, 0x00, sizeof(data));\r
memset(key, 0x00, sizeof(key));\r
int len = (resp.arg[1] > sizeof(data)) ? sizeof(data) : resp.arg[1];\r
uint64_t corr_uid = 0;\r
if ( memcmp(data, "\x00\x00\x00\x00", 4) == 0 ) {\r
corr_uid = (data[3] << 24) | (data[2] << 16) | (data[1] << 8) | data[0];\r
- }\r
- else {\r
+ tryMfk32(corr_uid, data, key);\r
+ } else {\r
corr_uid |= (uint64_t)data[2] << 48; \r
corr_uid |= (uint64_t)data[1] << 40; \r
corr_uid |= (uint64_t)data[0] << 32;\r
corr_uid |= data[6] << 16;\r
corr_uid |= data[5] << 8;\r
corr_uid |= data[4];\r
+ tryMfk64(corr_uid, data, key);\r
}\r
- tryMfk32(corr_uid, data, key);\r
- //tryMfk64(corr_uid, data, key);\r
PrintAndLog("--");\r
}\r
}\r
- }\r
- }\r
+ \r
return 0;\r
}\r
\r
\r
if ( ctmp == 'h' || ctmp == 'H' || ctmp == 0x00) {\r
PrintAndLog("It loads emul dump from the file `filename.eml`");\r
- PrintAndLog("Usage: hf mf eload [card memory] <file name w/o `.eml`>");\r
+ PrintAndLog("Usage: hf mf eload [card memory] <file name w/o `.eml`> [numblocks]");\r
PrintAndLog(" [card memory]: 0 = 320 bytes (Mifare Mini), 1 = 1K (default), 2 = 2K, 4 = 4K, u = UL");\r
PrintAndLog("");\r
PrintAndLog(" sample: hf mf eload filename");\r
case '\0': numBlocks = 16*4; break;\r
case '2' : numBlocks = 32*4; break;\r
case '4' : numBlocks = 256; break;\r
- case 'U' : // fall through , NTAG 215 has 135blocks a 540 bytes.\r
- case 'u' : numBlocks = 135; blockWidth = 8; break;\r
+ case 'U' : // fall through\r
+ case 'u' : numBlocks = 255; blockWidth = 8; break;\r
default: {\r
numBlocks = 16*4;\r
nameParamNo = 0;\r
}\r
}\r
+ uint32_t numblk2 = param_get32ex(Cmd,2,0,10);\r
+ if (numblk2 > 0) numBlocks = numblk2; \r
\r
len = param_getstr(Cmd,nameParamNo,filename);\r
\r
return 1;\r
}\r
\r
- PrintAndLog("data:%s", sprint_hex(data, sizeof(data)));\r
+ PrintAndLog("data: %s", sprint_hex(data, sizeof(data)));\r
return 0;\r
}\r
\r