From 2f56bdcf1096848308266ba8a531f7f403b4b2d8 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 18 Feb 2025 18:44:24 +0100 Subject: [PATCH] text and style --- client/src/cmdlfem4x50.c | 10 +++++----- client/src/cmdlfguard.c | 8 ++++---- client/src/cmdlfhid.c | 4 ++-- client/src/cmdtrace.c | 19 ++++++++++++------- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/client/src/cmdlfem4x50.c b/client/src/cmdlfem4x50.c index e1ee8181f..bda13661f 100644 --- a/client/src/cmdlfem4x50.c +++ b/client/src/cmdlfem4x50.c @@ -30,12 +30,10 @@ static int CmdHelp(const char *Cmd); -// Each record is 4 bytes long ... a single line in the dump output -// Reads each record from `data`, reverses the four bytes, and writes to `words` -static void em4x50_prepare_result(const uint8_t *data, int first_record_inclusive, int last_record_inclusive, em4x50_word_t *words) { +static void em4x50_prepare_result(const uint8_t *data, int fwr, int lwr, em4x50_word_t *words) { // restructure received result in "em4x50_word_t" structure - for (int i = first_record_inclusive; i <= last_record_inclusive; i++) { + for (int i = fwr; i <= lwr; i++) { for (int j = 0; j < 4; j++) { words[i].byte[j] = data[i * 4 + (3 - j)]; } @@ -641,8 +639,10 @@ int em4x50_read(em4x50_data_t *etd, em4x50_word_t *out) { return PM3_ESOFT; } + em4x50_read_data_response_t *o = (em4x50_read_data_response_t *)resp.data.asBytes; + em4x50_word_t words[EM4X50_NO_WORDS] = {0}; - em4x50_prepare_result(resp.data.asBytes, etd->addresses & 0xFF, (etd->addresses >> 8) & 0xFF, words); + em4x50_prepare_result((uint8_t *)o->words, etd->addresses & 0xFF, (etd->addresses >> 8) & 0xFF, words); if (out != NULL) { memcpy(out, &words, sizeof(em4x50_word_t) * EM4X50_NO_WORDS); diff --git a/client/src/cmdlfguard.c b/client/src/cmdlfguard.c index ea567499a..f8e3a5112 100644 --- a/client/src/cmdlfguard.c +++ b/client/src/cmdlfguard.c @@ -98,7 +98,7 @@ static int demod_guard_raw(uint8_t *raw, uint8_t rlen) { // but will leave the g_GraphBuffer intact. // if successful it will push askraw data back to g_DemodBuffer ready for emulation int demodGuard(bool verbose) { - (void) verbose; // unused so far + (void) verbose; //Differential Biphase //get binary from ask wave if (ASKbiphaseDemod(0, 64, 0, 0, false) != PM3_SUCCESS) { @@ -285,7 +285,7 @@ static int CmdGuardClone(const char *Cmd) { return PM3_EINVARG; } - fmtlen &= 0x7f; + fmtlen &= 0x7F; uint32_t facilitycode = (fc & 0x000000FF); uint32_t cardnumber = (cn & 0x00FFFFFF); @@ -317,7 +317,7 @@ static int CmdGuardClone(const char *Cmd) { free(bs); - PrintAndLogEx(INFO, "Preparing to clone Guardall to " _YELLOW_("%s") " with Facility Code: " _GREEN_("%u") " Card Number: " _GREEN_("%u") " xorKey: " _GREEN_("%u") + PrintAndLogEx(INFO, "Preparing to clone Guardall to " _YELLOW_("%s") " with fc: " _GREEN_("%u") " cn: " _GREEN_("%u") " xor: " _GREEN_("%u") , cardtype , facilitycode , cardnumber @@ -375,7 +375,7 @@ static int CmdGuardSim(const char *Cmd) { return PM3_ESOFT; } - PrintAndLogEx(SUCCESS, "Simulating Guardall Prox - xorKey: " _YELLOW_("%u") " Facility Code: " _YELLOW_("%u") " CardNumber: " _YELLOW_("%u") + PrintAndLogEx(SUCCESS, "Simulating Guardall Prox - xorKey: " _YELLOW_("%u") " fc: " _YELLOW_("%u") " cn: " _YELLOW_("%u") , xorval , facilitycode , cardnumber diff --git a/client/src/cmdlfhid.c b/client/src/cmdlfhid.c index fb1eeb56e..bb1946414 100644 --- a/client/src/cmdlfhid.c +++ b/client/src/cmdlfhid.c @@ -213,8 +213,8 @@ static int CmdHIDReader(const char *Cmd) { } do { - lf_read(false, 16000); // get data of 16000 samples from proxmark device - demodHID(!cm); // demod data and print results if found + lf_read(false, 16000); + demodHID(!cm); } while (cm && !kbd_enter_pressed()); return PM3_SUCCESS; diff --git a/client/src/cmdtrace.c b/client/src/cmdtrace.c index c91f6a31b..113c89f7f 100644 --- a/client/src/cmdtrace.c +++ b/client/src/cmdtrace.c @@ -164,6 +164,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t } // extract MFC + /* switch (frame[0]) { case MIFARE_AUTH_KEYA: { if (data_len > 3) { @@ -176,9 +177,11 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t break; } } + */ - // extract MFU-C + // extract MFU-C KEY when written. switch (frame[0]) { + case MIFARE_ULC_AUTH_1: { if (data_len != 4) { break; @@ -195,7 +198,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t break; } - PrintAndLogEx(INFO, "MFU-C AUTH"); + PrintAndLogEx(INFO, "Found a MFU-C authententication attempt"); PrintAndLogEx(INFO, "3DES %s " NOLF, sprint_hex_inrow(next_hdr->frame + 1, 8)); next_hdr = (tracelog_hdr_t *)(trace + tracepos); @@ -203,6 +206,8 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t if (next_hdr->frame[0] == MIFARE_ULC_AUTH_2 && next_hdr->data_len == 19) { PrintAndLogEx(NORMAL, "%s", sprint_hex_inrow(next_hdr->frame + 1, 16)); + } else { + PrintAndLogEx(NORMAL, "( " _RED_("partial") " )"); } return tracepos; @@ -323,7 +328,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t case MFDES_AUTHENTICATE: { // Assume wrapped or unwrapped - PrintAndLogEx(INFO, "AUTH NATIVE (keyNo %d)", frame[pos + long_jmp]); + PrintAndLogEx(INFO, "Found a MFDES Auth NATIVE (keyNo %d)", frame[pos + long_jmp]); if (next_record_is_response(tracepos, trace) == false) { break; } @@ -348,7 +353,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t } case MFDES_AUTHENTICATE_ISO: { // Assume wrapped or unwrapped - PrintAndLogEx(INFO, "AUTH ISO (keyNo %d)", frame[pos + long_jmp]); + PrintAndLogEx(INFO, "Found a MFDES Auth ISO (keyNo %d)", frame[pos + long_jmp]); if (next_record_is_response(tracepos, trace) == false) { break; } @@ -379,7 +384,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t } case MFDES_AUTHENTICATE_AES: { // Assume wrapped or unwrapped - PrintAndLogEx(INFO, "AUTH AES (keyNo %d)", frame[pos + long_jmp]); + PrintAndLogEx(INFO, "Found a MFDES Auth AES (keyNo %d)", frame[pos + long_jmp]); if (next_record_is_response(tracepos, trace)) { break; } @@ -403,7 +408,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t return tracepos; } case MFDES_AUTHENTICATE_EV2F: { - PrintAndLogEx(INFO, "AUTH EV2 First"); + PrintAndLogEx(INFO, "Found a MFDES Auth EV2 First"); uint16_t tmp = extractChall_ev2(tracepos, trace, pos, long_jmp); if (tmp == 0) break; @@ -412,7 +417,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t } case MFDES_AUTHENTICATE_EV2NF: { - PrintAndLogEx(INFO, "AUTH EV2 Non First"); + PrintAndLogEx(INFO, "Found a MFDES Auth EV2 Non First"); uint16_t tmp = extractChall_ev2(tracepos, trace, pos, long_jmp); if (tmp == 0) break;