//-----------------------------------------------------------------------------\r
\r
#include <inttypes.h>\r
-#include "cmdhfmf.h"\r
-#include "./nonce2key/nonce2key.h"\r
+#include <string.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <ctype.h>\r
+#include "proxmark3.h"\r
+#include "cmdmain.h"\r
+#include "util.h"\r
+#include "ui.h"\r
+#include "mifarehost.h"\r
+#include "mifare.h"\r
+#include "nonce2key/nonce2key.h"\r
+\r
+#define NESTED_SECTOR_RETRY 10 // how often we try mfested() until we give up\r
+\r
\r
static int CmdHelp(const char *Cmd);\r
\r
return 0;\r
}\r
\r
+\r
+typedef struct {\r
+ uint64_t Key[2];\r
+ int foundKey[2];\r
+} sector_t;\r
+\r
+\r
int CmdHF14AMfNested(const char *Cmd)\r
{\r
int i, j, res, iterations;\r
- sector *e_sector = NULL;\r
+ sector_t *e_sector = NULL;\r
uint8_t blockNo = 0;\r
uint8_t keyType = 0;\r
uint8_t trgBlockNo = 0;\r
}\r
}\r
else { // ------------------------------------ multiple sectors working\r
- clock_t time1;\r
- time1 = clock();\r
+ uint64_t msclock1;\r
+ msclock1 = msclock();\r
\r
- e_sector = calloc(SectorsCnt, sizeof(sector));\r
+ e_sector = calloc(SectorsCnt, sizeof(sector_t));\r
if (e_sector == NULL) return 1;\r
\r
//test current key and additional standard keys first\r
}\r
}\r
\r
- printf("Time in nested: %1.3f (%1.3f sec per key)\n\n", ((float)clock() - time1)/CLOCKS_PER_SEC, ((float)clock() - time1)/iterations/CLOCKS_PER_SEC);\r
+ printf("Time in nested: %1.3f (%1.3f sec per key)\n\n", ((float)(msclock() - msclock1))/1000.0, ((float)(msclock() - msclock1))/iterations/1000.0);\r
\r
PrintAndLog("-----------------------------------------------\nIterations count: %d\n\n", iterations);\r
//print them\r
{\r
uint8_t memBlock[16] = {0x00};\r
uint8_t blockNo = 0;\r
- bool wipeCard = FALSE;\r
+ bool wipeCard = false;\r
int res;\r
\r
if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') {\r