some time_t issues

This commit is contained in:
iceman1001 2017-07-28 01:35:49 +02:00
commit 3d53f941aa
4 changed files with 17 additions and 61 deletions

View file

@ -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;
@ -893,11 +890,9 @@ int CmdHF14AMfNested(const char *Cmd) {
}
}
}
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;
}

View file

@ -13,6 +13,7 @@
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <time.h>
#include "proxmark3.h"
#include "ui.h"
#include "graph.h"

View file

@ -1,27 +0,0 @@
//-----------------------------------------------------------------------------
// Copyright (C) 2009 Michael Gernoth <michael at gernoth.net>
//
// 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 <stdio.h>
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) {}

View file

@ -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);