style
This commit is contained in:
1 parent
1107c214c5
commit
97eb0238b1
17 files changed
+191
-160
No files matched your search
+74
-74
@@ -349,13 +349,13 @@ static int mf_save_keys_from_arr(uint16_t n, uint8_t *d) {
|
||||
uint8_t sector = 0;
|
||||
for (uint16_t i = 0; i < n; i++) {
|
||||
if (mfIsSectorTrailer(i)) {
|
||||
// key A offset in ST block
|
||||
memcpy(keys + (MIFARE_KEY_SIZE * sector), d + (i * MFBLOCK_SIZE), MIFARE_KEY_SIZE);
|
||||
// key A offset in ST block
|
||||
memcpy(keys + (MIFARE_KEY_SIZE * sector), d + (i * MFBLOCK_SIZE), MIFARE_KEY_SIZE);
|
||||
|
||||
// key B offset in ST block
|
||||
memcpy(keys + (MIFARE_KEY_SIZE * sectors) + (MIFARE_KEY_SIZE * sector), d + (i * MFBLOCK_SIZE) + 10, MIFARE_KEY_SIZE);
|
||||
// key B offset in ST block
|
||||
memcpy(keys + (MIFARE_KEY_SIZE * sectors) + (MIFARE_KEY_SIZE * sector), d + (i * MFBLOCK_SIZE) + 10, MIFARE_KEY_SIZE);
|
||||
|
||||
sector++;
|
||||
sector++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -484,7 +484,7 @@ static int mf_analyse_st_block(uint8_t blockno, uint8_t *block, bool force) {
|
||||
* @param numSectors: size of the card
|
||||
* @param keyFileName: filename containing keys or NULL.
|
||||
*/
|
||||
static int mfc_read_tag(iso14a_card_select_t *card, uint8_t *carddata, uint8_t numSectors, char *keyfn){
|
||||
static int mfc_read_tag(iso14a_card_select_t *card, uint8_t *carddata, uint8_t numSectors, char *keyfn) {
|
||||
|
||||
// Select card to get UID/UIDLEN/ATQA/SAK information
|
||||
clearCommandBuffer();
|
||||
@@ -517,7 +517,7 @@ static int mfc_read_tag(iso14a_card_select_t *card, uint8_t *carddata, uint8_t n
|
||||
|
||||
size_t alen = 0, blen = 0;
|
||||
uint8_t *keyA, *keyB;
|
||||
if (loadFileBinaryKey(keyfn, "", (void**)&keyA, (void**)&keyB, &alen, &blen) != PM3_SUCCESS) {
|
||||
if (loadFileBinaryKey(keyfn, "", (void **)&keyA, (void **)&keyB, &alen, &blen) != PM3_SUCCESS) {
|
||||
if (keyA) {
|
||||
free(keyA);
|
||||
}
|
||||
@@ -607,7 +607,7 @@ static int mfc_read_tag(iso14a_card_select_t *card, uint8_t *carddata, uint8_t n
|
||||
received = WaitForResponseTimeout(CMD_HF_MIFARE_READBL, &resp, 1500);
|
||||
} else {
|
||||
// data block. Check if it can be read with key A or key B
|
||||
if ((rights[sectorNo][data_area] == 0x03) || (rights[sectorNo][data_area] == 0x05)) {
|
||||
if ((rights[sectorNo][data_area] == 0x03) || (rights[sectorNo][data_area] == 0x05)) {
|
||||
// only key B would work
|
||||
payload.blockno = mfFirstBlockOfSector(sectorNo) + blockNo;
|
||||
payload.keytype = MF_KEY_B;
|
||||
@@ -617,7 +617,7 @@ static int mfc_read_tag(iso14a_card_select_t *card, uint8_t *carddata, uint8_t n
|
||||
SendCommandNG(CMD_HF_MIFARE_READBL, (uint8_t *)&payload, sizeof(mf_readblock_t));
|
||||
received = WaitForResponseTimeout(CMD_HF_MIFARE_READBL, &resp, 1500);
|
||||
} else {
|
||||
// key A would work
|
||||
// key A would work
|
||||
payload.blockno = mfFirstBlockOfSector(sectorNo) + blockNo;
|
||||
payload.keytype = current_key;
|
||||
memcpy(payload.key, (current_key == MF_KEY_A) ? keyA + (sectorNo * MIFARE_KEY_SIZE) : keyB + (sectorNo * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
@@ -649,9 +649,9 @@ static int mfc_read_tag(iso14a_card_select_t *card, uint8_t *carddata, uint8_t n
|
||||
|
||||
uint8_t *data = resp.data.asBytes;
|
||||
|
||||
if (mfIsSectorTrailer(blockNo)) {
|
||||
if (mfIsSectorTrailer(blockNo)) {
|
||||
// sector trailer. Fill in the keys.
|
||||
memcpy(data , keyA + (sectorNo * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
memcpy(data, keyA + (sectorNo * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
memcpy(data + 10, keyB + (sectorNo * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
}
|
||||
|
||||
@@ -1096,7 +1096,7 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
||||
} else if (m2) {
|
||||
numSectors = MIFARE_2K_MAXSECTOR;
|
||||
bytes = MIFARE_2K_MAX_BYTES;
|
||||
} else if (m4) {
|
||||
} else if (m4) {
|
||||
numSectors = MIFARE_4K_MAXSECTOR;
|
||||
bytes = MIFARE_4K_MAX_BYTES;
|
||||
} else {
|
||||
@@ -1259,7 +1259,7 @@ static int CmdHF14AMfRestore(const char *Cmd) {
|
||||
//
|
||||
size_t alen = 0, blen = 0;
|
||||
uint8_t *keyA, *keyB;
|
||||
if (loadFileBinaryKey(keyfilename, "", (void**)&keyA, (void**)&keyB, &alen, &blen) != PM3_SUCCESS) {
|
||||
if (loadFileBinaryKey(keyfilename, "", (void **)&keyA, (void **)&keyB, &alen, &blen) != PM3_SUCCESS) {
|
||||
if (keyA) {
|
||||
free(keyA);
|
||||
}
|
||||
@@ -1354,7 +1354,7 @@ static int CmdHF14AMfRestore(const char *Cmd) {
|
||||
if (kt == MF_KEY_A)
|
||||
memcpy(wdata, keyA + (s * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
else
|
||||
memcpy(wdata, keyB+ (s * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
memcpy(wdata, keyB + (s * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
} else {
|
||||
// use default key to authenticate for the write command
|
||||
memcpy(wdata, default_key, MIFARE_KEY_SIZE);
|
||||
@@ -2518,16 +2518,16 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
||||
sectorno = i;
|
||||
keytype = j;
|
||||
PrintAndLogEx(SUCCESS, "target sector %3u key type %c -- found valid key [ " _GREEN_("%s") " ] (used for nested / hardnested attack)",
|
||||
i,
|
||||
(j == MF_KEY_B) ? 'B' : 'A',
|
||||
sprint_hex_inrow(key, sizeof(key))
|
||||
);
|
||||
i,
|
||||
(j == MF_KEY_B) ? 'B' : 'A',
|
||||
sprint_hex_inrow(key, sizeof(key))
|
||||
);
|
||||
} else {
|
||||
PrintAndLogEx(SUCCESS, "target sector %3u key type %c -- found valid key [ " _GREEN_("%s") " ]",
|
||||
i,
|
||||
(j == MF_KEY_B) ? 'B' : 'A',
|
||||
sprint_hex_inrow(key, sizeof(key))
|
||||
);
|
||||
i,
|
||||
(j == MF_KEY_B) ? 'B' : 'A',
|
||||
sprint_hex_inrow(key, sizeof(key))
|
||||
);
|
||||
}
|
||||
++num_found_keys;
|
||||
}
|
||||
@@ -2645,16 +2645,16 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
||||
sectorno = i;
|
||||
keytype = j;
|
||||
PrintAndLogEx(SUCCESS, "target sector %3u key type %c -- found valid key [ " _GREEN_("%s") " ] (used for nested / hardnested attack)",
|
||||
i,
|
||||
(j == MF_KEY_B) ? 'B' : 'A',
|
||||
sprint_hex_inrow(tmp_key, sizeof(tmp_key))
|
||||
);
|
||||
i,
|
||||
(j == MF_KEY_B) ? 'B' : 'A',
|
||||
sprint_hex_inrow(tmp_key, sizeof(tmp_key))
|
||||
);
|
||||
} else {
|
||||
PrintAndLogEx(SUCCESS, "target sector %3u key type %c -- found valid key [ " _GREEN_("%s") " ]",
|
||||
i,
|
||||
(j == MF_KEY_B) ? 'B' : 'A',
|
||||
sprint_hex_inrow(tmp_key, sizeof(tmp_key))
|
||||
);
|
||||
i,
|
||||
(j == MF_KEY_B) ? 'B' : 'A',
|
||||
sprint_hex_inrow(tmp_key, sizeof(tmp_key))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3839,7 +3839,7 @@ static int CmdHF14AMfSim(const char *Cmd) {
|
||||
|
||||
if ((flags & FLAG_NR_AR_ATTACK) != FLAG_NR_AR_ATTACK)
|
||||
break;
|
||||
|
||||
|
||||
if ((resp.oldarg[0] & 0xffff) != CMD_HF_MIFARE_SIMULATE)
|
||||
break;
|
||||
|
||||
@@ -3949,11 +3949,11 @@ void printKeyTableEx(size_t sectorscnt, sector_t *e_sector, uint8_t start_sector
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, " " _YELLOW_("%03d") " | %03d | %s | %s | %s | %s"
|
||||
, s
|
||||
, mfSectorTrailerOfSector(s)
|
||||
, strA, resA
|
||||
, strB, resB
|
||||
);
|
||||
, s
|
||||
, mfSectorTrailerOfSector(s)
|
||||
, strA, resA
|
||||
, strB, resB
|
||||
);
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, "-----+-----+--------------+---+--------------+----");
|
||||
@@ -4424,7 +4424,7 @@ static int CmdHF14AMfEView(const char *Cmd) {
|
||||
arg_lit0(NULL, "2k", "MIFARE Classic/Plus 2k"),
|
||||
arg_lit0(NULL, "4k", "MIFARE Classic 4k / S70"),
|
||||
arg_lit0("v", "verbose", "verbose output"),
|
||||
arg_lit0(NULL, "sk", "Save extracted keys to file"),
|
||||
arg_lit0(NULL, "sk", "Save extracted keys to file"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
@@ -5901,7 +5901,7 @@ int CmdHFMFNDEFRead(const char *Cmd) {
|
||||
CLIParserFree(ctx);
|
||||
|
||||
uint16_t ndef_aid = NDEF_MFC_AID;
|
||||
if (aidlen == 2){
|
||||
if (aidlen == 2) {
|
||||
ndef_aid = (aid[0] << 8) + aid[1];
|
||||
}
|
||||
|
||||
@@ -6123,7 +6123,7 @@ int CmdHFMFNDEFFormat(const char *Cmd) {
|
||||
//
|
||||
size_t alen = 0, blen = 0;
|
||||
uint8_t *tmpA, *tmpB;
|
||||
if (loadFileBinaryKey(keyFilename, "", (void**)&tmpA, (void**)&tmpB, &alen, &blen) != PM3_SUCCESS) {
|
||||
if (loadFileBinaryKey(keyFilename, "", (void **)&tmpA, (void **)&tmpB, &alen, &blen) != PM3_SUCCESS) {
|
||||
if (tmpA) {
|
||||
free(tmpA);
|
||||
}
|
||||
@@ -6131,13 +6131,13 @@ int CmdHFMFNDEFFormat(const char *Cmd) {
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, "Using `" _YELLOW_("%s") "`", keyFilename);
|
||||
|
||||
for (int i=0; i < numSectors; i++) {
|
||||
memcpy(keyA[i], tmpA + (i *MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
memcpy(keyB[i], tmpB + (i *MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
|
||||
for (int i = 0; i < numSectors; i++) {
|
||||
memcpy(keyA[i], tmpA + (i * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
memcpy(keyB[i], tmpB + (i * MIFARE_KEY_SIZE), MIFARE_KEY_SIZE);
|
||||
}
|
||||
free(tmpA);
|
||||
free(tmpB);
|
||||
free(tmpB);
|
||||
}
|
||||
|
||||
skipfile:
|
||||
@@ -6680,7 +6680,7 @@ static int CmdHf14AMfSuperCard(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
#define SUPER_MAX_TRACES 7
|
||||
#define SUPER_MAX_TRACES 7
|
||||
|
||||
uint8_t trace = 0;
|
||||
uint8_t traces[SUPER_MAX_TRACES][16];
|
||||
@@ -7056,7 +7056,7 @@ static int CmdHF14AMfView(const char *Cmd) {
|
||||
arg_param_begin,
|
||||
arg_str1("f", "file", "<fn>", "filename of dump"),
|
||||
arg_lit0("v", "verbose", "verbose output"),
|
||||
arg_lit0(NULL, "sk", "Save extracted keys to file"),
|
||||
arg_lit0(NULL, "sk", "Save extracted keys to file"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
@@ -7964,24 +7964,24 @@ static int CmdHF14AMfValue(const char *Cmd) {
|
||||
"hf mf value --blk 16 -k FFFFFFFFFFFF -b --get\n"
|
||||
"hf mf value --blk 16 -k FFFFFFFFFFFF --res --transfer 30 --tk FFFFFFFFFFFF --> transfer block 16 value to block 30 (even if block can't be incremented by ACL)\n"
|
||||
"hf mf value --get -d 87D612007829EDFF87D6120011EE11EE\n"
|
||||
);
|
||||
);
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_str0("k", "key", "<hex>", "key, 6 hex bytes"),
|
||||
arg_lit0("a", NULL, "input key type is key A (def)"),
|
||||
arg_lit0("b", NULL, "input key type is key B"),
|
||||
arg_u64_0(NULL, "inc", "<dec>", "Increment value by X (0 - 2147483647)"),
|
||||
arg_u64_0(NULL, "dec", "<dec>", "Decrement value by X (0 - 2147483647)"),
|
||||
arg_u64_0(NULL, "set", "<dec>", "Set value to X (-2147483647 - 2147483647)"),
|
||||
arg_u64_0(NULL, "transfer", "<dec>", "Transfer value to other block (after inc/dec/restore)"),
|
||||
arg_str0(NULL, "tkey", "<hex>", "transfer key, 6 hex bytes (if transfer is preformed to other sector)"),
|
||||
arg_lit0(NULL, "ta", "transfer key type is key A (def)"),
|
||||
arg_lit0(NULL, "tb", "transfer key type is key B"),
|
||||
arg_lit0(NULL, "get", "Get value from block"),
|
||||
arg_lit0(NULL, "res", "Restore (copy value to card buffer, should be used with --transfer)"),
|
||||
arg_int0(NULL, "blk", "<dec>", "block number"),
|
||||
arg_str0("d", "data", "<hex>", "block data to extract values from (16 hex bytes)"),
|
||||
arg_param_end
|
||||
arg_param_begin,
|
||||
arg_str0("k", "key", "<hex>", "key, 6 hex bytes"),
|
||||
arg_lit0("a", NULL, "input key type is key A (def)"),
|
||||
arg_lit0("b", NULL, "input key type is key B"),
|
||||
arg_u64_0(NULL, "inc", "<dec>", "Increment value by X (0 - 2147483647)"),
|
||||
arg_u64_0(NULL, "dec", "<dec>", "Decrement value by X (0 - 2147483647)"),
|
||||
arg_u64_0(NULL, "set", "<dec>", "Set value to X (-2147483647 - 2147483647)"),
|
||||
arg_u64_0(NULL, "transfer", "<dec>", "Transfer value to other block (after inc/dec/restore)"),
|
||||
arg_str0(NULL, "tkey", "<hex>", "transfer key, 6 hex bytes (if transfer is preformed to other sector)"),
|
||||
arg_lit0(NULL, "ta", "transfer key type is key A (def)"),
|
||||
arg_lit0(NULL, "tb", "transfer key type is key B"),
|
||||
arg_lit0(NULL, "get", "Get value from block"),
|
||||
arg_lit0(NULL, "res", "Restore (copy value to card buffer, should be used with --transfer)"),
|
||||
arg_int0(NULL, "blk", "<dec>", "block number"),
|
||||
arg_str0("d", "data", "<hex>", "block data to extract values from (16 hex bytes)"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
@@ -8038,7 +8038,7 @@ static int CmdHF14AMfValue(const char *Cmd) {
|
||||
|
||||
// Action: 0 Increment, 1 - Decrement, 2 - Restore, 3 - Set, 4 - Get, 5 - Decode from data
|
||||
// iceman: TODO - should be enum
|
||||
uint8_t action = 4;
|
||||
uint8_t action = 4;
|
||||
uint32_t value = 0;
|
||||
|
||||
// Need to check we only have 1 of inc/dec/set and get the value from the selected option
|
||||
@@ -8109,10 +8109,10 @@ static int CmdHF14AMfValue(const char *Cmd) {
|
||||
}
|
||||
|
||||
// don't want to write value data and break something
|
||||
if ((blockno == 0) ||
|
||||
(mfIsSectorTrailer(blockno)) ||
|
||||
(trnval == 0) ||
|
||||
(trnval != -1 && mfIsSectorTrailer(trnval))) {
|
||||
if ((blockno == 0) ||
|
||||
(mfIsSectorTrailer(blockno)) ||
|
||||
(trnval == 0) ||
|
||||
(trnval != -1 && mfIsSectorTrailer(trnval))) {
|
||||
PrintAndLogEx(WARNING, "invalid block number, should be a data block");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
@@ -8130,7 +8130,7 @@ static int CmdHF14AMfValue(const char *Cmd) {
|
||||
memcpy(block, (uint8_t *)&value, 4);
|
||||
|
||||
uint8_t cmddata[34];
|
||||
memcpy(cmddata, key, sizeof(key));
|
||||
memcpy(cmddata, key, sizeof(key));
|
||||
// Key == 6 data went to 10, so lets offset 9 for inc/dec
|
||||
|
||||
if (action == 0) {
|
||||
@@ -8141,13 +8141,13 @@ static int CmdHF14AMfValue(const char *Cmd) {
|
||||
}
|
||||
|
||||
// 00 if increment, 01 if decrement, 02 if restore
|
||||
cmddata[9] = action;
|
||||
|
||||
cmddata[9] = action;
|
||||
|
||||
if (trnval != -1) {
|
||||
|
||||
// transfer to block
|
||||
cmddata[10] = trnval;
|
||||
|
||||
cmddata[10] = trnval;
|
||||
|
||||
memcpy(cmddata + 27, transferkey, sizeof(transferkey));
|
||||
if (mfSectorNum(trnval) != mfSectorNum(blockno)) {
|
||||
cmddata[33] = 1; // should send nested auth
|
||||
@@ -8200,7 +8200,7 @@ static int CmdHF14AMfValue(const char *Cmd) {
|
||||
|
||||
if (isok) {
|
||||
PrintAndLogEx(SUCCESS, "Update ... : " _GREEN_("success"));
|
||||
getval = true;
|
||||
getval = true;
|
||||
// all ok so set flag to read current value
|
||||
} else {
|
||||
PrintAndLogEx(FAILED, "Update ... : " _RED_("failed"));
|
||||
|
||||
@@ -510,7 +510,7 @@ static char failstr[250] = "";
|
||||
#endif
|
||||
|
||||
// the probability that a random nonce has a Sum Property K
|
||||
static const float p_K0[NUM_SUMS] = {
|
||||
static const float p_K0[NUM_SUMS] = {
|
||||
0.0290, 0.0083, 0.0006, 0.0339, 0.0048, 0.0934, 0.0119, 0.0489,
|
||||
0.0602, 0.4180, 0.0602, 0.0489, 0.0119, 0.0934, 0.0048, 0.0339,
|
||||
0.0006, 0.0083, 0.0290
|
||||
|
||||
@@ -1006,7 +1006,7 @@ static int MFPKeyCheck(uint8_t startSector, uint8_t endSector, uint8_t startKeyA
|
||||
for (uint8_t keyAB = startKeyAB; keyAB <= endKeyAB; keyAB++) {
|
||||
// main cycle with key check
|
||||
for (int i = 0; i < keyListLen; i++) {
|
||||
|
||||
|
||||
// allow client abort every iteration
|
||||
if (kbd_enter_pressed()) {
|
||||
PrintAndLogEx(WARNING, "\naborted via keyboard!\n");
|
||||
@@ -1052,14 +1052,14 @@ static int MFPKeyCheck(uint8_t startSector, uint8_t endSector, uint8_t startKeyA
|
||||
selectCard = true;
|
||||
msleep(50);
|
||||
|
||||
// break out from keylist check loop,
|
||||
// break out from keylist check loop,
|
||||
break;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
PrintAndLogEx(WARNING, "\nsector %02d key %d [%s] res: %d", sector, keyAB, sprint_hex_inrow(keyList[i], 16), res);
|
||||
|
||||
// RES can be:
|
||||
// RES can be:
|
||||
// PM3_ERFTRANS -7
|
||||
// PM3_EWRONGANSWER -16
|
||||
if (res == PM3_ERFTRANS) {
|
||||
|
||||
@@ -338,7 +338,7 @@ static void printHitag2PaxtonDowngrade(const uint8_t *data) {
|
||||
bytes = (bytes * 0x100) + data[i];
|
||||
}
|
||||
|
||||
for (int j = 0; j< 8; j++) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
num = bytes & mask;
|
||||
skip -= 5;
|
||||
mask = mask >> 5;
|
||||
|
||||
@@ -4028,7 +4028,7 @@ static int CmdT55xxSniff(const char *Cmd) {
|
||||
if (use_graphbuf == false) {
|
||||
|
||||
// make loop to call sniff with skip samples..
|
||||
// then build it up by adding
|
||||
// then build it up by adding
|
||||
CmdLFSniff("");
|
||||
|
||||
}
|
||||
|
||||
@@ -316,9 +316,9 @@ int saveFileJSON(const char *preferredName, JSONFileType ftype, uint8_t *data, s
|
||||
int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data, size_t datalen, bool verbose, void (*callback)(json_t *), savePaths_t e_save_path) {
|
||||
|
||||
if (ftype != jsfCustom) {
|
||||
if (data == NULL || datalen == 0) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
if (data == NULL || datalen == 0) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
|
||||
char *fileName = newfilenamemcopyEx(preferredName, ".json", e_save_path);
|
||||
@@ -2032,8 +2032,8 @@ int searchFile(char **foundpath, const char *pm3dir, const char *searchname, con
|
||||
PrintAndLogEx(FAILED, "Error - can't find `" _YELLOW_("%s") "`", filename);
|
||||
}
|
||||
}
|
||||
free(filename);
|
||||
return res;
|
||||
free(filename);
|
||||
return res;
|
||||
}
|
||||
|
||||
int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumplen) {
|
||||
@@ -2067,7 +2067,7 @@ int pm3_load_dump(const char *fn, void **pdump, size_t *dumplen, size_t maxdumpl
|
||||
}
|
||||
case MCT: {
|
||||
res = loadFileMCT_safe(fn, pdump, dumplen);
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -424,8 +424,8 @@ int DetectHID(uint8_t *d, uint16_t manufacture) {
|
||||
|
||||
int convert_mad_to_arr(uint8_t *in, uint16_t ilen, uint8_t *out, uint16_t *olen) {
|
||||
|
||||
if (in == NULL || out == NULL || ilen == 0 ) {
|
||||
return PM3_EINVARG;
|
||||
if (in == NULL || out == NULL || ilen == 0) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
// MAD detection
|
||||
@@ -464,8 +464,8 @@ int convert_mad_to_arr(uint8_t *in, uint16_t ilen, uint8_t *out, uint16_t *olen)
|
||||
// copy to out (skip ST)
|
||||
memcpy(out, tmp, sizeof(tmp) - MFBLOCK_SIZE);
|
||||
out += sizeof(tmp) - MFBLOCK_SIZE;
|
||||
*olen += sizeof(tmp) -MFBLOCK_SIZE;
|
||||
*olen += sizeof(tmp) - MFBLOCK_SIZE;
|
||||
}
|
||||
}
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
}
|
||||
+11
-11
@@ -313,7 +313,7 @@ static int ndefDecodeSig1(uint8_t *sig, size_t siglen) {
|
||||
if (sigType == stECDSA_P256) {
|
||||
slen = 32;
|
||||
}
|
||||
|
||||
|
||||
PrintAndLogEx(SUCCESS, "\tSignature [%u]...", intsiglen);
|
||||
print_hex_noascii_break(&sig[indx], intsiglen, 32);
|
||||
|
||||
@@ -508,7 +508,7 @@ static int ndefDecodePayloadHandoverRequest(uint8_t *payload, size_t len) {
|
||||
PrintAndLogEx(INFO, _CYAN_("Handover Request"));
|
||||
uint8_t *p = payload;
|
||||
uint8_t major = (*(p) >> 4) & 0x0F;
|
||||
uint8_t minor = *(p) & 0x0F;
|
||||
uint8_t minor = *(p) & 0x0F;
|
||||
p++;
|
||||
|
||||
PrintAndLogEx(INFO, "Version....... " _YELLOW_("%u.%u"), major, minor);
|
||||
@@ -866,7 +866,7 @@ static int ndefDecodeMime_bt(NDEFHeader_t *ndef) {
|
||||
uint8_t rev[6] = {0};
|
||||
reverse_array_copy(ndef->Payload + 2, 6, rev);
|
||||
PrintAndLogEx(INFO, "BT MAC.......... " _YELLOW_("%s"), sprint_hex(rev, sizeof(rev)));
|
||||
|
||||
|
||||
// Let's check payload[8]. Tells us a bit about the UUID's. If 0x07 then it tells us a service UUID is 128bit
|
||||
switch (ndef->Payload[8]) {
|
||||
case 0x02:
|
||||
@@ -903,29 +903,29 @@ static int ndefDecodeMime_bt(NDEFHeader_t *ndef) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// https://raw.githubusercontent.com/haldean/ndef/master/docs/NFCForum-TS-RTD_1.0.pdf
|
||||
// https://raw.githubusercontent.com/haldean/ndef/master/docs/NFCForum-TS-RTD_1.0.pdf
|
||||
static int ndefDecodeExternal_record(NDEFHeader_t *ndef) {
|
||||
|
||||
|
||||
if (ndef->TypeLen == 0) {
|
||||
PrintAndLogEx(INFO, "no type");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
if (ndef->PayloadLen == 0) {
|
||||
PrintAndLogEx(INFO, "no payload");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO
|
||||
, " URN... " _GREEN_("urn:nfc:ext:%.*s")
|
||||
, (int)ndef->TypeLen
|
||||
, ndef->Type
|
||||
);
|
||||
, " URN... " _GREEN_("urn:nfc:ext:%.*s")
|
||||
, (int)ndef->TypeLen
|
||||
, ndef->Type
|
||||
);
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "Payload [%zu]...", ndef->PayloadLen);
|
||||
print_hex_noascii_break(ndef->Payload, ndef->PayloadLen, 32);
|
||||
|
||||
|
||||
// do a character check?
|
||||
if (!strncmp((char *)ndef->Type, "pilet.ee:ekaart:2", ndef->TypeLen)) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
||||
@@ -360,7 +360,8 @@ const static vocabulory_t vocabulory[] = {
|
||||
{ 0, "hf mf gsave" },
|
||||
{ 0, "hf mf gsetblk" },
|
||||
{ 0, "hf mf gview" },
|
||||
{ 0, "hf mf gdmconfig" },
|
||||
{ 0, "hf mf gdmcfg" },
|
||||
{ 0, "hf mf gdmsetcfg" },
|
||||
{ 0, "hf mf gdmsetblk" },
|
||||
{ 0, "hf mf ndefformat" },
|
||||
{ 0, "hf mf ndefread" },
|
||||
|
||||
Reference in new issue
Block a user