\r
// wait cycle\r
while (true) {\r
- printf(".");\r
+ printf(".");\r
fflush(stdout);\r
if (ukbhit()) {\r
tmpchar = getchar();\r
}\r
\r
UsbCommand resp;\r
- if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {\r
+ if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {\r
isOK = resp.arg[0];\r
+ printf("\n\n");\r
switch (isOK) {\r
case -1 : PrintAndLog("Button pressed. Aborted.\n"); break;\r
case -2 : PrintAndLog("Card is not vulnerable to Darkside attack (doesn't send NACK on authentication requests).\n"); break;\r
case -3 : PrintAndLog("Card is not vulnerable to Darkside attack (its random number generator is not predictable).\n"); break;\r
case -4 : PrintAndLog("Card is not vulnerable to Darkside attack (its random number generator seems to be based on the wellknown");\r
- PrintAndLog("generating polynomial with 16 effective bits only, but shows unexpected behaviour.\n"); break;\r
+ PrintAndLog("generating polynomial with 16 effective bits only, but shows unexpected behaviour.\n"); break;\r
default: ;\r
}\r
- uid = (uint32_t)bytes_to_num(resp.d.asBytes, 4);\r
+ uid = (uint32_t)bytes_to_num(resp.d.asBytes + 0, 4);\r
nt = (uint32_t)bytes_to_num(resp.d.asBytes + 4, 4);\r
par_list = bytes_to_num(resp.d.asBytes + 8, 8);\r
ks_list = bytes_to_num(resp.d.asBytes + 16, 8);\r
\r
t1 = clock() - t1;\r
if ( t1 > 0 )\r
- PrintAndLog("Time in darkside: %.0f ticks - %4.2f sec\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC);\r
+ PrintAndLog("Time in darkside: %.0f ticks\n", (float)t1);\r
return 0;\r
}\r
\r
PrintAndLog("t - transfer keys into emulator memory");\r
PrintAndLog("d - write keys to binary file");\r
PrintAndLog(" ");\r
- PrintAndLog(" sample1: hf mf nested 1 0 A FFFFFFFFFFFF ");\r
- PrintAndLog(" sample2: hf mf nested 1 0 A FFFFFFFFFFFF t ");\r
- PrintAndLog(" sample3: hf mf nested 1 0 A FFFFFFFFFFFF d ");\r
- PrintAndLog(" sample4: hf mf nested o 0 A FFFFFFFFFFFF 4 A");\r
+ PrintAndLog(" samples:");\r
+ PrintAndLog(" hf mf nested 1 0 A FFFFFFFFFFFF ");\r
+ PrintAndLog(" hf mf nested 1 0 A FFFFFFFFFFFF t ");\r
+ PrintAndLog(" hf mf nested 1 0 A FFFFFFFFFFFF d ");\r
+ PrintAndLog(" hf mf nested o 0 A FFFFFFFFFFFF 4 A");\r
return 0;\r
} \r
\r
}\r
clock_t t2 = clock() - t1;\r
if ( t2 > 0 )\r
- PrintAndLog("Time to check 6 known keys: %.0f ticks %4.2f sec", (float)t2, ((float)t2)/CLOCKS_PER_SEC);\r
+ PrintAndLog("Time to check 6 known keys: %.0f ticks", (float)t2 );\r
\r
PrintAndLog("enter nested..."); \r
\r
case -5 :\r
calibrate = false;\r
iterations++;\r
- e_sector[sectorNo].foundKey[trgKeyType] = TRUE;\r
+ e_sector[sectorNo].foundKey[trgKeyType] = 1;\r
e_sector[sectorNo].Key[trgKeyType] = bytes_to_num(keyBlock, 6);\r
continue;\r
\r
\r
t1 = clock() - t1;\r
if ( t1 > 0 )\r
- PrintAndLog("Time in nested: %.0f ticks %4.2f sec (%4.2f sec per key)\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC, ((float)t1)/iterations/CLOCKS_PER_SEC);\r
+ PrintAndLog("Time in nested: %.0f ticks \n", (float)t1);\r
\r
// 20160116 If Sector A is found, but not Sector B, try just reading it of the tag?\r
PrintAndLog("trying to read key B...");\r
SendCommand(&c);\r
\r
UsbCommand resp;\r
- if ( !WaitForResponseTimeout(CMD_ACK, &resp, 1500)) continue;\r
+ if ( !WaitForResponseTimeout(CMD_ACK,&resp,1500)) continue;\r
\r
uint8_t isOK = resp.arg[0] & 0xff;\r
if (!isOK) continue;\r
clock_t t1 = clock();\r
\r
// check keys.\r
- for (trgKeyType = 0; trgKeyType < 2; ++trgKeyType) {\r
+ for (trgKeyType = !keyType; trgKeyType < 2; (keyType==2) ? (++trgKeyType) : (trgKeyType=2) ) {\r
\r
int b = blockNo;\r
for (int i = 0; i < SectorsCnt; ++i) {\r
// skip already found keys.\r
if (e_sector[i].foundKey[trgKeyType]) continue;\r
\r
+ \r
for (uint32_t c = 0; c < keycnt; c += max_keys) {\r
\r
uint32_t size = keycnt-c > max_keys ? max_keys : keycnt-c;\r
e_sector[i].Key[trgKeyType] = 0xffffffffffff;\r
e_sector[i].foundKey[trgKeyType] = FALSE;\r
}\r
+ printf(".");\r
}\r
b < 127 ? ( b +=4 ) : ( b += 16 ); \r
}\r
}\r
- \r
t1 = clock() - t1;\r
if ( t1 > 0 )\r
- printf("Time in checkkeys: %.0f ticks %1.2f sec (%1.2f sec per key)\n\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC, ((float)t1)/keycnt/CLOCKS_PER_SEC);\r
+ printf("\nTime in checkkeys: %.0f ticks\n", (float)t1);\r
\r
// 20160116 If Sector A is found, but not Sector B, try just reading it of the tag?\r
PrintAndLog("testing to read B...");\r
int argi=0;\r
\r
if (strlen(Cmd) < 1 || param_getchar(Cmd, argi) == 'h') {\r
- PrintAndLog("Usage: hf mf csetuid <UID 8 hex symbols> [ATQA 4 hex symbols SAK 2 hex symbols] [w]");\r
- PrintAndLog("sample: hf mf csetuid 01020304");\r
- PrintAndLog("sample: hf mf csetuid 01020304 0004 08 w");\r
PrintAndLog("Set UID, ATQA, and SAK for magic Chinese card (only works with such cards)");\r
PrintAndLog("If you also want to wipe the card then add 'w' at the end of the command line.");\r
+ PrintAndLog("");\r
+ PrintAndLog("Usage: hf mf csetuid <UID 8 hex symbols> [ATQA 4 hex symbols SAK 2 hex symbols] [w]");\r
+ PrintAndLog("");\r
+ PrintAndLog("sample: hf mf csetuid 01020304");\r
+ PrintAndLog(" hf mf csetuid 01020304 0004 08 w");\r
return 0;\r
}\r
\r
\r
PrintAndLog("--wipe card:%s uid:%s", (wipeCard)?"YES":"NO", sprint_hex(uid, 4));\r
\r
- res = mfCSetUID(uid, (atqaPresent)?atqa:NULL, (atqaPresent)?sak:NULL, oldUid, wipeCard);\r
+ res = mfCSetUID(uid, (atqaPresent) ? atqa : NULL, (atqaPresent) ? sak : NULL, oldUid, wipeCard);\r
if (res) {\r
PrintAndLog("Can't set UID. error=%d", res);\r
return 1;\r