text and style

This commit is contained in:
iceman1001 2025-02-18 18:44:24 +01:00
commit 2f56bdcf10
4 changed files with 23 additions and 18 deletions

View file

@ -30,12 +30,10 @@
static int CmdHelp(const char *Cmd); static int CmdHelp(const char *Cmd);
// Each record is 4 bytes long ... a single line in the dump output static void em4x50_prepare_result(const uint8_t *data, int fwr, int lwr, em4x50_word_t *words) {
// 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) {
// restructure received result in "em4x50_word_t" structure // 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++) { for (int j = 0; j < 4; j++) {
words[i].byte[j] = data[i * 4 + (3 - 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; 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_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) { if (out != NULL) {
memcpy(out, &words, sizeof(em4x50_word_t) * EM4X50_NO_WORDS); memcpy(out, &words, sizeof(em4x50_word_t) * EM4X50_NO_WORDS);

View file

@ -98,7 +98,7 @@ static int demod_guard_raw(uint8_t *raw, uint8_t rlen) {
// but will leave the g_GraphBuffer intact. // but will leave the g_GraphBuffer intact.
// if successful it will push askraw data back to g_DemodBuffer ready for emulation // if successful it will push askraw data back to g_DemodBuffer ready for emulation
int demodGuard(bool verbose) { int demodGuard(bool verbose) {
(void) verbose; // unused so far (void) verbose;
//Differential Biphase //Differential Biphase
//get binary from ask wave //get binary from ask wave
if (ASKbiphaseDemod(0, 64, 0, 0, false) != PM3_SUCCESS) { if (ASKbiphaseDemod(0, 64, 0, 0, false) != PM3_SUCCESS) {
@ -285,7 +285,7 @@ static int CmdGuardClone(const char *Cmd) {
return PM3_EINVARG; return PM3_EINVARG;
} }
fmtlen &= 0x7f; fmtlen &= 0x7F;
uint32_t facilitycode = (fc & 0x000000FF); uint32_t facilitycode = (fc & 0x000000FF);
uint32_t cardnumber = (cn & 0x00FFFFFF); uint32_t cardnumber = (cn & 0x00FFFFFF);
@ -317,7 +317,7 @@ static int CmdGuardClone(const char *Cmd) {
free(bs); 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 , cardtype
, facilitycode , facilitycode
, cardnumber , cardnumber
@ -375,7 +375,7 @@ static int CmdGuardSim(const char *Cmd) {
return PM3_ESOFT; 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 , xorval
, facilitycode , facilitycode
, cardnumber , cardnumber

View file

@ -213,8 +213,8 @@ static int CmdHIDReader(const char *Cmd) {
} }
do { do {
lf_read(false, 16000); // get data of 16000 samples from proxmark device lf_read(false, 16000);
demodHID(!cm); // demod data and print results if found demodHID(!cm);
} while (cm && !kbd_enter_pressed()); } while (cm && !kbd_enter_pressed());
return PM3_SUCCESS; return PM3_SUCCESS;

View file

@ -164,6 +164,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
} }
// extract MFC // extract MFC
/*
switch (frame[0]) { switch (frame[0]) {
case MIFARE_AUTH_KEYA: { case MIFARE_AUTH_KEYA: {
if (data_len > 3) { if (data_len > 3) {
@ -176,9 +177,11 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
break; break;
} }
} }
*/
// extract MFU-C // extract MFU-C KEY when written.
switch (frame[0]) { switch (frame[0]) {
case MIFARE_ULC_AUTH_1: { case MIFARE_ULC_AUTH_1: {
if (data_len != 4) { if (data_len != 4) {
break; break;
@ -195,7 +198,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
break; 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)); PrintAndLogEx(INFO, "3DES %s " NOLF, sprint_hex_inrow(next_hdr->frame + 1, 8));
next_hdr = (tracelog_hdr_t *)(trace + tracepos); 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) { 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)); PrintAndLogEx(NORMAL, "%s", sprint_hex_inrow(next_hdr->frame + 1, 16));
} else {
PrintAndLogEx(NORMAL, "( " _RED_("partial") " )");
} }
return tracepos; return tracepos;
@ -323,7 +328,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
case MFDES_AUTHENTICATE: { case MFDES_AUTHENTICATE: {
// Assume wrapped or unwrapped // 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) { if (next_record_is_response(tracepos, trace) == false) {
break; break;
} }
@ -348,7 +353,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
} }
case MFDES_AUTHENTICATE_ISO: { case MFDES_AUTHENTICATE_ISO: {
// Assume wrapped or unwrapped // 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) { if (next_record_is_response(tracepos, trace) == false) {
break; break;
} }
@ -379,7 +384,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
} }
case MFDES_AUTHENTICATE_AES: { case MFDES_AUTHENTICATE_AES: {
// Assume wrapped or unwrapped // 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)) { if (next_record_is_response(tracepos, trace)) {
break; break;
} }
@ -403,7 +408,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
return tracepos; return tracepos;
} }
case MFDES_AUTHENTICATE_EV2F: { 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); uint16_t tmp = extractChall_ev2(tracepos, trace, pos, long_jmp);
if (tmp == 0) if (tmp == 0)
break; break;
@ -412,7 +417,7 @@ static uint16_t extractChallenges(uint16_t tracepos, uint16_t traceLen, uint8_t
} }
case MFDES_AUTHENTICATE_EV2NF: { 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); uint16_t tmp = extractChall_ev2(tracepos, trace, pos, long_jmp);
if (tmp == 0) if (tmp == 0)
break; break;