style
This commit is contained in:
1 parent
2fc36d73c9
commit
0be35a8e7e
33 files changed
+448
-448
No files matched your search
+9
-9
@@ -166,16 +166,16 @@ int CmdHFSearch(const char *Cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
PROMPT_CLEARLINE;
|
||||
PrintAndLogEx(INPLACE, " Searching for FeliCa tag...");
|
||||
if (IfPm3Felica()) {
|
||||
if (readFelicaUid(false) == PM3_SUCCESS) {
|
||||
PrintAndLogEx(NORMAL, "\nValid " _GREEN_("ISO18092 / FeliCa tag") " found\n");
|
||||
res = PM3_SUCCESS;
|
||||
/*
|
||||
PROMPT_CLEARLINE;
|
||||
PrintAndLogEx(INPLACE, " Searching for FeliCa tag...");
|
||||
if (IfPm3Felica()) {
|
||||
if (readFelicaUid(false) == PM3_SUCCESS) {
|
||||
PrintAndLogEx(NORMAL, "\nValid " _GREEN_("ISO18092 / FeliCa tag") " found\n");
|
||||
res = PM3_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
*/
|
||||
/*
|
||||
PROMPT_CLEARLINE;
|
||||
PrintAndLogEx(INPLACE, " Searching for CryptoRF tag...");
|
||||
|
||||
@@ -114,7 +114,7 @@ static int usage_hf_14b_dump(void) {
|
||||
"Example:\n"
|
||||
_YELLOW_("\thf 14b dump f\n")
|
||||
_YELLOW_("\thf 14b dump 2 f mydump")
|
||||
);
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -752,7 +752,7 @@ static int CmdHF14BReadSri(const char *Cmd) {
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_SRI_READ, blocks, 0, 0, NULL, 0);
|
||||
|
||||
|
||||
// iceman: should download read data and print in client.
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
+11
-11
@@ -420,7 +420,7 @@ static int nxp_15693_print_signature(uint8_t *uid, uint8_t *signature) {
|
||||
0x29, 0x29, 0xfd, 0xcd, 0x69, 0x8b, 0x34, 0x68, 0xf2
|
||||
}
|
||||
};
|
||||
*/
|
||||
*/
|
||||
uint8_t i;
|
||||
bool is_valid = false;
|
||||
for (i = 0; i < ARRAYLEN(nxp_15693_public_keys); i++) {
|
||||
@@ -526,7 +526,7 @@ static bool getUID(bool loop, uint8_t *buf) {
|
||||
|
||||
int resplen = resp.oldarg[0];
|
||||
if (resplen >= 12 && CheckCrc15(resp.data.asBytes, 12)) {
|
||||
|
||||
|
||||
if (buf)
|
||||
memcpy(buf, resp.data.asBytes + 2, 8);
|
||||
|
||||
@@ -990,7 +990,7 @@ static int CmdHF15Sniff(const char *Cmd) {
|
||||
SendCommandNG(CMD_HF_ISO15693_SNIFF, NULL, 0);
|
||||
|
||||
WaitForResponse(CMD_HF_ISO15693_SNIFF, &resp);
|
||||
|
||||
|
||||
PrintAndLogEx(HINT, "Try `" _YELLOW_("hf 15 list") "` to view captured tracelog");
|
||||
PrintAndLogEx(HINT, "Try `" _YELLOW_("trace save h") "` to save tracelog for later analysing");
|
||||
return PM3_SUCCESS;
|
||||
@@ -1024,7 +1024,7 @@ static int CmdHF15Sim(const char *Cmd) {
|
||||
|
||||
PacketResponseNG resp;
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_ISO15693_SIMULATE, (uint8_t*)&payload, sizeof(payload));
|
||||
SendCommandNG(CMD_HF_ISO15693_SIMULATE, (uint8_t *)&payload, sizeof(payload));
|
||||
WaitForResponse(CMD_HF_ISO15693_SIMULATE, &resp);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
@@ -1358,7 +1358,7 @@ static int CmdHF15Raw(const char *Cmd) {
|
||||
}
|
||||
|
||||
PacketResponseNG resp;
|
||||
clearCommandBuffer();
|
||||
clearCommandBuffer();
|
||||
SendCommandMIX(CMD_HF_ISO15693_COMMAND, datalen, fast, reply, data, datalen);
|
||||
|
||||
if (reply) {
|
||||
@@ -1442,7 +1442,7 @@ static int CmdHF15Readmulti(const char *Cmd) {
|
||||
}
|
||||
|
||||
uint8_t *data = resp.data.asBytes;
|
||||
|
||||
|
||||
if (CheckCrc15(data, status) == false) {
|
||||
PrintAndLogEx(FAILED, "crc (" _RED_("fail") ")");
|
||||
return PM3_ESOFT;
|
||||
@@ -1741,7 +1741,7 @@ static int CmdHF15Restore(const char *Cmd) {
|
||||
}
|
||||
free(data);
|
||||
PrintAndLogEx(INFO, "done");
|
||||
PrintAndLogEx(HINT, "try `" _YELLOW_("hf 15 dump") "` to read your card to verify" );
|
||||
PrintAndLogEx(HINT, "try `" _YELLOW_("hf 15 dump") "` to read your card to verify");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1779,10 +1779,10 @@ static int CmdHF15CSetUID(const char *Cmd) {
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, "updating tag uid...");
|
||||
|
||||
|
||||
PacketResponseNG resp;
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_ISO15693_CSETUID, (uint8_t*)&payload, sizeof(payload));
|
||||
SendCommandNG(CMD_HF_ISO15693_CSETUID, (uint8_t *)&payload, sizeof(payload));
|
||||
|
||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_CSETUID, &resp, 2000) == false) {
|
||||
PrintAndLogEx(WARNING, "timeout while waiting for reply");
|
||||
@@ -1799,10 +1799,10 @@ static int CmdHF15CSetUID(const char *Cmd) {
|
||||
uint8_t revuid[8] = {0};
|
||||
uint8_t i = 0;
|
||||
while (i < sizeof(revuid)) {
|
||||
revuid[i] = carduid[7-i];
|
||||
revuid[i] = carduid[7 - i];
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
if (memcmp(revuid, payload.uid, 8) != 0) {
|
||||
PrintAndLogEx(FAILED, "setting new UID (" _RED_("failed") ")");
|
||||
return PM3_ESOFT;
|
||||
|
||||
@@ -59,7 +59,7 @@ static int usage_hf_cryptorf_sniff(void) {
|
||||
}
|
||||
static int usage_hf_cryptorf_sim(void) {
|
||||
PrintAndLogEx(NORMAL, "Emulating CryptoRF tag with emulator memory\n"
|
||||
"Usage: hf cryptorf sim [h] \n"
|
||||
"Usage: hf cryptorf sim [h] \n"
|
||||
"Options:\n"
|
||||
" h this help\n"
|
||||
"\n"
|
||||
|
||||
+14
-14
@@ -26,16 +26,16 @@ static int CmdHelp(const char *Cmd);
|
||||
|
||||
static int usage_epa_collect(void) {
|
||||
PrintAndLogEx(NORMAL, "Tries to collect nonces when doing part of PACE protocol.\n"
|
||||
"\n"
|
||||
"Usage: hf epa cnonces <m> <n> <d>\n"
|
||||
"Options:\n"
|
||||
"\t<m> nonce size\n"
|
||||
"\t<n> number of nonces to collect\n"
|
||||
"\t<d> delay between\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
_YELLOW_("\thf epa cnonces 4 4 1")
|
||||
);
|
||||
"\n"
|
||||
"Usage: hf epa cnonces <m> <n> <d>\n"
|
||||
"Options:\n"
|
||||
"\t<m> nonce size\n"
|
||||
"\t<n> number of nonces to collect\n"
|
||||
"\t<d> delay between\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
_YELLOW_("\thf epa cnonces 4 4 1")
|
||||
);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -60,18 +60,18 @@ static int CmdHFEPACollectPACENonces(const char *Cmd) {
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Collecting %u %u byte nonces", n, m);
|
||||
PrintAndLogEx(SUCCESS, "Start: %" PRIu64, msclock() / 1000);
|
||||
|
||||
|
||||
struct p {
|
||||
uint32_t m;
|
||||
} PACKED payload;
|
||||
payload.m = m;
|
||||
|
||||
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
// execute PACE
|
||||
|
||||
PacketResponseNG resp;
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_EPA_COLLECT_NONCE, (uint8_t*)&payload, sizeof(payload));
|
||||
SendCommandNG(CMD_HF_EPA_COLLECT_NONCE, (uint8_t *)&payload, sizeof(payload));
|
||||
|
||||
WaitForResponse(CMD_HF_EPA_COLLECT_NONCE, &resp);
|
||||
|
||||
@@ -92,7 +92,7 @@ static int CmdHFEPACollectPACENonces(const char *Cmd) {
|
||||
sleep(d);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PrintAndLogEx(SUCCESS, "End: %" PRIu64, msclock() / 1000);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
+17
-17
@@ -388,7 +388,7 @@ static int cmp_uint32(const void *a, const void *b) {
|
||||
return mx > my;
|
||||
}
|
||||
|
||||
bool check_known_default(uint8_t *csn, uint8_t *epurse, uint8_t* rmac, uint8_t* tmac, uint8_t* key) {
|
||||
bool check_known_default(uint8_t *csn, uint8_t *epurse, uint8_t *rmac, uint8_t *tmac, uint8_t *key) {
|
||||
|
||||
iclass_prekey_t *prekey = calloc(ICLASS_KEYS_MAX, sizeof(iclass_prekey_t));
|
||||
if (prekey == false) {
|
||||
@@ -399,14 +399,14 @@ bool check_known_default(uint8_t *csn, uint8_t *epurse, uint8_t* rmac, uint8_t*
|
||||
memcpy(ccnr, epurse, 8);
|
||||
memcpy(ccnr + 8, rmac, 4);
|
||||
|
||||
GenerateMacKeyFrom(csn, ccnr, false, false, (uint8_t*)iClass_Key_Table, ICLASS_KEYS_MAX, prekey);
|
||||
GenerateMacKeyFrom(csn, ccnr, false, false, (uint8_t *)iClass_Key_Table, ICLASS_KEYS_MAX, prekey);
|
||||
qsort(prekey, ICLASS_KEYS_MAX, sizeof(iclass_prekey_t), cmp_uint32);
|
||||
|
||||
iclass_prekey_t lookup;
|
||||
memcpy(lookup.mac, tmac, 4);
|
||||
|
||||
// binsearch
|
||||
iclass_prekey_t * item = (iclass_prekey_t *) bsearch(&lookup, prekey, ICLASS_KEYS_MAX, sizeof(iclass_prekey_t), cmp_uint32);
|
||||
iclass_prekey_t *item = (iclass_prekey_t *) bsearch(&lookup, prekey, ICLASS_KEYS_MAX, sizeof(iclass_prekey_t), cmp_uint32);
|
||||
if (item != NULL) {
|
||||
memcpy(key, item->key, 8);
|
||||
return true;
|
||||
@@ -1268,7 +1268,7 @@ static int CmdHFiClassEView(const char *Cmd) {
|
||||
free(dump);
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
if (verbose) {
|
||||
print_picopass_header((picopass_hdr *) dump);
|
||||
print_picopass_info((picopass_hdr *) dump);
|
||||
@@ -1279,18 +1279,18 @@ static int CmdHFiClassEView(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, "------+----+-------------------------+----------");
|
||||
PrintAndLogEx(INFO, " CSN |0x00| " _GREEN_("%s") "|", sprint_hex(csn, 8));
|
||||
printIclassDumpContents(dump, 1, blocks, bytes);
|
||||
|
||||
/*
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "----+-------------------------+---------");
|
||||
PrintAndLogEx(INFO, "blk | data | ascii");
|
||||
PrintAndLogEx(INFO, "----+-------------------------+---------");
|
||||
for (uint16_t i = 0; i < blocks; i++){
|
||||
PrintAndLogEx(INFO, "%03d | %s ", i, sprint_hex_ascii(dump + (i * 8) , 8) );
|
||||
}
|
||||
PrintAndLogEx(INFO, "----+-------------------------+---------");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
*/
|
||||
|
||||
/*
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "----+-------------------------+---------");
|
||||
PrintAndLogEx(INFO, "blk | data | ascii");
|
||||
PrintAndLogEx(INFO, "----+-------------------------+---------");
|
||||
for (uint16_t i = 0; i < blocks; i++){
|
||||
PrintAndLogEx(INFO, "%03d | %s ", i, sprint_hex_ascii(dump + (i * 8) , 8) );
|
||||
}
|
||||
PrintAndLogEx(INFO, "----+-------------------------+---------");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
*/
|
||||
free(dump);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
@@ -2247,7 +2247,7 @@ static int CmdHFiClassRestore(const char *Cmd) {
|
||||
|
||||
if (startblock < 5) {
|
||||
PrintAndLogEx(WARNING, "you cannot write key blocks this way. yet... make your start block > 4");
|
||||
return PM3_EINVARG;
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
int total_bytes = (((endblock - startblock) + 1) * 12);
|
||||
|
||||
@@ -41,5 +41,5 @@ void PrintPreCalcMac(uint8_t *keys, uint32_t keycnt, iclass_premac_t *pre_list);
|
||||
void PrintPreCalc(iclass_prekey_t *list, uint32_t itemcnt);
|
||||
|
||||
uint8_t get_pagemap(const picopass_hdr *hdr);
|
||||
bool check_known_default(uint8_t *csn, uint8_t *epurse, uint8_t* rmac, uint8_t* tmac, uint8_t* key);
|
||||
bool check_known_default(uint8_t *csn, uint8_t *epurse, uint8_t *rmac, uint8_t *tmac, uint8_t *key);
|
||||
#endif
|
||||
+12
-12
@@ -590,13 +590,13 @@ static int CmdLegicSim(const char *Cmd) {
|
||||
uint8_t tagtype;
|
||||
bool send_reply;
|
||||
} PACKED payload;
|
||||
|
||||
|
||||
payload.send_reply = true;
|
||||
payload.tagtype = param_get8ex(Cmd, 0, 1, 10);
|
||||
if (payload.tagtype > 2 ) {
|
||||
return usage_legic_sim();
|
||||
}
|
||||
|
||||
if (payload.tagtype > 2) {
|
||||
return usage_legic_sim();
|
||||
}
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_LEGIC_SIMULATE, (uint8_t *)&payload, sizeof(payload));
|
||||
PacketResponseNG resp;
|
||||
@@ -605,15 +605,15 @@ static int CmdLegicSim(const char *Cmd) {
|
||||
bool keypress = kbd_enter_pressed();
|
||||
while (keypress == false) {
|
||||
keypress = kbd_enter_pressed();
|
||||
|
||||
if (WaitForResponseTimeout(CMD_HF_LEGIC_SIMULATE, &resp, 1500)) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (keypress)
|
||||
if (WaitForResponseTimeout(CMD_HF_LEGIC_SIMULATE, &resp, 1500)) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (keypress)
|
||||
SendCommandNG(CMD_BREAK_LOOP, NULL, 0);
|
||||
|
||||
|
||||
PrintAndLogEx(INFO, "Done");
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
+12
-12
@@ -339,7 +339,7 @@ void annotateIclass(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool
|
||||
static uint8_t rmac[4];
|
||||
static uint8_t tmac[4];
|
||||
|
||||
if ( isResponse == false ) {
|
||||
if (isResponse == false) {
|
||||
uint8_t c = cmd[0] & 0x0F;
|
||||
uint8_t parity = 0;
|
||||
for (uint8_t i = 0; i < 7; i++) {
|
||||
@@ -409,17 +409,17 @@ void annotateIclass(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
if (curr_state == PICO_SELECT) {
|
||||
memcpy(csn, cmd, 8);
|
||||
curr_state = PICO_NONE;
|
||||
} else if (curr_state == PICO_AUTH_EPURSE) {
|
||||
memcpy(epurse, cmd, 8);
|
||||
} else if ( curr_state == PICO_AUTH_MACS) {
|
||||
} else if (curr_state == PICO_AUTH_MACS) {
|
||||
|
||||
uint8_t key[8];
|
||||
if (check_known_default(csn, epurse, rmac, tmac, key)) {
|
||||
snprintf(exp, size, "( " _GREEN_("%s") ")", sprint_hex(key, 8) );
|
||||
snprintf(exp, size, "( " _GREEN_("%s") ")", sprint_hex(key, 8));
|
||||
}
|
||||
curr_state = PICO_NONE;
|
||||
}
|
||||
@@ -438,11 +438,11 @@ void annotateIso15693(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
||||
snprintf(exp, size, "STAY_QUIET");
|
||||
return;
|
||||
case ISO15693_READBLOCK: {
|
||||
|
||||
|
||||
uint8_t block = 0;
|
||||
if (cmdsize == 13)
|
||||
block = cmd[10];
|
||||
|
||||
|
||||
snprintf(exp, size, "READBLOCK(%d)", block);
|
||||
return;
|
||||
}
|
||||
@@ -560,7 +560,7 @@ void annotateIso15693(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
||||
|
||||
if (cmd[1] > ISO15693_STAYQUIET && cmd[1] < ISO15693_READBLOCK) snprintf(exp, size, "Mandatory RFU");
|
||||
else if (cmd[1] > ISO15693_READ_MULTI_SECSTATUS && cmd[1] <= 0x9F) snprintf(exp, size, "Optional RFU");
|
||||
// else if (cmd[1] >= 0xA0 && cmd[1] <= 0xDF) snprintf(exp, size, "Cust IC MFG dependent");
|
||||
// else if (cmd[1] >= 0xA0 && cmd[1] <= 0xDF) snprintf(exp, size, "Cust IC MFG dependent");
|
||||
else if (cmd[1] > ISO15693_READ_SIGNATURE && cmd[1] <= 0xDF) snprintf(exp, size, "Cust IC MFG dependent");
|
||||
else if (cmd[1] >= 0xE0) snprintf(exp, size, "Proprietary IC MFG dependent");
|
||||
else
|
||||
@@ -612,8 +612,8 @@ void annotateTopaz(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
||||
// iso 7816-3
|
||||
void annotateIso7816(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
||||
|
||||
if (cmdsize < 2)
|
||||
return;
|
||||
if (cmdsize < 2)
|
||||
return;
|
||||
|
||||
// S-block
|
||||
if ((cmd[0] & 0xC0) && (cmdsize == 3)) {
|
||||
@@ -999,13 +999,13 @@ void annotateCryptoRF(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize) {
|
||||
break;
|
||||
case CRYPTORF_DESELECT:
|
||||
snprintf(exp, size, "DESELECT");
|
||||
break;
|
||||
break;
|
||||
case CRYPTORF_IDLE:
|
||||
snprintf(exp, size, "IDLE");
|
||||
break;
|
||||
break;
|
||||
case CRYPTORF_CHECK_PASSWORD:
|
||||
snprintf(exp, size, "CHECK PWD");
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
snprintf(exp, size, "?");
|
||||
break;
|
||||
|
||||
+37
-37
@@ -594,9 +594,9 @@ static int32_t initSectorTable(sector_t **src, int32_t items) {
|
||||
return items;
|
||||
}
|
||||
|
||||
static void decode_print_st(uint16_t blockno, uint8_t* data) {
|
||||
static void decode_print_st(uint16_t blockno, uint8_t *data) {
|
||||
if (mfIsSectorTrailer(blockno)) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(NORMAL, "Sector trailer decoded:");
|
||||
PrintAndLogEx(NORMAL, "----------------------------------------------");
|
||||
PrintAndLogEx(NORMAL, "Key A " _GREEN_("%s"), sprint_hex_inrow(data, 6));
|
||||
@@ -756,7 +756,7 @@ static int CmdHF14AMfRdBl(const char *Cmd) {
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
if ((data[6] || data[7] || data[8])) {
|
||||
if ((data[6] || data[7] || data[8])) {
|
||||
decode_print_st(blockNo, data);
|
||||
}
|
||||
} else {
|
||||
@@ -811,7 +811,7 @@ static int CmdHF14AMfRdSc(const char *Cmd) {
|
||||
|
||||
PrintAndLogEx(NORMAL, "isOk:%02x", isOK);
|
||||
if (isOK) {
|
||||
|
||||
|
||||
uint8_t blocks = 4;
|
||||
uint8_t start = sectorNo * 4;
|
||||
if (sectorNo > 32) {
|
||||
@@ -819,9 +819,9 @@ static int CmdHF14AMfRdSc(const char *Cmd) {
|
||||
start = 128 + (sectorNo - 32) * 16;
|
||||
}
|
||||
for (int i = 0; i < blocks; i++) {
|
||||
PrintAndLogEx(NORMAL, "%3d | %s", start + i, sprint_hex(data + (i * 16) , 16));
|
||||
PrintAndLogEx(NORMAL, "%3d | %s", start + i, sprint_hex(data + (i * 16), 16));
|
||||
}
|
||||
decode_print_st(start + blocks - 1, data + ((blocks - 1) * 16) );
|
||||
decode_print_st(start + blocks - 1, data + ((blocks - 1) * 16));
|
||||
}
|
||||
} else {
|
||||
PrintAndLogEx(WARNING, "Command execute timeout");
|
||||
@@ -914,10 +914,10 @@ static int FastDumpWithEcFill(uint8_t numsectors) {
|
||||
PrintAndLogEx(WARNING, "Command execute timeout");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
if (resp.status != PM3_SUCCESS) {
|
||||
PrintAndLogEx(INFO, "fast dump reported back failure w KEY A, swapping to KEY B");
|
||||
|
||||
|
||||
// ecfill key B
|
||||
payload.keytype = 1;
|
||||
|
||||
@@ -928,7 +928,7 @@ static int FastDumpWithEcFill(uint8_t numsectors) {
|
||||
PrintAndLogEx(WARNING, "Command execute timeout");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
if (resp.status != PM3_SUCCESS) {
|
||||
PrintAndLogEx(INFO, "fast dump reported back failure w KEY B");
|
||||
PrintAndLogEx(INFO, "Dump file is " _RED_("PARTIAL") " complete");
|
||||
@@ -2127,7 +2127,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
|
||||
free(e_sector);
|
||||
return prng_type;
|
||||
}
|
||||
|
||||
|
||||
// check if tag doesn't have static nonce
|
||||
has_staticnonce = detect_classic_static_nonce();
|
||||
|
||||
@@ -2471,13 +2471,13 @@ noValidKeyFound:
|
||||
} else {
|
||||
if (verbose) {
|
||||
PrintAndLogEx(WARNING, "unknown B key: sector: %3d key type: %c",
|
||||
current_sector_i,
|
||||
current_key_type_i ? 'B' : 'A'
|
||||
);
|
||||
current_sector_i,
|
||||
current_key_type_i ? 'B' : 'A'
|
||||
);
|
||||
PrintAndLogEx(INFO, " -- reading the B key was not possible, maybe due to access rights?");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "======================= " _YELLOW_("STOP READ B KEY ATTACK") " =======================");
|
||||
@@ -2489,7 +2489,7 @@ noValidKeyFound:
|
||||
skipReadBKey:
|
||||
if (e_sector[current_sector_i].foundKey[current_key_type_i] == 0) {
|
||||
|
||||
if (has_staticnonce)
|
||||
if (has_staticnonce)
|
||||
goto tryStaticnested;
|
||||
|
||||
if (prng_type && (nested_failed == false)) {
|
||||
@@ -2502,7 +2502,7 @@ skipReadBKey:
|
||||
}
|
||||
tryNested:
|
||||
isOK = mfnested(FirstBlockOfSector(blockNo), keyType, key, FirstBlockOfSector(current_sector_i), current_key_type_i, tmp_key, calibrate);
|
||||
|
||||
|
||||
switch (isOK) {
|
||||
case PM3_ETIMEOUT: {
|
||||
PrintAndLogEx(ERR, "\nError: No response from Proxmark3.");
|
||||
@@ -2543,7 +2543,7 @@ tryNested:
|
||||
PrintAndLogEx(ERR, "unknown Error.\n");
|
||||
free(e_sector);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "======================= " _YELLOW_("STOP NESTED ATTACK") " =======================");
|
||||
@@ -2588,16 +2588,16 @@ tryHardnested: // If the nested attack fails then we try the hardnested attack
|
||||
PrintAndLogEx(INFO, "======================= " _YELLOW_("STOP HARDNESTED ATTACK") " =======================");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (has_staticnonce) {
|
||||
tryStaticnested:
|
||||
if (verbose) {
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "======================= " _YELLOW_("START STATIC NESTED ATTACK") " =======================");
|
||||
PrintAndLogEx(INFO, "sector no: %3d, target key type: %c",
|
||||
current_sector_i,
|
||||
current_key_type_i ? 'B' : 'A');
|
||||
}
|
||||
|
||||
|
||||
isOK = mfStaticNested(blockNo, keyType, key, FirstBlockOfSector(current_sector_i), current_key_type_i, tmp_key);
|
||||
DropField();
|
||||
switch (isOK) {
|
||||
@@ -2620,12 +2620,12 @@ tryStaticnested:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (verbose) {
|
||||
PrintAndLogEx(INFO, "======================= " _YELLOW_("STOP STATIC NESTED ATTACK") " =======================");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if the key was found
|
||||
if (e_sector[current_sector_i].foundKey[current_key_type_i]) {
|
||||
PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [" _YELLOW_("%s") "]",
|
||||
@@ -2657,7 +2657,7 @@ all_found:
|
||||
// clear emulator mem
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_MIFARE_EML_MEMCLR, NULL, 0);
|
||||
|
||||
|
||||
PrintAndLogEx(SUCCESS, "transferring keys to simulator memory (Cmd Error: 04 can occur)");
|
||||
|
||||
for (current_sector_i = 0; current_sector_i < sectors_cnt; current_sector_i++) {
|
||||
@@ -3876,13 +3876,13 @@ static int CmdHF14AMfEView(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
|
||||
PrintAndLogEx(INFO, "blk | data | ascii");
|
||||
PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
|
||||
for (uint16_t i = 0; i < blocks; i++){
|
||||
for (uint16_t i = 0; i < blocks; i++) {
|
||||
if (i == 0) {
|
||||
PrintAndLogEx(INFO, "%03d | " _RED_("%s"), i, sprint_hex_ascii(dump + (i * 16) , 16) );
|
||||
PrintAndLogEx(INFO, "%03d | " _RED_("%s"), i, sprint_hex_ascii(dump + (i * 16), 16));
|
||||
} else if (mfIsSectorTrailer(i)) {
|
||||
PrintAndLogEx(INFO, "%03d | " _YELLOW_("%s"), i, sprint_hex_ascii(dump + (i * 16) , 16) );
|
||||
PrintAndLogEx(INFO, "%03d | " _YELLOW_("%s"), i, sprint_hex_ascii(dump + (i * 16), 16));
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "%03d | %s ", i, sprint_hex_ascii(dump + (i * 16) , 16) );
|
||||
PrintAndLogEx(INFO, "%03d | %s ", i, sprint_hex_ascii(dump + (i * 16), 16));
|
||||
}
|
||||
}
|
||||
PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
|
||||
@@ -4462,11 +4462,11 @@ static int CmdHF14AMfCView(const char *Cmd) {
|
||||
|
||||
bool errors = false;
|
||||
int flags;
|
||||
char ctmp = '1';
|
||||
char ctmp = '1';
|
||||
uint8_t cmdp = 0;
|
||||
uint8_t numblocks = NumOfBlocks(ctmp);
|
||||
uint16_t bytes = numblocks * MFBLOCK_SIZE;
|
||||
|
||||
|
||||
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
||||
ctmp = tolower(param_getchar(Cmd, cmdp));
|
||||
switch (ctmp) {
|
||||
@@ -4486,7 +4486,7 @@ static int CmdHF14AMfCView(const char *Cmd) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (errors) return usage_hf14_cview();
|
||||
|
||||
PrintAndLogEx(SUCCESS, "View magic MIFARE " _GREEN_("%cK"), ctmp);
|
||||
@@ -4540,14 +4540,14 @@ static int CmdHF14AMfCView(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
|
||||
PrintAndLogEx(INFO, "blk | data | ascii");
|
||||
PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
|
||||
for (uint16_t i = 0; i < numblocks; i++){
|
||||
|
||||
for (uint16_t i = 0; i < numblocks; i++) {
|
||||
|
||||
if (i == 0) {
|
||||
PrintAndLogEx(INFO, "%03d | " _RED_("%s"), i, sprint_hex_ascii(dump + (i * 16) , 16) );
|
||||
PrintAndLogEx(INFO, "%03d | " _RED_("%s"), i, sprint_hex_ascii(dump + (i * 16), 16));
|
||||
} else if (mfIsSectorTrailer(i)) {
|
||||
PrintAndLogEx(INFO, "%03d | " _YELLOW_("%s"), i, sprint_hex_ascii(dump + (i * 16) , 16) );
|
||||
PrintAndLogEx(INFO, "%03d | " _YELLOW_("%s"), i, sprint_hex_ascii(dump + (i * 16), 16));
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "%03d | %s ", i, sprint_hex_ascii(dump + (i * 16) , 16) );
|
||||
PrintAndLogEx(INFO, "%03d | %s ", i, sprint_hex_ascii(dump + (i * 16), 16));
|
||||
}
|
||||
}
|
||||
PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
|
||||
@@ -5250,7 +5250,7 @@ static command_t CommandTable[] = {
|
||||
{"gen3uid", CmdHf14AGen3UID, IfPm3Iso14443a, "Set UID without manufacturer block (magic gen3 card)"},
|
||||
{"gen3blk", CmdHf14AGen3Blk, IfPm3Iso14443a, "Overwrite full manufacturer block (magic gen 3 card)"},
|
||||
{"gen3freez", CmdHf14AGen3Freez, IfPm3Iso14443a, "Lock further UID changes (magic gen 3 card)"},
|
||||
|
||||
|
||||
{"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("i") " -----------------------"},
|
||||
{"ice", CmdHF14AMfice, IfPm3Iso14443a, "collect MIFARE Classic nonces to file"},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
|
||||
@@ -144,7 +144,7 @@ static nxp_cardtype_t getCardType(uint8_t major, uint8_t minor) {
|
||||
return DESFIRE_EV2;
|
||||
|
||||
// DESFire EV3
|
||||
if (major == 0x33 && minor == 0x00 )
|
||||
if (major == 0x33 && minor == 0x00)
|
||||
return DESFIRE_EV3;
|
||||
|
||||
// DESFire Light
|
||||
@@ -1023,7 +1023,7 @@ static int MFPKeyCheck(uint8_t startSector, uint8_t endSector, uint8_t startKeyA
|
||||
PrintAndLogEx(ERR, "\nExchange error. Aborted.");
|
||||
else
|
||||
PrintAndLogEx(NORMAL, "E" NOLF);
|
||||
|
||||
|
||||
DropField();
|
||||
return PM3_ECARDEXCHANGE;
|
||||
}
|
||||
|
||||
@@ -1096,7 +1096,7 @@ uint32_t GetHF14AMfU_Type(void) {
|
||||
else if (memcmp(version, "\x00\x04\x03\x02\x01\x00\x0B", 7) == 0) { tagtype = UL_EV1_48; break; }
|
||||
else if (memcmp(version, "\x00\x04\x03\x01\x01\x00\x0E", 7) == 0) { tagtype = UL_EV1_128; break; }
|
||||
else if (memcmp(version, "\x00\x04\x03\x02\x01\x00\x0E", 7) == 0) { tagtype = UL_EV1_128; break; }
|
||||
else if (memcmp(version, "\x00\x34\x21\x01\x01\x00\x0E", 7) == 0) { tagtype = UL_EV1_128; break; } // Mikron JSC Russia EV1 41 pages tag
|
||||
else if (memcmp(version, "\x00\x34\x21\x01\x01\x00\x0E", 7) == 0) { tagtype = UL_EV1_128; break; } // Mikron JSC Russia EV1 41 pages tag
|
||||
else if (memcmp(version, "\x00\x04\x04\x01\x01\x00\x0B", 7) == 0) { tagtype = NTAG_210; break; }
|
||||
else if (memcmp(version, "\x00\x04\x04\x01\x01\x00\x0E", 7) == 0) { tagtype = NTAG_212; break; }
|
||||
else if (memcmp(version, "\x00\x04\x04\x02\x01\x00\x0F", 7) == 0) { tagtype = NTAG_213; break; }
|
||||
|
||||
@@ -92,7 +92,7 @@ static int CmdCOTAGRead(const char *Cmd) {
|
||||
|
||||
PacketResponseNG resp;
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_LF_COTAG_READ, (uint8_t*)&payload, sizeof(payload));
|
||||
SendCommandNG(CMD_LF_COTAG_READ, (uint8_t *)&payload, sizeof(payload));
|
||||
|
||||
uint8_t timeout = 3;
|
||||
while (!WaitForResponseTimeout(CMD_LF_COTAG_READ, &resp, 2000)) {
|
||||
|
||||
@@ -630,7 +630,7 @@ static int CmdEM410xWrite(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, "Writing " _YELLOW_("%s") " tag with UID 0x%010" PRIx64 " (clock rate: %d)", (card==1) ? "T55x7" : "Q5/T5555", id, clock1);
|
||||
PrintAndLogEx(SUCCESS, "Writing " _YELLOW_("%s") " tag with UID 0x%010" PRIx64 " (clock rate: %d)", (card == 1) ? "T55x7" : "Q5/T5555", id, clock1);
|
||||
// NOTE: We really should pass the clock in as a separate argument, but to
|
||||
// provide for backwards-compatibility for older firmware, and to avoid
|
||||
// having to add another argument to CMD_LF_EM410X_WRITE, we just store
|
||||
@@ -875,7 +875,7 @@ static int EM4x05ReadWord_ext(uint8_t addr, uint32_t pwd, bool usePwd, uint32_t
|
||||
PrintAndLogEx(WARNING, "(EM4x05ReadWord_ext) timeout while waiting for reply.");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
|
||||
if (downloadSamplesEM() == false) {
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ static int CmdKeriClone(const char *Cmd) {
|
||||
// Prepare and write to card
|
||||
// 3 LSB is ONE
|
||||
uint64_t data = ((uint64_t)internalid << 3) + 7;
|
||||
PrintAndLogEx(INFO, "Preparing to clone KERI to " _YELLOW_("%s") " with Internal Id " _YELLOW_("%" PRIx32), (q5) ? "Q5/T5555" : "T55x7",internalid);
|
||||
PrintAndLogEx(INFO, "Preparing to clone KERI to " _YELLOW_("%s") " with Internal Id " _YELLOW_("%" PRIx32), (q5) ? "Q5/T5555" : "T55x7", internalid);
|
||||
|
||||
blocks[1] = data >> 32;
|
||||
blocks[2] = data & 0xFFFFFFFF;
|
||||
@@ -366,7 +366,7 @@ int detectKeri(uint8_t *dest, size_t *size, bool *invert) {
|
||||
uint8_t preamble[] = {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1};
|
||||
|
||||
// sanity check.
|
||||
if (*size < sizeof(preamble) ) return -1;
|
||||
if (*size < sizeof(preamble)) return -1;
|
||||
|
||||
size_t startIdx = 0;
|
||||
size_t found_size = *size;
|
||||
|
||||
@@ -404,7 +404,7 @@ static int CmdLfNedapGen(const char *Cmd) {
|
||||
break;
|
||||
case 'q':
|
||||
cmdp++;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
|
||||
errors = true;
|
||||
@@ -467,13 +467,13 @@ static int CmdLFNedapClone(const char *Cmd) {
|
||||
}
|
||||
bool q5 = (strstr(Cmd, "q") != NULL);
|
||||
if (q5) {
|
||||
if (DemodBufferLen == 64) {
|
||||
if (DemodBufferLen == 64) {
|
||||
blocks[0] = T5555_FIXED | T5555_MODULATION_BIPHASE | T5555_INVERT_OUTPUT | T5555_SET_BITRATE(64) | 2 << T5555_MAXBLOCK_SHIFT;
|
||||
} else {
|
||||
} else {
|
||||
blocks[0] = T5555_FIXED | T5555_MODULATION_BIPHASE | T5555_INVERT_OUTPUT | T5555_SET_BITRATE(64) | 4 << T5555_MAXBLOCK_SHIFT;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8_t i = 1; i < max ; i++) {
|
||||
blocks[i] = bytebits_to_byte(DemodBuffer + ((i - 1) * 32), 32);
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ static int CmdPyramidClone(const char *Cmd) {
|
||||
|
||||
free(bs);
|
||||
|
||||
PrintAndLogEx(INFO, "Preparing to clone Farpointe/Pyramid to " _YELLOW_("%s") " with Facility Code: %u, Card Number: %u", (q5) ? "Q5/T5555" : "T55x7" , facilitycode, cardnumber);
|
||||
PrintAndLogEx(INFO, "Preparing to clone Farpointe/Pyramid to " _YELLOW_("%s") " with Facility Code: %u, Card Number: %u", (q5) ? "Q5/T5555" : "T55x7", facilitycode, cardnumber);
|
||||
print_blocks(blocks, ARRAYLEN(blocks));
|
||||
|
||||
int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks));
|
||||
|
||||
@@ -994,7 +994,7 @@ static int SanityOfflineCheck(bool useGraphBuffer) {
|
||||
|
||||
static void T55xx_Print_DownlinkMode(uint8_t downlink_mode) {
|
||||
char msg[80];
|
||||
snprintf(msg, sizeof(msg) ,"Downlink Mode used : ");
|
||||
snprintf(msg, sizeof(msg), "Downlink Mode used : ");
|
||||
|
||||
switch (downlink_mode) {
|
||||
case 1 :
|
||||
@@ -1075,7 +1075,7 @@ static int CmdT55xxDetect(const char *Cmd) {
|
||||
continue;
|
||||
|
||||
found = true;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -2327,7 +2327,7 @@ static int CmdT55xxDump(const char *Cmd) {
|
||||
strcpy(preferredName, "lf-t55xx");
|
||||
for (uint8_t i = 1; i <= 7; i++) {
|
||||
if ((cardmem[i].blockdata != 0x00) && (cardmem[i].blockdata != 0xFFFFFFFF))
|
||||
snprintf(preferredName + strlen(preferredName), sizeof(preferredName) - strlen(preferredName) , "-%08X", cardmem[i].blockdata);
|
||||
snprintf(preferredName + strlen(preferredName), sizeof(preferredName) - strlen(preferredName), "-%08X", cardmem[i].blockdata);
|
||||
else
|
||||
break;
|
||||
}
|
||||
@@ -3052,7 +3052,7 @@ static int CmdT55xxChkPwds(const char *Cmd) {
|
||||
bool found;
|
||||
uint32_t candidate;
|
||||
} PACKED;
|
||||
struct p* packet = (struct p*)resp.data.asBytes;
|
||||
struct p *packet = (struct p *)resp.data.asBytes;
|
||||
|
||||
if (packet->found) {
|
||||
PrintAndLogEx(SUCCESS, "\nFound a candidate [ " _YELLOW_("%08"PRIX32) " ]", packet->candidate);
|
||||
@@ -3224,7 +3224,7 @@ uint8_t tryOnePassword(uint32_t password, uint8_t downlink_mode) {
|
||||
if (AcquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, password, dl_mode)) {
|
||||
// if (getSignalProperties()->isnoise == false) {
|
||||
// } else {
|
||||
if (tryDetectModulationEx(dl_mode, T55XX_PrintConfig, 0 ,password)) {
|
||||
if (tryDetectModulationEx(dl_mode, T55XX_PrintConfig, 0, password)) {
|
||||
return 1 + (dl_mode << 1);
|
||||
}
|
||||
// }
|
||||
|
||||
@@ -115,10 +115,10 @@ static int CmdVikingClone(const char *Cmd) {
|
||||
num_to_bytes(rawID, 8, &payload.blocks[0]);
|
||||
|
||||
PrintAndLogEx(INFO, "Preparing to clone Viking tag on " _YELLOW_("%s") " - ID " _YELLOW_("%08X")" raw " _YELLOW_("%s")
|
||||
, (Q5) ? "Q5/T5555" : "T55x7"
|
||||
, id
|
||||
, sprint_hex(payload.blocks, sizeof(payload.blocks))
|
||||
);
|
||||
, (Q5) ? "Q5/T5555" : "T55x7"
|
||||
, id
|
||||
, sprint_hex(payload.blocks, sizeof(payload.blocks))
|
||||
);
|
||||
|
||||
clearCommandBuffer();
|
||||
|
||||
|
||||
+14
-14
@@ -334,10 +334,10 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
// Draw the CRC column
|
||||
const char *crc = (crcStatus == 0 ? "!crc" : (crcStatus == 1 ? " ok " : " "));
|
||||
|
||||
// mark short bytes (less than 8 Bit + Parity)
|
||||
if (protocol == ISO_14443A ||
|
||||
protocol == PROTO_MIFARE ||
|
||||
protocol == THINFILM) {
|
||||
// mark short bytes (less than 8 Bit + Parity)
|
||||
if (protocol == ISO_14443A ||
|
||||
protocol == PROTO_MIFARE ||
|
||||
protocol == THINFILM) {
|
||||
|
||||
// approximated with 128 * (9 * data_len);
|
||||
uint16_t bitime = 1056 + 32;
|
||||
@@ -346,17 +346,17 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
|
||||
uint8_t m = 7;
|
||||
while (m > 0) {
|
||||
bitime -= 128;
|
||||
if ( duration > bitime) {
|
||||
bitime -= 128;
|
||||
if (duration > bitime) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
m--;
|
||||
}
|
||||
line[(data_len-1)/16][((data_len-1)%16) * 4 + 2] = '(';
|
||||
line[(data_len-1)/16][((data_len-1)%16) * 4 + 3] = m + 0x30;
|
||||
line[(data_len-1)/16][((data_len-1)%16) * 4 + 4] = ')';
|
||||
}
|
||||
}
|
||||
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 2] = '(';
|
||||
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 3] = m + 0x30;
|
||||
line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 4] = ')';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint32_t previous_end_of_transmission_timestamp = 0;
|
||||
@@ -388,8 +388,8 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
|
||||
annotateHitagS(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
|
||||
break;
|
||||
case ICLASS:
|
||||
annotateIclass(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
|
||||
break;
|
||||
annotateIclass(explanation, sizeof(explanation), frame, data_len, hdr->isResponse);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -429,18 +429,18 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
|
||||
}
|
||||
case jsfIclass: {
|
||||
JsonSaveStr(root, "FileType", "iclass");
|
||||
|
||||
|
||||
picopass_hdr *hdr = (picopass_hdr *)data;
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.CSN", hdr->csn, sizeof(hdr->csn));
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.Configuration",(uint8_t *)&hdr->conf, sizeof(hdr->conf));
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.Configuration", (uint8_t *)&hdr->conf, sizeof(hdr->conf));
|
||||
|
||||
uint8_t pagemap = get_pagemap(hdr);
|
||||
if (pagemap == PICOPASS_NON_SECURE_PAGEMODE) {
|
||||
picopass_ns_hdr *ns_hdr = (picopass_ns_hdr *)data;
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.AIA", ns_hdr->app_issuer_area, sizeof(ns_hdr->app_issuer_area));
|
||||
} else {
|
||||
} else {
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.Epurse", hdr->epurse, sizeof(hdr->epurse));
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.Kd",hdr->key_d, sizeof(hdr->key_d));
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.Kd", hdr->key_d, sizeof(hdr->key_d));
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.Kc", hdr->key_c, sizeof(hdr->key_c));
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.AIA", hdr->app_issuer_area, sizeof(hdr->app_issuer_area));
|
||||
}
|
||||
@@ -1483,9 +1483,9 @@ static int filelist(const char *path, const char *ext, uint8_t last, bool tentat
|
||||
char tmp_fullpath[1024] = {0};
|
||||
strncat(tmp_fullpath, path, sizeof(tmp_fullpath) - 1);
|
||||
strncat(tmp_fullpath, namelist[i]->d_name, strlen(tmp_fullpath) - 1);
|
||||
|
||||
|
||||
if (is_directory(tmp_fullpath)) {
|
||||
|
||||
|
||||
char newpath[1024];
|
||||
if (strcmp(namelist[i]->d_name, ".") == 0 || strcmp(namelist[i]->d_name, "..") == 0)
|
||||
continue;
|
||||
@@ -1496,9 +1496,9 @@ static int filelist(const char *path, const char *ext, uint8_t last, bool tentat
|
||||
|
||||
filelist(newpath, ext, last + ((i == n - 1) << (indent + 1)), tentative, indent + 1, strlen(path));
|
||||
} else {
|
||||
|
||||
|
||||
if ((ext == NULL) || (ext && (str_endswith(namelist[i]->d_name, ext)))) {
|
||||
|
||||
|
||||
for (uint8_t j = 0; j < indent + 1; j++) {
|
||||
PrintAndLogEx(NORMAL, "%s " NOLF, ((last >> j) & 1) ? " " : "│");
|
||||
}
|
||||
|
||||
@@ -43,9 +43,9 @@ static void calc_score(uint8_t *csn, uint8_t *k) {
|
||||
|
||||
if (score >= 2 && badscore < 2) {
|
||||
PrintAndLogEx(NORMAL, "CSN\t%02x%02x%02x%02x%02x%02x%02x%02x\t%02x %02x %02x %02x %02x %02x %02x %02x\t" NOLF
|
||||
, csn[0], csn[1], csn[2], csn[3], csn[4], csn[5], csn[6], csn[7]
|
||||
, k[0], k[1], k[2], k[3], k[4], k[5], k[6], k[7]
|
||||
);
|
||||
, csn[0], csn[1], csn[2], csn[3], csn[4], csn[5], csn[6], csn[7]
|
||||
, k[0], k[1], k[2], k[3], k[4], k[5], k[6], k[7]
|
||||
);
|
||||
|
||||
for (i = 0 ; i < score; i++) {
|
||||
PrintAndLogEx(NORMAL, "%d," NOLF, uniq_vals[i]);
|
||||
|
||||
@@ -1199,11 +1199,11 @@ static int l_cwd(lua_State *L) {
|
||||
|
||||
// ref: https://github.com/RfidResearchGroup/proxmark3/issues/891
|
||||
// redirect LUA's print to Proxmark3 PrintAndLogEx
|
||||
static int l_printandlogex(lua_State* L) {
|
||||
static int l_printandlogex(lua_State *L) {
|
||||
|
||||
int n = lua_gettop(L);
|
||||
for (int i = 1; i <= n; i++) {
|
||||
if (lua_isstring(L, i)) {
|
||||
if (lua_isstring(L, i)) {
|
||||
PrintAndLogEx(NORMAL, "%s", lua_tostring(L, i));
|
||||
}
|
||||
}
|
||||
@@ -1293,7 +1293,7 @@ int set_pm3_libraries(lua_State *L) {
|
||||
|
||||
// remove the global environment table from the stack
|
||||
lua_pop(L, 1);
|
||||
|
||||
|
||||
// print redirect here
|
||||
lua_register(L, "print", l_printandlogex);
|
||||
|
||||
|
||||
Reference in new issue
Block a user