X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/841d7af0dcaa91b937cd17631ee460cb5301d6ef..5e32cf7575b01378840976c786f8f285113e1f16:/client/cmdhfmf.c diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index b189e19b..1d516ebc 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -30,7 +30,7 @@ int CmdHF14AMifare(const char *Cmd) printf("Press button on the proxmark3 device to abort both proxmark3 and client.\n"); printf("-------------------------------------------------------------------------\n"); - clock_t t = clock(); + clock_t t1 = clock(); start: clearCommandBuffer(); @@ -91,9 +91,10 @@ start: printf("------------------------------------------------------------------\n"); PrintAndLog("Found valid key: %012"llx" \n", r_key); } - t = clock() - t; - //printf("Time in darkside: %d ticks - %1.2f seconds\n", t, ((float)t)/CLOCKS_PER_SEC); - printf("Time in darkside: %Lf ticks - %1.2Lf seconds\n", (long double)t, ((long double)t)/CLOCKS_PER_SEC); + t1 = clock() - t1; + if ( t1 > 0 ){ + PrintAndLog("Time in darkside: %f ticks - %1.2f sec\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC); + } return 0; } @@ -512,9 +513,9 @@ int CmdHF14AMfRestore(const char *Cmd) for (sectorNo = 0; sectorNo < numSectors; sectorNo++) { for(blockNo = 0; blockNo < NumBlocksPerSector(sectorNo); blockNo++) { UsbCommand c = {CMD_MIFARE_WRITEBL, {FirstBlockOfSector(sectorNo) + blockNo, keyType, 0}}; - memcpy(c.d.asBytes, key, 6); - - if (fread(bldata, 1, 16, fdump) == 0) { + memcpy(c.d.asBytes, key, 6); + bytes_read = fread(bldata, 1, 16, fdump); + if ( bytes_read == 0) { PrintAndLog("File reading error (dumpdata.bin)."); fclose(fdump); return 2; @@ -675,7 +676,7 @@ int CmdHF14AMfNested(const char *Cmd) } } else { // ------------------------------------ multiple sectors working - clock_t time1 = clock(); + clock_t t1 = clock(); e_sector = calloc(SectorsCnt, sizeof(sector)); if (e_sector == NULL) return 1; @@ -776,7 +777,10 @@ int CmdHF14AMfNested(const char *Cmd) } } - PrintAndLog("Time in nested: %1.2f (%1.2f sec per key)\n\n", ((float)clock() - time1)/CLOCKS_PER_SEC, ((float)clock() - time1)/iterations/CLOCKS_PER_SEC); + t1 = clock() - t1; + if ( t1 > 0 ) { + PrintAndLog("Time in nested: %f ticks %1.2f sec (%1.2f sec per key)\n\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC, ((float)t1)/iterations/CLOCKS_PER_SEC); + } PrintAndLog("-----------------------------------------------\nIterations count: %d\n\n", iterations); //print them @@ -1131,7 +1135,7 @@ int CmdHF14AMfChk(const char *Cmd) } } // time - clock_t time1 = clock(); + clock_t t1 = clock(); for ( int t = !keyType; t < 2; keyType==2?(t++):(t=2) ) { int b=blockNo; @@ -1154,8 +1158,10 @@ int CmdHF14AMfChk(const char *Cmd) b<127?(b+=4):(b+=16); } } - printf("Time in checkkeys: %1.3f (%1.3f sec per key)\n\n", ((float)clock() - time1)/CLOCKS_PER_SEC, ((float)clock() - time1)/keycnt/CLOCKS_PER_SEC); - + t1 = clock() - t1; + if ( t1 > 0 ){ + printf("Time in checkkeys: %f ticks %1.2f sec (%1.2f sec per key)\n\n", (float)t1, ((float)t1)/CLOCKS_PER_SEC, ((float)t1)/keycnt/CLOCKS_PER_SEC); + } if (transferToEml) { uint8_t block[16];