uint8_t blockNo = 0;\r
uint8_t keyType = 0;\r
uint8_t key[6] = {0, 0, 0, 0, 0, 0};\r
- uint8_t bldata[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};\r
- \r
+ uint8_t bldata[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; \r
char cmdp = 0x00;\r
\r
if (strlen(Cmd)<3) {\r
PrintAndLog("--block no:%d, key type:%c, key:%s", blockNo, keyType?'B':'A', sprint_hex(key, 6));\r
PrintAndLog("--data: %s", sprint_hex(bldata, 16));\r
\r
- UsbCommand c = {CMD_MIFARE_WRITEBL, {blockNo, keyType, 0}};\r
+ UsbCommand c = {CMD_MIFARE_WRITEBL, {blockNo, keyType, 0}};\r
memcpy(c.d.asBytes, key, 6);\r
memcpy(c.d.asBytes + 10, bldata, 16);\r
- SendCommand(&c);\r
+ SendCommand(&c);\r
\r
UsbCommand resp;\r
if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
{\r
uint8_t blockNo = 0;\r
uint8_t keyType = 0;\r
- uint8_t key[6] = {0, 0, 0, 0, 0, 0};\r
- \r
+ uint8_t key[6] = {0, 0, 0, 0, 0, 0}; \r
char cmdp = 0x00;\r
\r
-\r
if (strlen(Cmd)<3) {\r
PrintAndLog("Usage: hf mf rdbl <block number> <key A/B> <key (12 hex symbols)>");\r
PrintAndLog(" sample: hf mf rdbl 0 A FFFFFFFFFFFF ");\r
}\r
PrintAndLog("--block no:%d, key type:%c, key:%s ", blockNo, keyType?'B':'A', sprint_hex(key, 6));\r
\r
- UsbCommand c = {CMD_MIFARE_READBL, {blockNo, keyType, 0}};\r
+ UsbCommand c = {CMD_MIFARE_READBL, {blockNo, keyType, 0}};\r
memcpy(c.d.asBytes, key, 6);\r
- SendCommand(&c);\r
+ SendCommand(&c);\r
\r
UsbCommand resp;\r
if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {\r
\r
int CmdHF14AMfRestore(const char *Cmd)\r
{\r
- uint8_t sectorNo,blockNo;\r
+ uint8_t sectorNo,blockNo = 0;\r
uint8_t keyType = 0;\r
- uint8_t key[6] = {0xFF};\r
+ uint8_t key[6] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};\r
uint8_t bldata[16] = {0x00};\r
uint8_t keyA[40][6];\r
uint8_t keyB[40][6];\r
- uint8_t numSectors;\r
+ uint8_t numSectors = 0;\r
\r
FILE *fdump;\r
FILE *fkeys;\r
e_sector[i].Key[j] = key64;\r
e_sector[i].foundKey[j] = 1;\r
}\r
+ }\r
+ }\r
// nested sectors\r
iterations = 0;\r
PrintAndLog("nested...");\r
\r
FILE * f;\r
char filename[FILE_PATH_SIZE]={0};\r
- char buf[13];\r
+ char buf[13] = {0x00};\r
uint8_t *keyBlock = NULL, *p;\r
uint8_t stKeyBlock = 20;\r
\r
\r
int CmdHF14AMfESet(const char *Cmd)\r
{\r
- uint8_t memBlock[16];\r
+ uint8_t memBlock[16] = {0x00};\r
uint8_t blockNo = 0;\r
\r
- memset(memBlock, 0x00, sizeof(memBlock));\r
-\r
if (strlen(Cmd) < 3 || param_getchar(Cmd, 0) == 'h') {\r
PrintAndLog("Usage: hf mf eset <block number> <block data (32 hex symbols)>");\r
PrintAndLog(" sample: hf mf eset 1 000102030405060708090a0b0c0d0e0f ");\r
int CmdHF14AMfELoad(const char *Cmd)\r
{\r
FILE * f;\r
- char filename[FILE_PATH_SIZE];\r
+ char filename[FILE_PATH_SIZE] = {0x00};\r
char *fnameptr = filename;\r
char buf[64] = {0x00};\r
uint8_t buf8[64] = {0x00};\r
int CmdHF14AMfESave(const char *Cmd)\r
{\r
FILE * f;\r
- char filename[FILE_PATH_SIZE];\r
+ char filename[FILE_PATH_SIZE] = {0x00};\r
char * fnameptr = filename;\r
- uint8_t buf[64];\r
+ uint8_t buf[64] = {0x00};\r
int i, j, len, numBlocks;\r
int nameParamNo = 1;\r
\r
{\r
int i;\r
uint8_t numSectors;\r
- uint8_t data[16];\r
- uint64_t keyA, keyB;\r
+ uint8_t data[16] = {0x00};\r
+ uint64_t keyA, keyB = 0;\r
\r
if (param_getchar(Cmd, 0) == 'h') {\r
PrintAndLog("It prints the keys loaded in the emulator memory");\r
}\r
\r
int CmdHF14AMfCGetBlk(const char *Cmd) {\r
- uint8_t memBlock[16];\r
+ uint8_t memBlock[16] = {0x00};\r
uint8_t blockNo = 0;\r
int res;\r
- memset(memBlock, 0x00, sizeof(memBlock));\r
\r
if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') {\r
PrintAndLog("Usage: hf mf cgetblk <block number>");\r
int blockLen = 0;\r
int pckNum = 0;\r
int num = 0;\r
- uint8_t uid[7];\r
+ uint8_t uid[7] = {0x00};\r
uint8_t uid_len;\r
uint8_t atqa[2] = {0x00};\r
uint8_t sak;\r