From 3d53f941aa3c162387d83c9ebabbbb35ed06378a Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 28 Jul 2017 01:35:49 +0200 Subject: [PATCH] some time_t issues --- client/cmdhfmf.c | 46 +++++++++++------------------------- client/cmdlft55xx.h | 1 + client/guidummy.c | 27 --------------------- client/loclass/elite_crack.c | 4 ++-- 4 files changed, 17 insertions(+), 61 deletions(-) delete mode 100644 client/guidummy.c diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 9a9305bc..fc0050ed 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -864,10 +864,7 @@ int CmdHF14AMfNested(const char *Cmd) { return 2; } else { // ------------------------------------ multiple sectors working - clock_t t1 = clock(); - unsigned long elapsed_time; - time_t start, end; - time(&start); + uint64_t t1 = msclock(); e_sector = calloc(SectorsCnt, sizeof(sector_t)); if (e_sector == NULL) return 1; @@ -892,12 +889,10 @@ int CmdHF14AMfNested(const char *Cmd) { e_sector[i].foundKey[j] = true; } } - } - clock_t t2 = clock() - t1; - time(&end); - elapsed_time = difftime(end, start); - if ( t2 > 0 ) - PrintAndLog("Time to check 6 known keys: %.0f ticks %u seconds\n", (float)t2 , elapsed_time); + } + + uint64_t t2 = msclock() - t1; + PrintAndLog("Time to check 6 known keys: %.0f seconds\n", (float)t2/1000.0 ); PrintAndLog("enter nested..."); @@ -935,11 +930,8 @@ int CmdHF14AMfNested(const char *Cmd) { } } - t1 = clock() - t1; - time(&end); - elapsed_time = difftime(end, start); - if ( t1 > 0 ) - PrintAndLog("Time in nested: %.0f ticks %u seconds\n", (float)t1, elapsed_time); + t1 = msclock() - t1; + PrintAndLog("Time in nested: %.0f seconds\n", (float)t1/1000.0); // 20160116 If Sector A is found, but not Sector B, try just reading it of the tag? @@ -1293,9 +1285,8 @@ int CmdHF14AMfChk(const char *Cmd) { uint32_t max_keys = keycnt > (USB_CMD_DATA_SIZE/6) ? (USB_CMD_DATA_SIZE/6) : keycnt; // time - clock_t t1 = clock(); - time_t start, end; - time(&start); + uint64_t t1 = msclock(); + // check keys. for (trgKeyType = !keyType; trgKeyType < 2; (keyType==2) ? (++trgKeyType) : (trgKeyType=2) ) { @@ -1321,11 +1312,8 @@ int CmdHF14AMfChk(const char *Cmd) { b < 127 ? ( b +=4 ) : ( b += 16 ); } } - t1 = clock() - t1; - time(&end); - unsigned long elapsed_time = difftime(end, start); - if ( t1 > 0 ) - PrintAndLog("\nTime in checkkeys: %.0f ticks %u seconds\n", (float)t1, elapsed_time); + t1 = msclock() - t1; + PrintAndLog("\nTime in checkkeys: %.0f seconds\n", (float)t1/1000.0); // 20160116 If Sector A is found, but not Sector B, try just reading it of the tag? @@ -1745,21 +1733,15 @@ int CmdHF14AMfKeyBrute(const char *Cmd) { // key if (param_gethex(Cmd, 2, key, 12)) return usage_hf14_keybrute(); - clock_t t1 = clock(); - time_t start, end; - time(&start); + uint64_t t1 = msclock(); if (mfKeyBrute( blockNo, keytype, key, &foundkey)) PrintAndLog("Found valid key: %012" PRIx64 " \n", foundkey); else PrintAndLog("Key not found"); - t1 = clock() - t1; - time(&end); - unsigned long elapsed_time = difftime(end, start); - if ( t1 > 0 ) - PrintAndLog("\nTime in keybrute: %.0f ticks %u seconds\n", (float)t1, elapsed_time); - + t1 = msclock() - t1; + PrintAndLog("\nTime in keybrute: %.0f seconds\n", (float)t1/1000.0); return 0; } diff --git a/client/cmdlft55xx.h b/client/cmdlft55xx.h index 301a814e..10980294 100644 --- a/client/cmdlft55xx.h +++ b/client/cmdlft55xx.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "proxmark3.h" #include "ui.h" #include "graph.h" diff --git a/client/guidummy.c b/client/guidummy.c deleted file mode 100644 index b42dea24..00000000 --- a/client/guidummy.c +++ /dev/null @@ -1,27 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (C) 2009 Michael Gernoth -// -// This code is licensed to you under the terms of the GNU GPL, version 2 or, -// at your option, any later version. See the LICENSE.txt file for the text of -// the license. -//----------------------------------------------------------------------------- -// GUI dummy file -//----------------------------------------------------------------------------- - -#include - -void ShowGraphWindow(void) -{ - static int warned = 0; - - if (!warned) { - printf("No GUI in this build!\n"); - warned = 1; - } -} - -void HideGraphWindow(void) {} -void RepaintGraphWindow(void) {} -void MainGraphics() {} -void InitGraphics(int argc, char **argv) {} -void ExitGraphics(void) {} diff --git a/client/loclass/elite_crack.c b/client/loclass/elite_crack.c index ebe82297..a96ca7ed 100644 --- a/client/loclass/elite_crack.c +++ b/client/loclass/elite_crack.c @@ -502,7 +502,7 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[]) uint8_t i; int errors = 0; size_t itemsize = sizeof(dumpdata); - clock_t t1 = clock(); + uint64_t t1 = msclock(); dumpdata* attack = (dumpdata* ) malloc(itemsize); @@ -512,7 +512,7 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[]) errors += bruteforceItem(*attack, keytable); } free(attack); - t1 = clock() - t1; + t1 = msclock() - t1; float diff = ((float)t1 / CLOCKS_PER_SEC ); prnlog("\nPerformed full crack in %f seconds",diff);