This commit is contained in:
iceman1001 2020-09-07 10:35:09 +02:00
commit 0be35a8e7e
33 changed files with 448 additions and 448 deletions

View file

@ -329,7 +329,7 @@ void EPA_PACE_Collect_Nonce(PacketCommandNG *c) {
struct p { struct p {
uint32_t m; uint32_t m;
} PACKED; } PACKED;
struct p *packet = (struct p*)c->data.asBytes; struct p *packet = (struct p *)c->data.asBytes;
func_return = EPA_PACE_Get_Nonce(packet->m, nonce); func_return = EPA_PACE_Get_Nonce(packet->m, nonce);
// check if the command succeeded // check if the command succeeded

View file

@ -133,10 +133,10 @@ static hf14a_config hf14aconfig = { 0, 0, 0, 0 } ;
void printHf14aConfig(void) { void printHf14aConfig(void) {
DbpString(_CYAN_("HF 14a config")); DbpString(_CYAN_("HF 14a config"));
Dbprintf("[a] Anticol override......%s%s%s", (hf14aconfig.forceanticol==0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forceanticol==1) ? _RED_("Yes: Always do anticol") : "", (hf14aconfig.forceanticol==2) ? _RED_("Yes: Always skip anticol") : ""); Dbprintf("[a] Anticol override......%s%s%s", (hf14aconfig.forceanticol == 0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forceanticol == 1) ? _RED_("Yes: Always do anticol") : "", (hf14aconfig.forceanticol == 2) ? _RED_("Yes: Always skip anticol") : "");
Dbprintf("[b] BCC override..........%s%s%s", (hf14aconfig.forcebcc==0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forcebcc==1) ? _RED_("Yes: Always do CL2") : "", (hf14aconfig.forcebcc==2) ? _RED_("Yes: Always use card BCC") : ""); Dbprintf("[b] BCC override..........%s%s%s", (hf14aconfig.forcebcc == 0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forcebcc == 1) ? _RED_("Yes: Always do CL2") : "", (hf14aconfig.forcebcc == 2) ? _RED_("Yes: Always use card BCC") : "");
Dbprintf("[2] CL2 override..........%s%s%s", (hf14aconfig.forcecl2==0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forcecl2==1) ? _RED_("Yes: Always do CL2") : "", (hf14aconfig.forcecl2==2) ? _RED_("Yes: Always skip CL2") : ""); Dbprintf("[2] CL2 override..........%s%s%s", (hf14aconfig.forcecl2 == 0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forcecl2 == 1) ? _RED_("Yes: Always do CL2") : "", (hf14aconfig.forcecl2 == 2) ? _RED_("Yes: Always skip CL2") : "");
Dbprintf("[3] CL3 override..........%s%s%s", (hf14aconfig.forcecl3==0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forcecl3==1) ? _RED_("Yes: Always do CL3") : "", (hf14aconfig.forcecl3==2) ? _RED_("Yes: Always skip CL3") : ""); Dbprintf("[3] CL3 override..........%s%s%s", (hf14aconfig.forcecl3 == 0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forcecl3 == 1) ? _RED_("Yes: Always do CL3") : "", (hf14aconfig.forcecl3 == 2) ? _RED_("Yes: Always skip CL3") : "");
} }
/** /**
@ -2401,10 +2401,10 @@ int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32
memset(uid_ptr, 0, 10); memset(uid_ptr, 0, 10);
} }
if ( hf14aconfig.forceanticol == 0 ) { if (hf14aconfig.forceanticol == 0) {
// check for proprietary anticollision: // check for proprietary anticollision:
if ((resp[0] & 0x1F) == 0) return 3; if ((resp[0] & 0x1F) == 0) return 3;
} else if ( hf14aconfig.forceanticol == 2 ) { } else if (hf14aconfig.forceanticol == 2) {
return 3; // force skipping anticol return 3; // force skipping anticol
} // else force executing } // else force executing
@ -2479,10 +2479,10 @@ int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32
uint8_t bcc = sel_uid[2] ^ sel_uid[3] ^ sel_uid[4] ^ sel_uid[5]; // calculate BCC uint8_t bcc = sel_uid[2] ^ sel_uid[3] ^ sel_uid[4] ^ sel_uid[5]; // calculate BCC
if (sel_uid[6] != bcc) { if (sel_uid[6] != bcc) {
Dbprintf("BCC%d incorrect, got 0x%02x, expected 0x%02x", cascade_level, sel_uid[6], bcc); Dbprintf("BCC%d incorrect, got 0x%02x, expected 0x%02x", cascade_level, sel_uid[6], bcc);
if (hf14aconfig.forcebcc==0) { if (hf14aconfig.forcebcc == 0) {
Dbprintf("Aborting"); Dbprintf("Aborting");
return 0; return 0;
} else if (hf14aconfig.forcebcc==1) { } else if (hf14aconfig.forcebcc == 1) {
sel_uid[6] = bcc; sel_uid[6] = bcc;
} // else use card BCC } // else use card BCC
Dbprintf("Using BCC=" _YELLOW_("0x%02x") " to perform anticollision", sel_uid[6]); Dbprintf("Using BCC=" _YELLOW_("0x%02x") " to perform anticollision", sel_uid[6]);
@ -2504,16 +2504,16 @@ int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32
// Test if more parts of the uid are coming // Test if more parts of the uid are coming
do_cascade = (((sak & 0x04) /* && uid_resp[0] == 0x88 */) > 0); do_cascade = (((sak & 0x04) /* && uid_resp[0] == 0x88 */) > 0);
if (cascade_level==0) { if (cascade_level == 0) {
if (hf14aconfig.forcecl2==2) { if (hf14aconfig.forcecl2 == 2) {
do_cascade = false; do_cascade = false;
} else if (hf14aconfig.forcecl2==1) { } else if (hf14aconfig.forcecl2 == 1) {
do_cascade = true; do_cascade = true;
} // else 0==auto } // else 0==auto
} else if (cascade_level==1) { } else if (cascade_level == 1) {
if (hf14aconfig.forcecl3==2) { if (hf14aconfig.forcecl3 == 2) {
do_cascade = false; do_cascade = false;
} else if (hf14aconfig.forcecl3==1) { } else if (hf14aconfig.forcecl3 == 1) {
do_cascade = true; do_cascade = true;
} // else 0==auto } // else 0==auto
} }

View file

@ -44,7 +44,7 @@
# define FWT_TIMEOUT_14B 35312 # define FWT_TIMEOUT_14B 35312
#endif #endif
// 330/848kHz = 1558us / 4 == 400us, // 330/848kHz = 1558us / 4 == 400us,
#define ISO14443B_READER_TIMEOUT 1700 //330 #define ISO14443B_READER_TIMEOUT 1700 //330
// 1024/3.39MHz = 302.1us between end of tag response and next reader cmd // 1024/3.39MHz = 302.1us between end of tag response and next reader cmd
@ -761,7 +761,7 @@ static RAMFUNC int Handle14443bSamplesFromTag(int ci, int cq) {
// Subcarrier amplitude v = sqrt(ci^2 + cq^2), approximated here by max(abs(ci),abs(cq)) + 1/2*min(abs(ci),abs(cq))) // Subcarrier amplitude v = sqrt(ci^2 + cq^2), approximated here by max(abs(ci),abs(cq)) + 1/2*min(abs(ci),abs(cq)))
#define AMPLITUDE(ci,cq) (MAX(ABS(ci),ABS(cq)) + (MIN(ABS(ci),ABS(cq))/2)) #define AMPLITUDE(ci,cq) (MAX(ABS(ci),ABS(cq)) + (MIN(ABS(ci),ABS(cq))/2))
switch(Demod.state) { switch (Demod.state) {
case DEMOD_UNSYNCD: { case DEMOD_UNSYNCD: {
if (AMPLITUDE(ci, cq) > SUBCARRIER_DETECT_THRESHOLD) { // subcarrier detected if (AMPLITUDE(ci, cq) > SUBCARRIER_DETECT_THRESHOLD) { // subcarrier detected
@ -1434,7 +1434,7 @@ void ReadSTMemoryIso14443b(uint16_t numofblocks) {
iso14443b_setup(); iso14443b_setup();
uint8_t *mem = BigBuf_malloc((numofblocks + 1) * 4 ); uint8_t *mem = BigBuf_malloc((numofblocks + 1) * 4);
iso14b_card_select_t card; iso14b_card_select_t card;
uint8_t res = iso14443b_select_srx_card(&card); uint8_t res = iso14443b_select_srx_card(&card);
@ -1450,7 +1450,7 @@ void ReadSTMemoryIso14443b(uint16_t numofblocks) {
for (uint8_t i = 0; i < numofblocks; i++) { for (uint8_t i = 0; i < numofblocks; i++) {
if (ReadSTBlock(i, mem + ( i * 4)) == false) { if (ReadSTBlock(i, mem + (i * 4)) == false) {
isOK = PM3_ETIMEOUT; isOK = PM3_ETIMEOUT;
break; break;
} }
@ -1706,14 +1706,14 @@ void SendRawCommand14443B_Ex(PacketCommandNG *c) {
if ((param & ISO14B_SELECT_STD) == ISO14B_SELECT_STD) { if ((param & ISO14B_SELECT_STD) == ISO14B_SELECT_STD) {
status = iso14443b_select_card(&card); status = iso14443b_select_card(&card);
reply_mix(CMD_HF_ISO14443B_COMMAND, status, sendlen, 0, (uint8_t*)&card, sendlen); reply_mix(CMD_HF_ISO14443B_COMMAND, status, sendlen, 0, (uint8_t *)&card, sendlen);
// 0: OK -1: attrib fail, -2:crc fail, // 0: OK -1: attrib fail, -2:crc fail,
if (status != 0) goto out; if (status != 0) goto out;
} }
if ((param & ISO14B_SELECT_SR) == ISO14B_SELECT_SR) { if ((param & ISO14B_SELECT_SR) == ISO14B_SELECT_SR) {
status = iso14443b_select_srx_card(&card); status = iso14443b_select_srx_card(&card);
reply_mix(CMD_HF_ISO14443B_COMMAND, status, sendlen, 0, (uint8_t*)&card, sendlen); reply_mix(CMD_HF_ISO14443B_COMMAND, status, sendlen, 0, (uint8_t *)&card, sendlen);
// 0: OK 2: demod fail, 3:crc fail, // 0: OK 2: demod fail, 3:crc fail,
if (status > 0) goto out; if (status > 0) goto out;
} }

View file

@ -105,7 +105,7 @@ static bool rx_bit(void) {
int32_t sum_ci = 0; int32_t sum_ci = 0;
// skip first 5 I/Q pairs // skip first 5 I/Q pairs
for(size_t i = 0; i<5; ++i) { for (size_t i = 0; i < 5; ++i) {
(void)rx_frame_from_fpga(); (void)rx_frame_from_fpga();
} }

View file

@ -2165,7 +2165,7 @@ OUT:
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff(); LEDsoff();
reply_ng(CMD_LF_T55XX_CHK_PWDS, PM3_SUCCESS, (uint8_t*)&payload, sizeof(payload)); reply_ng(CMD_LF_T55XX_CHK_PWDS, PM3_SUCCESS, (uint8_t *)&payload, sizeof(payload));
BigBuf_free(); BigBuf_free();
} }
@ -2626,12 +2626,12 @@ void Cotag(uint32_t arg0) {
// send COTAG start pulse // send COTAG start pulse
// http://www.proxmark.org/forum/viewtopic.php?id=4455 // http://www.proxmark.org/forum/viewtopic.php?id=4455
/* /*
ON(740) OFF(2035) ON(740) OFF(2035)
ON(3330) OFF(2035) ON(3330) OFF(2035)
ON(740) OFF(2035) ON(740) OFF(2035)
ON(2000) ON(2000)
*/ */
ON(800) OFF(2200) ON(800) OFF(2200)
ON(3600) OFF(2200) ON(3600) OFF(2200)
ON(800) OFF(2200) ON(800) OFF(2200)

View file

@ -491,7 +491,7 @@ int rdv40_spiffs_read_as_symlink(char *filename, uint8_t *dst, uint32_t size, RD
read_from_spiffs((char *)linkdest, (uint8_t *)dst, size); read_from_spiffs((char *)linkdest, (uint8_t *)dst, size);
) )
} }
// BEWARE ! This function is DESTRUCTIVE as it will UPDATE an existing symlink // BEWARE ! This function is DESTRUCTIVE as it will UPDATE an existing symlink
// Since it creates a .lnk extension file it may be minor to mistake the order of arguments // Since it creates a .lnk extension file it may be minor to mistake the order of arguments

View file

@ -166,7 +166,7 @@ int CmdHFSearch(const char *Cmd) {
} }
} }
/* /*
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, " Searching for FeliCa tag..."); PrintAndLogEx(INPLACE, " Searching for FeliCa tag...");
if (IfPm3Felica()) { if (IfPm3Felica()) {
@ -175,7 +175,7 @@ int CmdHFSearch(const char *Cmd) {
res = PM3_SUCCESS; res = PM3_SUCCESS;
} }
} }
*/ */
/* /*
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, " Searching for CryptoRF tag..."); PrintAndLogEx(INPLACE, " Searching for CryptoRF tag...");

View file

@ -1024,7 +1024,7 @@ static int CmdHF15Sim(const char *Cmd) {
PacketResponseNG resp; PacketResponseNG resp;
clearCommandBuffer(); 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); WaitForResponse(CMD_HF_ISO15693_SIMULATE, &resp);
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -1741,7 +1741,7 @@ static int CmdHF15Restore(const char *Cmd) {
} }
free(data); free(data);
PrintAndLogEx(INFO, "done"); 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; return PM3_SUCCESS;
} }
@ -1782,7 +1782,7 @@ static int CmdHF15CSetUID(const char *Cmd) {
PacketResponseNG resp; PacketResponseNG resp;
clearCommandBuffer(); 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) { if (WaitForResponseTimeout(CMD_HF_ISO15693_CSETUID, &resp, 2000) == false) {
PrintAndLogEx(WARNING, "timeout while waiting for reply"); PrintAndLogEx(WARNING, "timeout while waiting for reply");
@ -1799,7 +1799,7 @@ static int CmdHF15CSetUID(const char *Cmd) {
uint8_t revuid[8] = {0}; uint8_t revuid[8] = {0};
uint8_t i = 0; uint8_t i = 0;
while (i < sizeof(revuid)) { while (i < sizeof(revuid)) {
revuid[i] = carduid[7-i]; revuid[i] = carduid[7 - i];
i++; i++;
} }

View file

@ -71,7 +71,7 @@ static int CmdHFEPACollectPACENonces(const char *Cmd) {
PacketResponseNG resp; PacketResponseNG resp;
clearCommandBuffer(); 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); WaitForResponse(CMD_HF_EPA_COLLECT_NONCE, &resp);

View file

@ -388,7 +388,7 @@ static int cmp_uint32(const void *a, const void *b) {
return mx > my; 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)); iclass_prekey_t *prekey = calloc(ICLASS_KEYS_MAX, sizeof(iclass_prekey_t));
if (prekey == false) { 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, epurse, 8);
memcpy(ccnr + 8, rmac, 4); 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); qsort(prekey, ICLASS_KEYS_MAX, sizeof(iclass_prekey_t), cmp_uint32);
iclass_prekey_t lookup; iclass_prekey_t lookup;
memcpy(lookup.mac, tmac, 4); memcpy(lookup.mac, tmac, 4);
// binsearch // 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) { if (item != NULL) {
memcpy(key, item->key, 8); memcpy(key, item->key, 8);
return true; return true;
@ -1280,7 +1280,7 @@ static int CmdHFiClassEView(const char *Cmd) {
PrintAndLogEx(INFO, " CSN |0x00| " _GREEN_("%s") "|", sprint_hex(csn, 8)); PrintAndLogEx(INFO, " CSN |0x00| " _GREEN_("%s") "|", sprint_hex(csn, 8));
printIclassDumpContents(dump, 1, blocks, bytes); printIclassDumpContents(dump, 1, blocks, bytes);
/* /*
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "----+-------------------------+---------"); PrintAndLogEx(INFO, "----+-------------------------+---------");
PrintAndLogEx(INFO, "blk | data | ascii"); PrintAndLogEx(INFO, "blk | data | ascii");
@ -1290,7 +1290,7 @@ static int CmdHFiClassEView(const char *Cmd) {
} }
PrintAndLogEx(INFO, "----+-------------------------+---------"); PrintAndLogEx(INFO, "----+-------------------------+---------");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
*/ */
free(dump); free(dump);
return PM3_SUCCESS; return PM3_SUCCESS;
} }

View file

@ -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); void PrintPreCalc(iclass_prekey_t *list, uint32_t itemcnt);
uint8_t get_pagemap(const picopass_hdr *hdr); 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 #endif

View file

@ -593,7 +593,7 @@ static int CmdLegicSim(const char *Cmd) {
payload.send_reply = true; payload.send_reply = true;
payload.tagtype = param_get8ex(Cmd, 0, 1, 10); payload.tagtype = param_get8ex(Cmd, 0, 1, 10);
if (payload.tagtype > 2 ) { if (payload.tagtype > 2) {
return usage_legic_sim(); return usage_legic_sim();
} }

View file

@ -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 rmac[4];
static uint8_t tmac[4]; static uint8_t tmac[4];
if ( isResponse == false ) { if (isResponse == false) {
uint8_t c = cmd[0] & 0x0F; uint8_t c = cmd[0] & 0x0F;
uint8_t parity = 0; uint8_t parity = 0;
for (uint8_t i = 0; i < 7; i++) { for (uint8_t i = 0; i < 7; i++) {
@ -415,11 +415,11 @@ void annotateIclass(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool
curr_state = PICO_NONE; curr_state = PICO_NONE;
} else if (curr_state == PICO_AUTH_EPURSE) { } else if (curr_state == PICO_AUTH_EPURSE) {
memcpy(epurse, cmd, 8); memcpy(epurse, cmd, 8);
} else if ( curr_state == PICO_AUTH_MACS) { } else if (curr_state == PICO_AUTH_MACS) {
uint8_t key[8]; uint8_t key[8];
if (check_known_default(csn, epurse, rmac, tmac, key)) { 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; curr_state = PICO_NONE;
} }

View file

@ -594,7 +594,7 @@ static int32_t initSectorTable(sector_t **src, int32_t items) {
return 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)) { if (mfIsSectorTrailer(blockno)) {
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Sector trailer decoded:"); PrintAndLogEx(NORMAL, "Sector trailer decoded:");
@ -819,9 +819,9 @@ static int CmdHF14AMfRdSc(const char *Cmd) {
start = 128 + (sectorNo - 32) * 16; start = 128 + (sectorNo - 32) * 16;
} }
for (int i = 0; i < blocks; i++) { 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 { } else {
PrintAndLogEx(WARNING, "Command execute timeout"); PrintAndLogEx(WARNING, "Command execute timeout");
@ -3876,13 +3876,13 @@ static int CmdHF14AMfEView(const char *Cmd) {
PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------"); PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
PrintAndLogEx(INFO, "blk | data | ascii"); PrintAndLogEx(INFO, "blk | data | ascii");
PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------"); PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
for (uint16_t i = 0; i < blocks; i++){ for (uint16_t i = 0; i < blocks; i++) {
if (i == 0) { 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)) { } 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 { } 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, "----+-------------------------------------------------+-----------------"); PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
@ -4540,14 +4540,14 @@ static int CmdHF14AMfCView(const char *Cmd) {
PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------"); PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
PrintAndLogEx(INFO, "blk | data | ascii"); PrintAndLogEx(INFO, "blk | data | ascii");
PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------"); PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");
for (uint16_t i = 0; i < numblocks; i++){ for (uint16_t i = 0; i < numblocks; i++) {
if (i == 0) { 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)) { } 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 { } 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, "----+-------------------------------------------------+-----------------"); PrintAndLogEx(INFO, "----+-------------------------------------------------+-----------------");

View file

@ -144,7 +144,7 @@ static nxp_cardtype_t getCardType(uint8_t major, uint8_t minor) {
return DESFIRE_EV2; return DESFIRE_EV2;
// DESFire EV3 // DESFire EV3
if (major == 0x33 && minor == 0x00 ) if (major == 0x33 && minor == 0x00)
return DESFIRE_EV3; return DESFIRE_EV3;
// DESFire Light // DESFire Light

View file

@ -92,7 +92,7 @@ static int CmdCOTAGRead(const char *Cmd) {
PacketResponseNG resp; PacketResponseNG resp;
clearCommandBuffer(); 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; uint8_t timeout = 3;
while (!WaitForResponseTimeout(CMD_LF_COTAG_READ, &resp, 2000)) { while (!WaitForResponseTimeout(CMD_LF_COTAG_READ, &resp, 2000)) {

View file

@ -630,7 +630,7 @@ static int CmdEM410xWrite(const char *Cmd) {
return PM3_EINVARG; 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 // NOTE: We really should pass the clock in as a separate argument, but to
// provide for backwards-compatibility for older firmware, and to avoid // provide for backwards-compatibility for older firmware, and to avoid
// having to add another argument to CMD_LF_EM410X_WRITE, we just store // having to add another argument to CMD_LF_EM410X_WRITE, we just store

View file

@ -286,7 +286,7 @@ static int CmdKeriClone(const char *Cmd) {
// Prepare and write to card // Prepare and write to card
// 3 LSB is ONE // 3 LSB is ONE
uint64_t data = ((uint64_t)internalid << 3) + 7; 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[1] = data >> 32;
blocks[2] = data & 0xFFFFFFFF; 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}; 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. // sanity check.
if (*size < sizeof(preamble) ) return -1; if (*size < sizeof(preamble)) return -1;
size_t startIdx = 0; size_t startIdx = 0;
size_t found_size = *size; size_t found_size = *size;

View file

@ -253,7 +253,7 @@ static int CmdPyramidClone(const char *Cmd) {
free(bs); 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)); print_blocks(blocks, ARRAYLEN(blocks));
int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks));

View file

@ -994,7 +994,7 @@ static int SanityOfflineCheck(bool useGraphBuffer) {
static void T55xx_Print_DownlinkMode(uint8_t downlink_mode) { static void T55xx_Print_DownlinkMode(uint8_t downlink_mode) {
char msg[80]; char msg[80];
snprintf(msg, sizeof(msg) ,"Downlink Mode used : "); snprintf(msg, sizeof(msg), "Downlink Mode used : ");
switch (downlink_mode) { switch (downlink_mode) {
case 1 : case 1 :
@ -2327,7 +2327,7 @@ static int CmdT55xxDump(const char *Cmd) {
strcpy(preferredName, "lf-t55xx"); strcpy(preferredName, "lf-t55xx");
for (uint8_t i = 1; i <= 7; i++) { for (uint8_t i = 1; i <= 7; i++) {
if ((cardmem[i].blockdata != 0x00) && (cardmem[i].blockdata != 0xFFFFFFFF)) 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 else
break; break;
} }
@ -3052,7 +3052,7 @@ static int CmdT55xxChkPwds(const char *Cmd) {
bool found; bool found;
uint32_t candidate; uint32_t candidate;
} PACKED; } PACKED;
struct p* packet = (struct p*)resp.data.asBytes; struct p *packet = (struct p *)resp.data.asBytes;
if (packet->found) { if (packet->found) {
PrintAndLogEx(SUCCESS, "\nFound a candidate [ " _YELLOW_("%08"PRIX32) " ]", packet->candidate); 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 (AcquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, password, dl_mode)) {
// if (getSignalProperties()->isnoise == false) { // if (getSignalProperties()->isnoise == false) {
// } else { // } else {
if (tryDetectModulationEx(dl_mode, T55XX_PrintConfig, 0 ,password)) { if (tryDetectModulationEx(dl_mode, T55XX_PrintConfig, 0, password)) {
return 1 + (dl_mode << 1); return 1 + (dl_mode << 1);
} }
// } // }

View file

@ -347,14 +347,14 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr
uint8_t m = 7; uint8_t m = 7;
while (m > 0) { while (m > 0) {
bitime -= 128; bitime -= 128;
if ( duration > bitime) { if (duration > bitime) {
break; break;
} }
m--; m--;
} }
line[(data_len-1)/16][((data_len-1)%16) * 4 + 2] = '('; 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 + 3] = m + 0x30;
line[(data_len-1)/16][((data_len-1)%16) * 4 + 4] = ')'; line[(data_len - 1) / 16][((data_len - 1) % 16) * 4 + 4] = ')';
} }
} }

View file

@ -432,7 +432,7 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
picopass_hdr *hdr = (picopass_hdr *)data; picopass_hdr *hdr = (picopass_hdr *)data;
JsonSaveBufAsHexCompact(root, "$.Card.CSN", hdr->csn, sizeof(hdr->csn)); 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); uint8_t pagemap = get_pagemap(hdr);
if (pagemap == PICOPASS_NON_SECURE_PAGEMODE) { if (pagemap == PICOPASS_NON_SECURE_PAGEMODE) {
@ -440,7 +440,7 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
JsonSaveBufAsHexCompact(root, "$.Card.AIA", ns_hdr->app_issuer_area, sizeof(ns_hdr->app_issuer_area)); 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.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.Kc", hdr->key_c, sizeof(hdr->key_c));
JsonSaveBufAsHexCompact(root, "$.Card.AIA", hdr->app_issuer_area, sizeof(hdr->app_issuer_area)); JsonSaveBufAsHexCompact(root, "$.Card.AIA", hdr->app_issuer_area, sizeof(hdr->app_issuer_area));
} }

View file

@ -1199,7 +1199,7 @@ static int l_cwd(lua_State *L) {
// ref: https://github.com/RfidResearchGroup/proxmark3/issues/891 // ref: https://github.com/RfidResearchGroup/proxmark3/issues/891
// redirect LUA's print to Proxmark3 PrintAndLogEx // 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); int n = lua_gettop(L);
for (int i = 1; i <= n; i++) { for (int i = 1; i <= n; i++) {