From 1c7de4a8c3310a6f1d3ec92d9f90bc09b519c86b Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 23 Jun 2020 11:13:49 +0200 Subject: [PATCH 01/35] fix: "lf search" / "lf hitag" - no more stack overflow in hitag reader --- armsrc/hitag2.c | 52 +++++++++++++++++++++++++++-------------- armsrc/lfadc.c | 50 +++++++++++++++------------------------ client/src/cmdlfhitag.c | 2 +- 3 files changed, 55 insertions(+), 49 deletions(-) diff --git a/armsrc/hitag2.c b/armsrc/hitag2.c index cf1aa46c1..79b09395f 100644 --- a/armsrc/hitag2.c +++ b/armsrc/hitag2.c @@ -36,7 +36,7 @@ #include "lfsampling.h" #include "lfdemod.h" #include "commonutil.h" - +#include "appmain.h" #define test_bit(data, i) (*(data + (i/8)) >> (7-(i % 8))) & 1 #define set_bit(data, i) *(data + (i/8)) |= (1 << (7-(i % 8))) @@ -1002,15 +1002,20 @@ void SniffHitag2(void) { size_t periods = 0; uint8_t periods_bytes[4]; - int16_t checked = 0; + // int16_t checked = 0; /*bool waiting_for_first_edge = true;*/ LED_C_ON(); + uint32_t signal_size = 10000; while (!BUTTON_PRESS()) { + // use malloc + initSampleBufferEx(&signal_size, false); + WDT_HIT(); +/* // only every 1000th times, in order to save time when collecting samples. if (checked == 1000) { if (data_available()) { @@ -1021,13 +1026,14 @@ void SniffHitag2(void) { } } ++checked; + */ // Receive frame, watch for at most T0*EOF periods // lf_reset_counter(); // Wait "infinite" for reader modulation - periods = lf_detect_gap(20000); + periods = lf_detect_gap(10000); // Test if we detected the first reader modulation edge if (periods != 0) { @@ -1042,7 +1048,6 @@ void SniffHitag2(void) { num_to_bytes(periods, 4, periods_bytes); LogTrace(periods_bytes, 4, 0, 0, NULL, true); } - } lf_finalize(); @@ -1064,7 +1069,7 @@ void SimulateHitag2(bool tag_mem_supplied, uint8_t *data) { int response = 0; uint8_t rx[HITAG_FRAME_LEN] = {0}; size_t rxlen = 0; - uint8_t tx[HITAG_FRAME_LEN]; + uint8_t tx[HITAG_FRAME_LEN] = {0}; size_t txlen = 0; auth_table_len = 0; @@ -1108,8 +1113,11 @@ void SimulateHitag2(bool tag_mem_supplied, uint8_t *data) { // int16_t checked = 0; // SIMULATE + uint32_t signal_size = 10000; + while (BUTTON_PRESS() == false) { - while (!BUTTON_PRESS()) { + // use malloc + initSampleBufferEx(&signal_size, true); LED_D_ON(); @@ -1283,9 +1291,9 @@ void ReaderHitag(hitag_function htf, hitag_data *htd) { uint32_t command_start = 0, command_duration = 0; uint32_t response_start = 0, response_duration = 0; - uint8_t rx[HITAG_FRAME_LEN]; + uint8_t rx[HITAG_FRAME_LEN] = {0}; size_t rxlen = 0; - uint8_t txbuf[HITAG_FRAME_LEN]; + uint8_t txbuf[HITAG_FRAME_LEN] = {0}; uint8_t *tx = txbuf; size_t txlen = 0; @@ -1430,12 +1438,17 @@ void ReaderHitag(hitag_function htf, hitag_data *htd) { size_t nrzs = 0; int16_t checked = 0; - while (!bStop && !BUTTON_PRESS()) { + uint32_t signal_size = 10000; + + while (bStop == false && BUTTON_PRESS() == false) { + + // use malloc + initSampleBufferEx(&signal_size, true); WDT_HIT(); // only every 1000th times, in order to save time when collecting samples. - if (checked == 1000) { + if (checked == 4000) { if (data_available()) { checked = -1; break; @@ -1615,13 +1628,13 @@ void ReaderHitag(hitag_function htf, hitag_data *htd) { } // Pack the response into a byte array - for (size_t i = 5; i < nrzs; i++) { + for (size_t i = 5; i < nrzs && rxlen < (sizeof(rx) << 3); i++) { uint8_t bit = nrz_samples[i]; if (bit > 1) { // When Manchester detects impossible symbol it writes "7" DBG Dbprintf("Error in Manchester decoding, abort"); break; } - rx[rxlen / 8] |= bit << (7 - (rxlen % 8)); + rx[rxlen >> 3] |= bit << (7 - (rxlen % 8)); rxlen++; } @@ -1756,10 +1769,14 @@ void WriterHitag(hitag_function htf, hitag_data *htd, int page) { size_t nrzs = 0; int16_t checked = 0; - while (!bStop && !BUTTON_PRESS()) { + uint32_t signal_size = 10000; + while (bStop == false && BUTTON_PRESS() == false) { - // only every 1000th times, in order to save time when collecting samples. - if (checked == 1000) { + // use malloc + initSampleBufferEx(&signal_size, true); + + // only every 4000th times, in order to save time when collecting samples. + if (checked == 4000) { if (data_available()) { checked = -1; break; @@ -1920,12 +1937,13 @@ void WriterHitag(hitag_function htf, hitag_data *htd, int page) { } // Pack the response into a byte array - for (size_t i = 5; i < nrzs; i++) { + for (size_t i = 5; i < nrzs && rxlen < (sizeof(rx) << 3); i++) { uint8_t bit = nrz_samples[i]; if (bit > 1) { // When Manchester detects impossible symbol it writes "7" break; } - rx[rxlen / 8] |= bit << (7 - (rxlen % 8)); + // >> 3 instead of div by 8 + rx[rxlen >> 3] |= bit << (7 - (rxlen % 8)); rxlen++; } diff --git a/armsrc/lfadc.c b/armsrc/lfadc.c index cec945b20..8c453bdc9 100644 --- a/armsrc/lfadc.c +++ b/armsrc/lfadc.c @@ -11,6 +11,7 @@ #include "fpgaloader.h" #include "ticks.h" #include "dbprint.h" +#include "appmain.h" // Sam7s has several timers, we will use the source TIMER_CLOCK1 (aka AT91C_TC_CLKS_TIMER_DIV1_CLOCK) // TIMER_CLOCK1 = MCK/2, MCK is running at 48 MHz, Timer is running at 48/2 = 24 MHz @@ -72,27 +73,11 @@ void lf_sample_mean(void) { static size_t lf_count_edge_periods_ex(size_t max, bool wait, bool detect_gap) { size_t periods = 0; - volatile uint8_t adc_val; uint8_t avg_peak = adc_avg + 3, avg_through = adc_avg - 3; -// int16_t checked = 0; - - while (!BUTTON_PRESS()) { - - // only every 100th times, in order to save time when collecting samples. - /* - if (checked == 1000) { - if (data_available()) { - break; - } else { - checked = 0; - } - } - ++checked; - */ - WDT_HIT(); + while (BUTTON_PRESS() == false) { if (AT91C_BASE_SSC->SSC_SR & (AT91C_SSC_RXRDY)) { - adc_val = AT91C_BASE_SSC->SSC_RHR; + volatile uint8_t adc_val = AT91C_BASE_SSC->SSC_RHR; periods++; if (g_logging) logSampleSimple(adc_val); @@ -105,6 +90,7 @@ static size_t lf_count_edge_periods_ex(size_t max, bool wait, bool detect_gap) { if (adc_val == 0) { return periods; } + } else { // Trigger on a modulation swap by observing an edge change if (rising_edge) { @@ -125,6 +111,7 @@ static size_t lf_count_edge_periods_ex(size_t max, bool wait, bool detect_gap) { if (periods >= max) return 0; } } + if (g_logging) logSampleSimple(0xFF); return 0; } @@ -161,6 +148,7 @@ bool lf_get_reader_modulation(void) { } void lf_wait_periods(size_t periods) { + // wait detect gap lf_count_edge_periods_ex(periods, true, false); } @@ -250,23 +238,22 @@ void lf_finalize(void) { } size_t lf_detect_field_drop(size_t max) { +/* size_t periods = 0; // int16_t checked = 0; - while (!BUTTON_PRESS()) { + while (BUTTON_PRESS() == false) { - /* - // only every 1000th times, in order to save time when collecting samples. - if (checked == 1000) { - if (data_available()) { - checked = -1; - break; - } else { - checked = 0; - } - } - ++checked; - */ + // // only every 1000th times, in order to save time when collecting samples. + // if (checked == 4000) { + // if (data_available()) { + // checked = -1; + // break; + // } else { + // checked = 0; + // } + // } + // ++checked; WDT_HIT(); @@ -284,6 +271,7 @@ size_t lf_detect_field_drop(size_t max) { if (periods == max) return 0; } } +*/ return 0; } diff --git a/client/src/cmdlfhitag.c b/client/src/cmdlfhitag.c index b05405465..bce0e83a6 100644 --- a/client/src/cmdlfhitag.c +++ b/client/src/cmdlfhitag.c @@ -584,7 +584,7 @@ static int CmdLFHitagReader(const char *Cmd) { clearCommandBuffer(); SendCommandMIX(cmd, htf, 0, 0, &htd, sizeof(htd)); PacketResponseNG resp; - if (!WaitForResponseTimeout(CMD_ACK, &resp, 4000)) { + if (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) { PrintAndLogEx(WARNING, "timeout while waiting for reply."); return PM3_ETIMEOUT; } From d9f606d70b6ffa27a4674a7a78f291ff23a34b11 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 23 Jun 2020 11:21:17 +0200 Subject: [PATCH 02/35] more debugstatements --- armsrc/lfsampling.c | 108 +++++++++++++++++++++++++++++--------------- armsrc/lfsampling.h | 1 + 2 files changed, 72 insertions(+), 37 deletions(-) diff --git a/armsrc/lfsampling.c b/armsrc/lfsampling.c index 40ad29f93..f77084b3d 100644 --- a/armsrc/lfsampling.c +++ b/armsrc/lfsampling.c @@ -16,6 +16,7 @@ #include "util.h" #include "lfdemod.h" #include "string.h" // memset +#include "appmain.h" // print stack /* Default LF config is set to: @@ -29,6 +30,12 @@ Default LF config is set to: */ static sample_config config = { 1, 8, 1, LF_DIVISOR_125, 0, 0, 1} ; +// Holds bit packed struct of samples. +static BitstreamOut data = {0, 0, 0}; + +// internal struct to keep track of samples gathered +static sampling_t samples = {0, 0, 0, 0}; + void printConfig(void) { uint32_t d = config.divisor; DbpString(_CYAN_("LF Sampling config")); @@ -38,6 +45,18 @@ void printConfig(void) { Dbprintf(" [a] averaging...........%s", (config.averaging) ? "Yes" : "No"); Dbprintf(" [t] trigger threshold...%d", config.trigger_threshold); Dbprintf(" [s] samples to skip.....%d ", config.samples_to_skip); + + DbpString(_CYAN_("LF Sampling Stack")); + print_stack_usage(); +} + +void printSamples(void) { + DbpString(_CYAN_("LF Sampling memory")); + Dbprintf(" decimation counter.....%d ", samples.dec_counter); + Dbprintf(" sum.....%u ", samples.sum); + Dbprintf(" counter.....%u ", samples.counter); + Dbprintf(" total saved.....%u ", samples.total_saved); + print_stack_usage(); } /** @@ -99,12 +118,6 @@ static void pushBit(BitstreamOut *stream, uint8_t bit) { stream->numbits++; } -// Holds bit packed struct of samples. -static BitstreamOut data = {0, 0, 0}; - -// internal struct to keep track of samples gathered -static sampling_t samples = {0, 0, 0, 0}; - void initSampleBuffer(uint32_t *sample_size) { initSampleBufferEx(sample_size, false); } @@ -116,9 +129,7 @@ void initSampleBufferEx(uint32_t *sample_size, bool use_malloc) { } BigBuf_free(); - // We can't erase the buffer now, it would drastically delay the acquisition - if (use_malloc) { if (*sample_size == 0) { @@ -141,7 +152,7 @@ void initSampleBufferEx(uint32_t *sample_size, bool use_malloc) { // samples.dec_counter = 0; samples.sum = 0; - samples.counter = 0; + samples.counter = *sample_size; samples.total_saved = 0; } @@ -157,13 +168,13 @@ void logSample(uint8_t sample, uint8_t decimation, uint8_t bits_per_sample, bool if (!data.buffer) return; - if (bits_per_sample == 0) bits_per_sample = 1; + // keep track of total gather samples regardless how many was discarded. + if (samples.counter-- == 0) return; + + if (bits_per_sample == 0) bits_per_sample = 1; if (bits_per_sample > 8) bits_per_sample = 8; if (decimation == 0) decimation = 1; - // keep track of total gather samples regardless how many was discarded. - samples.counter++; - if (avg) { samples.sum += sample; } @@ -224,6 +235,7 @@ void LFSetupFPGAForADC(int divisor, bool reader_field) { // Connect the A/D to the peak-detected low-frequency path. SetAdcMuxFor(GPIO_MUXSEL_LOPKD); + // 50ms for the resonant antenna to settle. if (reader_field) SpinDelay(50); @@ -255,6 +267,11 @@ uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, in initSampleBuffer(&sample_size); + if (DBGLEVEL >= DBG_DEBUG) { + Dbprintf("lf sampling - after init"); + printSamples(); + } + uint32_t cancel_counter = 0; int16_t checked = 0; @@ -262,7 +279,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, in // only every 1000th times, in order to save time when collecting samples. // interruptible only when logging not yet triggered - if ((checked == 2000) && (trigger_threshold > 0)) { + if ((checked == 4000) && (trigger_threshold > 0)) { if (data_available()) { checked = -1; break; @@ -306,7 +323,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, in if (samples.total_saved >= sample_size) break; } } - + if (checked == -1 && verbose) { Dbprintf("lf sampling aborted"); } @@ -397,10 +414,19 @@ void doT55x7Acquisition(size_t sample_size) { bool lowFound = false; uint16_t checker = 0; + + if (DBGLEVEL >= DBG_DEBUG) { + Dbprintf("doT55x7Acquisition - after init"); + print_stack_usage(); + } while (skipCnt < 1000 && (i < bufsize)) { - if (checker == 1000) { - if (BUTTON_PRESS() || data_available()) + + if (BUTTON_PRESS()) + break; + + if (checker == 4000) { + if (data_available()) break; else checker = 0; @@ -462,21 +488,24 @@ void doT55x7Acquisition(size_t sample_size) { void doCotagAcquisition(size_t sample_size) { uint8_t *dest = BigBuf_get_addr(); - uint16_t bufsize = BigBuf_max_traceLen(); - - if (bufsize > sample_size) - bufsize = sample_size; + uint16_t bufsize = MIN(sample_size, BigBuf_max_traceLen()); dest[0] = 0; uint8_t firsthigh = 0, firstlow = 0; - uint16_t i = 0; - uint16_t noise_counter = 0; - - uint16_t checker = 0; + uint16_t i = 0, noise_counter = 0, checker = 0; + + if (DBGLEVEL >= DBG_DEBUG) { + Dbprintf("doCotagAcquisition - after init"); + print_stack_usage(); + } while ((i < bufsize) && (noise_counter < (COTAG_T1 << 1))) { - if (checker == 1000) { - if (BUTTON_PRESS() || data_available()) + + if (BUTTON_PRESS()) + break; + + if (checker == 4000) { + if (data_available()) break; else checker = 0; @@ -530,21 +559,26 @@ void doCotagAcquisition(size_t sample_size) { uint32_t doCotagAcquisitionManchester(void) { uint8_t *dest = BigBuf_get_addr(); - uint16_t bufsize = BigBuf_max_traceLen(); - - if (bufsize > COTAG_BITS) - bufsize = COTAG_BITS; + uint16_t bufsize = MIN(COTAG_BITS, BigBuf_max_traceLen()); dest[0] = 0; uint8_t firsthigh = 0, firstlow = 0; - uint16_t sample_counter = 0, period = 0; uint8_t curr = 0, prev = 0; - uint16_t noise_counter = 0; - uint16_t checker = 0; - + uint16_t sample_counter = 0, period = 0; + uint16_t noise_counter = 0, checker = 0; + + if (DBGLEVEL >= DBG_DEBUG) { + Dbprintf("doCotagAcquisitionManchester - after init"); + print_stack_usage(); + } + while ((sample_counter < bufsize) && (noise_counter < (COTAG_T1 << 1))) { - if (checker == 1000) { - if (BUTTON_PRESS() || data_available()) + + if (BUTTON_PRESS()) + break; + + if (checker == 4000) { + if ( data_available()) break; else checker = 0; diff --git a/armsrc/lfsampling.h b/armsrc/lfsampling.h index 44910316d..9b8c4c6b1 100644 --- a/armsrc/lfsampling.h +++ b/armsrc/lfsampling.h @@ -100,5 +100,6 @@ void setSamplingConfig(sample_config *sc); sample_config *getSamplingConfig(void); void printConfig(void); +void printSamples(void); #endif // __LFSAMPLING_H From d06029c63f60cb41f3c2e6caea2ef867f5ff562f Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 23 Jun 2020 11:24:00 +0200 Subject: [PATCH 03/35] textual --- client/src/cmdtrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/cmdtrace.c b/client/src/cmdtrace.c index 5b397805f..1b172bfb3 100644 --- a/client/src/cmdtrace.c +++ b/client/src/cmdtrace.c @@ -199,7 +199,7 @@ static uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *tr if (tracepos + TRACELOG_HDR_LEN + data_len + TRACELOG_PARITY_LEN(hdr) > traceLen) { return traceLen; } - + uint8_t *frame = hdr->frame; uint8_t *parityBytes = hdr->frame + data_len; @@ -495,7 +495,7 @@ static int CmdTraceLoad(const char *Cmd) { g_traceLen = (long)len; - PrintAndLogEx(SUCCESS, "Recorded Activity (TraceLen = " _YELLOW_("%lu") " bytes) loaded from " _YELLOW_("%s"), g_traceLen, filename); + PrintAndLogEx(SUCCESS, "Recorded Activity (TraceLen = " _YELLOW_("%lu") " bytes)", g_traceLen); return PM3_SUCCESS; } From 34769f69451b1a43a30f27f365da839337463943 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 23 Jun 2020 12:10:09 +0200 Subject: [PATCH 04/35] fix: lf_em4100rwx --- armsrc/Standalone/lf_em4100rwc.c | 78 ++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/armsrc/Standalone/lf_em4100rwc.c b/armsrc/Standalone/lf_em4100rwc.c index 0ae7e7444..c54e54fa2 100644 --- a/armsrc/Standalone/lf_em4100rwc.c +++ b/armsrc/Standalone/lf_em4100rwc.c @@ -48,7 +48,7 @@ void ModInfo(void) { DbpString(" LF EM4100 read/write/clone mode"); } -static uint64_t ReversQuads(uint64_t bits) { +static uint64_t rev_quads(uint64_t bits) { uint64_t result = 0; for (int i = 0; i < 16; i++) { result += ((bits >> (60 - 4 * i)) & 0xf) << (4 * i); @@ -56,35 +56,41 @@ static uint64_t ReversQuads(uint64_t bits) { return result >> 24; } -static void FillBuff(uint8_t bit) { +static void fillbuff(uint8_t bit) { memset(bba + buflen, bit, CLOCK / 2); buflen += (CLOCK / 2); memset(bba + buflen, bit ^ 1, CLOCK / 2); buflen += (CLOCK / 2); } -static void ConstructEM410xEmulBuf(uint64_t id) { +static void construct_EM410x_emul(uint64_t id) { - int i, j, binary[4], parity[4]; + int binary[4] = {0}; + int parity[4] = {0}; buflen = 0; - for (i = 0; i < 9; i++) - FillBuff(1); - parity[0] = parity[1] = parity[2] = parity[3] = 0; - for (i = 0; i < 10; i++) { - for (j = 3; j >= 0; j--, id /= 2) + + for (uint8_t i = 0; i < 9; i++) + fillbuff(1); + + for (uint8_t i = 0; i < 10; i++) { + for (uint8_t j = 3; j > 0; j--, id /= 2) binary[j] = id % 2; - for (j = 0; j < 4; j++) - FillBuff(binary[j]); - FillBuff(binary[0] ^ binary[1] ^ binary[2] ^ binary[3]); - for (j = 0; j < 4; j++) + + for (uint8_t j = 0; j < 4; j++) + fillbuff(binary[j]); + + fillbuff(binary[0] ^ binary[1] ^ binary[2] ^ binary[3]); + for (uint8_t j = 0; j < 4; j++) parity[j] ^= binary[j]; } - for (j = 0; j < 4; j++) - FillBuff(parity[j]); - FillBuff(0); + + for (uint8_t j = 0; j < 4; j++) + fillbuff(parity[j]); + + fillbuff(0); } -static void LED_Slot(int i) { +static void led_slot(int i) { LEDsoff(); if (slots_count > 4) { LED(i % MAX_IND, 0); //binary indication, usefully for slots_count > 4 @@ -93,8 +99,8 @@ static void LED_Slot(int i) { } } -static void FlashLEDs(uint32_t speed, uint8_t times) { - for (int i = 0; i < times * 2; i++) { +static void flash_leds(uint32_t speed, uint8_t times) { + for (uint16_t i = 0; i < times * 2; i++) { LED_A_INV(); LED_B_INV(); LED_C_INV(); @@ -132,24 +138,28 @@ void RunMod(void) { uint8_t state = 0; slots_count = ARRAYLEN(low); bba = BigBuf_get_addr(); - LED_Slot(selected); + led_slot(selected); for (;;) { + WDT_HIT(); + if (data_available()) break; + int button_pressed = BUTTON_HELD(1000); SpinDelay(300); + switch (state) { case 0: // Select mode if (button_pressed == BUTTON_HOLD) { // Long press - switch to simulate mode SpinUp(100); - LED_Slot(selected); + led_slot(selected); state = 2; } else if (button_pressed == BUTTON_SINGLE_CLICK) { // Click - switch to next slot selected = (selected + 1) % slots_count; - LED_Slot(selected); + led_slot(selected); } break; case 1: @@ -157,12 +167,12 @@ void RunMod(void) { if (button_pressed == BUTTON_HOLD) { // Long press - switch to read mode SpinUp(100); - LED_Slot(selected); + led_slot(selected); state = 3; } else if (button_pressed == BUTTON_SINGLE_CLICK) { // Click - exit to select mode - CmdEM410xdemod(1, &high[selected], &low[selected]); - FlashLEDs(100, 5); + lf_em410x_watch(1, &high[selected], &low[selected]); + flash_leds(100, 5); #ifdef WITH_FLASH SaveIDtoFlash(selected, low[selected]); #endif @@ -174,15 +184,17 @@ void RunMod(void) { if (button_pressed == BUTTON_HOLD) { // Long press - switch to read mode SpinDown(100); - LED_Slot(selected); + led_slot(selected); state = 1; } else if (button_pressed == BUTTON_SINGLE_CLICK) { // Click - start simulating. Click again to exit from simulate mode - LED_Slot(selected); - ConstructEM410xEmulBuf(ReversQuads(low[selected])); - FlashLEDs(100, 5); + led_slot(selected); + + construct_EM410x_emul(rev_quads(low[selected])); + flash_leds(100, 5); + SimulateTagLowFrequency(buflen, 0, 1); - LED_Slot(selected); + led_slot(selected); state = 0; // Switch to select mode } break; @@ -191,12 +203,12 @@ void RunMod(void) { if (button_pressed == BUTTON_HOLD) { // Long press - switch to select mode SpinDown(100); - LED_Slot(selected); + led_slot(selected); state = 0; } else if (button_pressed == BUTTON_SINGLE_CLICK) { // Click - write ID to tag - WriteEM410x(0, (uint32_t)(low[selected] >> 32), (uint32_t)(low[selected] & 0xffffffff)); - LED_Slot(selected); + copy_em410x_to_t55xx(0, CLOCK, (uint32_t)(low[selected] >> 32), (uint32_t)(low[selected] & 0xffffffff)); + led_slot(selected); state = 0; // Switch to select mode } break; From e3c9f46425fc5bab1a4ad11190d21ea83d493943 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 23 Jun 2020 12:13:48 +0200 Subject: [PATCH 05/35] fix lf standalones --- armsrc/Standalone/lf_proxbrute.c | 5 ++--- armsrc/Standalone/lf_samyrun.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/armsrc/Standalone/lf_proxbrute.c b/armsrc/Standalone/lf_proxbrute.c index b4caf2e3f..67ef436ce 100644 --- a/armsrc/Standalone/lf_proxbrute.c +++ b/armsrc/Standalone/lf_proxbrute.c @@ -56,9 +56,8 @@ void RunMod(void) { DbpString("[=] starting recording"); - - // findone, high, low, no ledcontrol (A) - CmdHIDdemodFSK(1, &high, &low, 0); + // findone, high, low + lf_hid_watch(1, &high, &low); Dbprintf("[=] recorded | %x%08x", high, low); diff --git a/armsrc/Standalone/lf_samyrun.c b/armsrc/Standalone/lf_samyrun.c index 971304918..9646dede3 100644 --- a/armsrc/Standalone/lf_samyrun.c +++ b/armsrc/Standalone/lf_samyrun.c @@ -77,7 +77,7 @@ void RunMod(void) { // findone, high, low, no ledcontrol (A) uint32_t hi = 0, lo = 0; - CmdHIDdemodFSK(1, &hi, &lo, 0); + lf_hid_watch(1, &hi, &lo); high[selected] = hi; low[selected] = lo; From b545109800a2d2aa68af1951c56c340cc252ac67 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 23 Jun 2020 12:14:41 +0200 Subject: [PATCH 06/35] fix more lf standalone --- armsrc/Standalone/lf_hidbrute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/armsrc/Standalone/lf_hidbrute.c b/armsrc/Standalone/lf_hidbrute.c index 8c4412ebe..f0d8cae86 100644 --- a/armsrc/Standalone/lf_hidbrute.c +++ b/armsrc/Standalone/lf_hidbrute.c @@ -75,7 +75,7 @@ void RunMod(void) { // record DbpString("[=] starting recording"); - CmdHIDdemodFSK(1, &high[selected], &low[selected], 0); + lf_hid_watch(1, &high[selected], &low[selected]); Dbprintf("[=] recorded %x %x %08x", selected, high[selected], low[selected]); LEDsoff(); From 36fcb8ef2bd9a8a11c6a4a4a28646cb9501daaaf Mon Sep 17 00:00:00 2001 From: Bjoern Kerler Date: Wed, 24 Jun 2020 07:22:03 +0200 Subject: [PATCH 07/35] Fixes num_keys --- client/src/cmdhfmfdes.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index 920fcaba8..2adbeae75 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -1240,15 +1240,14 @@ static int handler_desfire_signature(uint8_t *signature, size_t *signature_len) } // --- KEY SETTING -static int desfire_print_keysetting(uint8_t key_settings, mifare_des_authalgo_t algo) { - +static int desfire_print_keysetting(uint8_t key_settings, uint8_t num_keys, int algo) { PrintAndLogEx(SUCCESS, " AID Key settings : 0x%02x", key_settings); // 2 MSB denotes const char *str = " Max key number and type : %d, " _YELLOW_("%s"); - if (algo == MFDES_ALGO_DES) PrintAndLogEx(SUCCESS, str, "(3)DES"); - else if (algo == MFDES_ALGO_AES) PrintAndLogEx(SUCCESS, str, "AES"); - else if (algo == MFDES_ALGO_3K3DES) PrintAndLogEx(SUCCESS, str, "3K3DES"); + if (algo == MFDES_ALGO_DES) PrintAndLogEx(SUCCESS, str, num_keys & 0x3F, "(3)DES"); + else if (algo == MFDES_ALGO_AES) PrintAndLogEx(SUCCESS, str, num_keys & 0x3F, "AES"); + else if (algo == MFDES_ALGO_3K3DES) PrintAndLogEx(SUCCESS, str, num_keys & 0x3F, "3K3DES"); //PrintAndLogEx(SUCCESS, " Max number of keys in AID : %d", num_keys & 0x3F); PrintAndLogEx(INFO, "-------------------------------------------------------------"); @@ -1449,14 +1448,14 @@ static int handler_desfire_select_application(uint8_t *aid) { return PM3_SUCCESS; } -static int key_setting_to_algo(uint8_t aid[3], uint8_t *key_setting, mifare_des_authalgo_t *algo) { +static int key_setting_to_algo(uint8_t aid[3], uint8_t *key_setting, mifare_des_authalgo_t *algo, uint8_t *num_keys) { int res = handler_desfire_select_application(aid); if (res != PM3_SUCCESS) return res; - uint8_t num_keys = 0; - res = handler_desfire_getkeysettings(key_setting, &num_keys); + *num_keys = 0; + res = handler_desfire_getkeysettings(key_setting, num_keys); if (res == PM3_SUCCESS) { - switch (num_keys >> 6) { + switch (*num_keys >> 6) { case 0: *algo = MFDES_ALGO_DES; break; @@ -1863,8 +1862,8 @@ static int getKeySettings(uint8_t *aid) { // KEY Settings - AMK uint8_t num_keys = 0; uint8_t key_setting = 0; - mifare_des_authalgo_t algo; - res = key_setting_to_algo(aid, &key_setting, &algo); + mifare_des_authalgo_t algo=MFDES_ALGO_DES; + res = key_setting_to_algo(aid, &key_setting, &algo, &num_keys); if (res == PM3_SUCCESS) { // number of Master keys (0x01) @@ -1915,10 +1914,10 @@ static int getKeySettings(uint8_t *aid) { // KEY Settings - AMK uint8_t num_keys = 0; uint8_t key_setting = 0; - mifare_des_authalgo_t algo; - res = key_setting_to_algo(aid, &key_setting, &algo); + mifare_des_authalgo_t algo=MFDES_ALGO_DES; + res = key_setting_to_algo(aid, &key_setting, &algo, &num_keys); if (res == PM3_SUCCESS) { - desfire_print_keysetting(key_setting, algo); + desfire_print_keysetting(key_setting, num_keys, algo); } else { PrintAndLogEx(WARNING, _RED_(" Can't read Application Master key settings")); } From a5b406bffa75b8e65dd532743f288ad251486c2e Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 24 Jun 2020 11:33:19 +0200 Subject: [PATCH 08/35] chg: empty call to powershell.exe triggers colors on ProxSpace --- pm3 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pm3 b/pm3 index 771dce77d..d9d402cf2 100755 --- a/pm3 +++ b/pm3 @@ -354,6 +354,12 @@ else echo >&2 "[!!] Script ran under unknown name, abort: $SCRIPT" exit 1 fi + +HOSTOS=$(uname | awk '{print toupper($0)}') +if [[ "$HOSTOS" =~ MINGW(32|64)_NT* ]]; then + $(powershell.exe -command "Out-Null") +fi + if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then HELP exit 0 @@ -389,7 +395,6 @@ if [ "$1" == "-n" ]; then fi fi -HOSTOS=$(uname | awk '{print toupper($0)}') if [ "$HOSTOS" = "LINUX" ]; then if uname -a|grep -q Microsoft; then # Test presence of wmic From c2df7ed824aab8543bd031614cfca70565e6f56a Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 24 Jun 2020 11:51:00 +0200 Subject: [PATCH 09/35] chg: trigger colorsmode (proxspace) in direct calls to client --- client/src/proxmark3.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index d820e297d..50d7d660b 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -641,7 +641,6 @@ finish2: #if defined(_WIN32) static bool DetectWindowsAnsiSupport(void) { - bool ret = false; HKEY hKey = NULL; bool virtualTerminalLevelSet = false; bool forceV2Set = false; @@ -681,9 +680,15 @@ static bool DetectWindowsAnsiSupport(void) { } RegCloseKey(hKey); } + + HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE); + DWORD dwMode = 0; + GetConsoleMode(hOut, &dwMode); + dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING; + SetConsoleMode(hOut, dwMode); + // If both VirtualTerminalLevel and ForceV2 is set, AnsiColor should work - ret = virtualTerminalLevelSet && forceV2Set; - return ret; + return virtualTerminalLevelSet && forceV2Set; } #endif From 4daa8aac2c4c3981a993fe2258c158111bf1207b Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 24 Jun 2020 11:53:00 +0200 Subject: [PATCH 10/35] Revert "chg: empty call to powershell.exe triggers colors on ProxSpace" This reverts commit a5b406bffa75b8e65dd532743f288ad251486c2e. --- pm3 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pm3 b/pm3 index d9d402cf2..771dce77d 100755 --- a/pm3 +++ b/pm3 @@ -354,12 +354,6 @@ else echo >&2 "[!!] Script ran under unknown name, abort: $SCRIPT" exit 1 fi - -HOSTOS=$(uname | awk '{print toupper($0)}') -if [[ "$HOSTOS" =~ MINGW(32|64)_NT* ]]; then - $(powershell.exe -command "Out-Null") -fi - if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then HELP exit 0 @@ -395,6 +389,7 @@ if [ "$1" == "-n" ]; then fi fi +HOSTOS=$(uname | awk '{print toupper($0)}') if [ "$HOSTOS" = "LINUX" ]; then if uname -a|grep -q Microsoft; then # Test presence of wmic From c47679b5dd752f84bf20fe1094bac7f3c4e353a1 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 24 Jun 2020 22:13:41 +0200 Subject: [PATCH 11/35] addition --- client/resources/aid_desfire.json | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/client/resources/aid_desfire.json b/client/resources/aid_desfire.json index 206e003a0..6c444c920 100644 --- a/client/resources/aid_desfire.json +++ b/client/resources/aid_desfire.json @@ -10,11 +10,19 @@ { "AID": "D3494F", "Vendor": "HID", - "Country": "United States", + "Country": "US", "Name": "SIO DESFire Ev1", - "Description": "", + "Description": "Genuine HID", "Type": "pacs" }, + { + "AID": "D9494F", + "Vendor": "HID", + "Country": "US", + "Name": "Access control", + "Description": "Genuine HID", + "Type": "pacs" + } { "AID": "4F5931", "Vendor": "Transport of London", @@ -321,4 +329,5 @@ FFFFFF General Issuer Information (FIDs 00: MAD Version; 01: Card Holder; 02: Ca "Description": "CAR2GO - Member Card", "Type": "carsharing" } + ] From 2878a8d481591fb2bc1b657d5d0950200d1a4b43 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Wed, 24 Jun 2020 22:18:41 +0200 Subject: [PATCH 12/35] missing semi --- client/resources/aid_desfire.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/resources/aid_desfire.json b/client/resources/aid_desfire.json index 6c444c920..926bb1475 100644 --- a/client/resources/aid_desfire.json +++ b/client/resources/aid_desfire.json @@ -12,7 +12,7 @@ "Vendor": "HID", "Country": "US", "Name": "SIO DESFire Ev1", - "Description": "Genuine HID", + "Description": "Field Encoder", "Type": "pacs" }, { @@ -22,7 +22,7 @@ "Name": "Access control", "Description": "Genuine HID", "Type": "pacs" - } + }, { "AID": "4F5931", "Vendor": "Transport of London", From 173c1702e99b504e6bfc001cc40a3e82473866e4 Mon Sep 17 00:00:00 2001 From: Monster Date: Thu, 25 Jun 2020 12:15:51 +0300 Subject: [PATCH 13/35] Add support for new "Mikron JSC Russia" UL tag. --- client/src/cmdhfmfu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index a93caf510..da2071fb7 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -1088,8 +1088,8 @@ uint32_t GetHF14AMfU_Type(void) { MF0UNH1001DUx 0004030203000B03 NT2L1001G0DUx 0004040102000B03 NT2H1001G0DUx 0004040202000B03 + Micron UL 0034210101000E03 */ - if (memcmp(version, "\x00\x04\x03\x01\x01\x00\x0B", 7) == 0) { tagtype = UL_EV1_48; break; } else if (memcmp(version, "\x00\x04\x03\x01\x02\x00\x0B", 7) == 0) { tagtype = UL_NANO_40; break; } else if (memcmp(version, "\x00\x04\x03\x02\x01\x00\x0B", 7) == 0) { tagtype = UL_EV1_48; break; } @@ -1106,6 +1106,7 @@ uint32_t GetHF14AMfU_Type(void) { else if (memcmp(version, "\x00\x04\x04\x05\x02\x01\x15", 7) == 0) { tagtype = NTAG_I2C_2K; break; } else if (memcmp(version, "\x00\x04\x04\x05\x02\x02\x13", 7) == 0) { tagtype = NTAG_I2C_1K_PLUS; break; } else if (memcmp(version, "\x00\x04\x04\x05\x02\x02\x15", 7) == 0) { tagtype = NTAG_I2C_2K_PLUS; break; } + else if (memcmp(version, "\x00\x34\x21\x01\x01\x00\x0E", 7) == 0) { tagtype = UL; break; } else if (version[2] == 0x04) { tagtype = NTAG; break; } else if (version[2] == 0x03) { tagtype = UL_EV1; } break; From 7c2fe1e8e6e03fadd311d43d53331d1236e5d0b5 Mon Sep 17 00:00:00 2001 From: Aram Date: Thu, 25 Jun 2020 21:09:18 +0200 Subject: [PATCH 14/35] Show usage menu for invalid/missing commands --- client/src/cmdlfhitag.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/client/src/cmdlfhitag.c b/client/src/cmdlfhitag.c index b05405465..b80c84522 100644 --- a/client/src/cmdlfhitag.c +++ b/client/src/cmdlfhitag.c @@ -572,6 +572,7 @@ static int CmdLFHitagReader(const char *Cmd) { // No additional parameters needed break; } + default: case RHT1F_PLAIN: case RHT1F_AUTHENTICATE: case WHTSF_CHALLENGE: @@ -680,6 +681,7 @@ static int CmdLFHitagWriter(const char *Cmd) { num_to_bytes(param_get32ex(Cmd, 3, 0, 16), 4, htd.crypto.data); break; } + default: case RHT1F_PLAIN: case RHT1F_AUTHENTICATE: case RHTSF_CHALLENGE: From 6484bd641c24d3c92648caa306cac1f1c4b1b3c4 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 00:04:41 +0200 Subject: [PATCH 15/35] textual --- client/src/cmdlfio.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/client/src/cmdlfio.c b/client/src/cmdlfio.c index 92f914059..5e729fd82 100644 --- a/client/src/cmdlfio.c +++ b/client/src/cmdlfio.c @@ -47,12 +47,12 @@ static int usage_lf_io_sim(void) { PrintAndLogEx(NORMAL, "Usage: lf io sim [h] "); PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, " h : This help"); - PrintAndLogEx(NORMAL, " : 8bit version (decimal)"); - PrintAndLogEx(NORMAL, " : 8bit value facility code (hex)"); - PrintAndLogEx(NORMAL, " : 16bit value card number (decimal)"); + PrintAndLogEx(NORMAL, " : 8bit version (" _YELLOW_("decimal") ")"); + PrintAndLogEx(NORMAL, " : 8bit value facility code (" _YELLOW_("hex") ")"); + PrintAndLogEx(NORMAL, " : 16bit value card number (" _YELLOW_("decimal") ")"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, _YELLOW_(" lf io sim 26 101 1337")); + PrintAndLogEx(NORMAL, _YELLOW_(" lf io sim 01 101 1337")); return PM3_SUCCESS; } @@ -63,13 +63,13 @@ static int usage_lf_io_clone(void) { PrintAndLogEx(NORMAL, "Usage: lf io clone [h] [Q5]"); PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, " h : This help"); - PrintAndLogEx(NORMAL, " : 8bit version (decimal)"); - PrintAndLogEx(NORMAL, " : 8bit value facility code (hex)"); - PrintAndLogEx(NORMAL, " : 16bit value card number (decimal)"); + PrintAndLogEx(NORMAL, " : 8bit version (" _YELLOW_("decimal") ")"); + PrintAndLogEx(NORMAL, " : 8bit value facility code (" _YELLOW_("hex") ")"); + PrintAndLogEx(NORMAL, " : 16bit value card number (" _YELLOW_("decimal") ")"); PrintAndLogEx(NORMAL, " Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, _YELLOW_(" lf io clone 26 101 1337")); + PrintAndLogEx(NORMAL, _YELLOW_(" lf io clone 01 101 1337")); return PM3_SUCCESS; } From f4c91bc3aa75560afe22c591844c76b8db5afba6 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 00:43:56 +0200 Subject: [PATCH 16/35] space --- client/src/cmdhf.c | 2 +- client/src/cmdlf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/cmdhf.c b/client/src/cmdhf.c index 26723ca6a..989211f1b 100644 --- a/client/src/cmdhf.c +++ b/client/src/cmdhf.c @@ -231,7 +231,7 @@ int CmdHFTune(const char *Cmd) { } uint16_t volt = resp.data.asDwords[0] & 0xFFFF; - PrintAndLogEx(INPLACE, "%u mV / %2u V", volt, (uint16_t)(volt / 1000)); + PrintAndLogEx(INPLACE, " %u mV / %2u V", volt, (uint16_t)(volt / 1000)); } mode[0] = 3; diff --git a/client/src/cmdlf.c b/client/src/cmdlf.c index 9403dc208..ace50f2d7 100644 --- a/client/src/cmdlf.c +++ b/client/src/cmdlf.c @@ -286,7 +286,7 @@ static int CmdLFTune(const char *Cmd) { } uint32_t volt = resp.data.asDwords[0]; - PrintAndLogEx(INPLACE, "%u mV / %3u V", volt, (uint32_t)(volt / 1000)); + PrintAndLogEx(INPLACE, " %u mV / %3u V", volt, (uint32_t)(volt / 1000)); } params[0] = 3; From 9ad944c4a1cbe946c04343bd170446ead5d195e1 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 12:02:32 +0200 Subject: [PATCH 17/35] color,text --- client/src/cmdlfawid.c | 12 ++-- client/src/cmdlfguard.c | 8 +-- client/src/cmdlfio.c | 15 ++-- client/src/cmdlfparadox.c | 134 ++++++++++++++++++++++++++---------- client/src/cmdlfpyramid.c | 12 ++-- client/src/cmdlfsecurakey.c | 4 +- 6 files changed, 122 insertions(+), 63 deletions(-) diff --git a/client/src/cmdlfawid.c b/client/src/cmdlfawid.c index c42c719f0..a6fb9f81b 100644 --- a/client/src/cmdlfawid.c +++ b/client/src/cmdlfawid.c @@ -290,21 +290,21 @@ static int CmdAWIDDemod(const char *Cmd) { fc = bytebits_to_byte(bits + 9, 8); cardnum = bytebits_to_byte(bits + 17, 16); code1 = bytebits_to_byte(bits + 8, fmtLen); - PrintAndLogEx(SUCCESS, "AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); break; case 34: fc = bytebits_to_byte(bits + 9, 8); cardnum = bytebits_to_byte(bits + 17, 24); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); - PrintAndLogEx(SUCCESS, "AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; case 37: fc = bytebits_to_byte(bits + 9, 13); cardnum = bytebits_to_byte(bits + 22, 18); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); - PrintAndLogEx(SUCCESS, "AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d")" FC: " _GREEN_("%d")" Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; // case 40: // break; @@ -313,18 +313,18 @@ static int CmdAWIDDemod(const char *Cmd) { cardnum = bytebits_to_byte(bits + 25, 32); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); - PrintAndLogEx(SUCCESS, "AWID Found - BitLength: %d, FC: %d, Card: %u - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; default: if (fmtLen > 32) { cardnum = bytebits_to_byte(bits + 8 + (fmtLen - 17), 16); code1 = bytebits_to_byte(bits + 8, fmtLen - 32); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); - PrintAndLogEx(SUCCESS, "AWID Found - BitLength: %d -unknown BitLength- (%u) - Wiegand: %x%08x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d") " -unknown- (%u) - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); } else { cardnum = bytebits_to_byte(bits + 8 + (fmtLen - 17), 16); code1 = bytebits_to_byte(bits + 8, fmtLen); - PrintAndLogEx(SUCCESS, "AWID Found - BitLength: %d -unknown BitLength- (%u) - Wiegand: %x, Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d") " -unknown- (%u) - Wiegand: " _GREEN_("%x") ", Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); } break; } diff --git a/client/src/cmdlfguard.c b/client/src/cmdlfguard.c index 22579a54b..db67a3568 100644 --- a/client/src/cmdlfguard.c +++ b/client/src/cmdlfguard.c @@ -38,7 +38,7 @@ static int usage_lf_guard_clone(void) { PrintAndLogEx(NORMAL, " : 16-bit value card number"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf gprox clone 26 123 11223"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf gprox clone 26 123 11223")); return PM3_SUCCESS; } @@ -55,7 +55,7 @@ static int usage_lf_guard_sim(void) { PrintAndLogEx(NORMAL, " : 16-bit value card number"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf gprox sim 26 123 11223"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf gprox sim 26 123 11223")); return PM3_SUCCESS; } @@ -139,9 +139,9 @@ static int CmdGuardDemod(const char *Cmd) { break; } if (!unknown) - PrintAndLogEx(SUCCESS, "G-Prox-II Found: Format Len: %ubit - FC: %u - Card: %u, Raw: %08x%08x%08x", fmtLen, FC, Card, raw1, raw2, raw3); + PrintAndLogEx(SUCCESS, "G-Prox-II found - Fmt: " _GREEN_("%u")"bit FC: " _GREEN_("%u") " Card: " _GREEN_("%u") ", Raw: %08x%08x%08x", fmtLen, FC, Card, raw1, raw2, raw3); else - PrintAndLogEx(SUCCESS, "Unknown G-Prox-II Fmt Found: Format Len: %u, Raw: %08x%08x%08x", fmtLen, raw1, raw2, raw3); + PrintAndLogEx(SUCCESS, "Unknown G-Prox-II found - Fmt: %u, Raw: %08x%08x%08x", fmtLen, raw1, raw2, raw3); return PM3_SUCCESS; } diff --git a/client/src/cmdlfio.c b/client/src/cmdlfio.c index 5e729fd82..5502786b6 100644 --- a/client/src/cmdlfio.c +++ b/client/src/cmdlfio.c @@ -166,22 +166,21 @@ static int CmdIOProxDemod(const char *Cmd) { calccrc &= 0xff; calccrc = 0xff - calccrc; - char crcStr[30]; - memset(crcStr, 0x00, sizeof(crcStr)); + char crc_str[30] = {0}; if (crc == calccrc) { - snprintf(crcStr, 3, "ok"); - + snprintf(crc_str, sizeof(crc_str), "(" _GREEN_("ok") ")" ); } else { - PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox crc failed"); - - snprintf(crcStr, sizeof(crcStr), "failed 0x%02X != 0x%02X", crc, calccrc); + snprintf(crc_str, sizeof(crc_str), "(" _RED_("fail") ") 0x%02X != 0x%02X", crc, calccrc); retval = PM3_ESOFT; } - PrintAndLogEx(SUCCESS, "IO Prox XSF(%02d)%02x:%05d (%08x%08x) [crc %s]", version, facilitycode, number, code, code2, crcStr); + PrintAndLogEx(SUCCESS, "IO Prox XSF(%02d)%02x:%05d (%08x%08x) %s", version, facilitycode, number, code, code2, crc_str); if (g_debugMode) { + if (crc != calccrc) + PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox crc failed"); + PrintAndLogEx(DEBUG, "DEBUG: IO prox idx: %d, Len: %zu, Printing demod buffer:", idx, size); printDemodBuff(); } diff --git a/client/src/cmdlfparadox.c b/client/src/cmdlfparadox.c index c94e17cf7..662ea781c 100644 --- a/client/src/cmdlfparadox.c +++ b/client/src/cmdlfparadox.c @@ -24,6 +24,7 @@ #include "lfdemod.h" #include "protocols.h" // t55xx defines #include "cmdlft55xx.h" // clone.. +#include "crc.h" // maxim static int CmdHelp(const char *Cmd); @@ -36,7 +37,7 @@ static int usage_lf_paradox_clone(void) { PrintAndLogEx(NORMAL, " b : raw hex data. 12 bytes max"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf paradox clone b 0f55555695596a6a9999a59a"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf paradox clone b 0f55555695596a6a9999a59a")); return PM3_SUCCESS; } @@ -53,16 +54,33 @@ static int usage_lf_paradox_sim(void) { PrintAndLogEx(NORMAL, " : 16-bit value card number"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf paradox sim 123 11223"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf paradox sim 123 11223")); return PM3_SUCCESS; } */ +const uint8_t paradox_lut[] = { + 0xDB, 0xFC, 0x3F, 0xC5, 0x50, 0x14, 0x05, 0x47, + 0x9F, 0xED, 0x7D, 0x59, 0x22, 0x84, 0x21, 0x4E, + 0x39, 0x48, 0x12, 0x88, 0x53, 0xDE, 0xBB, 0xE4, + 0xB4, 0x2D, 0x4D, 0x55, 0xCA, 0xBE, 0xA3, 0xE2 + }; +// FC:108, Card01827 +// 00000000 01101100 00000111 00100011 +// hex(0xED xor 0x7D xor 0x22 xor 0x84 xor 0xDE xor 0xBB xor 0xE4 xor 0x4D xor 0xA3 xor 0xE2 xor 0x47) 0xFC + +#define PARADOX_PREAMBLE_LEN 8 + +static int CmdParadoxDemod(const char *Cmd) { + (void)Cmd; // Cmd is not used so far + return demodParadox(); +} + //by marshmellow //Paradox Prox demod - FSK2a RF/50 with preamble of 00001111 (then manchester encoded) //print full Paradox Prox ID and some bit format details if found -static int CmdParadoxDemod(const char *Cmd) { - (void)Cmd; // Cmd is not used so far + +int demodParadox(void) { //raw fsk demod no manchester decoding no start bit finding just get binary from wave uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0}; size_t size = getFromGraphBuf(bits); @@ -71,12 +89,10 @@ static int CmdParadoxDemod(const char *Cmd) { return PM3_ESOFT; } - uint32_t hi2 = 0, hi = 0, lo = 0; - int waveIdx = 0; + int wave_idx = 0; //get binary from fsk wave - int idx = detectParadox(bits, &size, &hi2, &hi, &lo, &waveIdx); + int idx = detectParadox(bits, &size, &wave_idx); if (idx < 0) { - if (idx == -1) PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples"); else if (idx == -2) @@ -85,16 +101,52 @@ static int CmdParadoxDemod(const char *Cmd) { PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox problem during FSK demod"); else if (idx == -4) PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox preamble not found"); - else if (idx == -5) - PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error in Manchester data, size %zu", size); else PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error demoding fsk %d", idx); return PM3_ESOFT; } + uint8_t *b = bits + idx; + uint8_t rawhex[12] = {0}; + for (uint8_t i = 0, m = 0, p = 1; i < 96; i++) { + + // convert hex + rawhex[m] <<= 1; + rawhex[m] |= (*b & 1); + b++; + + if (p == 8) { + m++; + p = 1; + } else { + p++; + } + } + + uint32_t hi2 = 0, hi = 0, lo = 0; + uint8_t error = 0; + + // Remove manchester encoding from FSK bits, skip pre + for (uint8_t i = idx + PARADOX_PREAMBLE_LEN; i < (idx + 96 - PARADOX_PREAMBLE_LEN ); i += 2) { + + // not manchester data + if (bits[i] == bits[i + 1]) { + PrintAndLogEx(WARNING, "Error Manchester at %u", i); + error++; + } + + hi2 = (hi2 << 1) | (hi >> 31); + hi = (hi << 1) | (lo >> 31); + lo <<= 1; + + if (bits[i] && !bits[i + 1]) { + lo |= 1; // 10 + } + } + setDemodBuff(bits, size, idx); - setClockGrid(50, waveIdx + (idx * 50)); + setClockGrid(50, wave_idx + (idx * 50)); if (hi2 == 0 && hi == 0 && lo == 0) { PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox no value found"); @@ -103,15 +155,41 @@ static int CmdParadoxDemod(const char *Cmd) { uint32_t fc = ((hi & 0x3) << 6) | (lo >> 26); uint32_t cardnum = (lo >> 10) & 0xFFFF; + uint8_t chksum = (lo >> 2) & 0xFF; + + + // Calc CRC & Checksum + // 000088f0b - FC: 8 - Card: 36619 - Checksum: 05 - RAW: 0f55555559595aa559a5566a + // checksum? + uint8_t calc_chksum = 0x47; + uint8_t pos = 0; + for(uint8_t i = 0; i < 8; i++ ) { + + uint8_t ice = rawhex[i+1]; + for(uint8_t j = 0x80; j > 0; j >>= 2) { + + if (ice & j) { + calc_chksum ^= paradox_lut[pos]; + } + pos++; + } + } + + uint32_t crc = CRC8Maxim(rawhex + 1, 8); + PrintAndLogEx(DEBUG, " FSK/MAN raw : %s", sprint_hex(rawhex, sizeof(rawhex))); + PrintAndLogEx(DEBUG, " raw : %s = (maxim crc8) %02x == %02x", sprint_hex(rawhex + 1, 8), crc, calc_chksum); +// PrintAndLogEx(DEBUG, " OTHER sample CRC-8/MAXIM : 55 55 69 A5 55 6A 59 5A = FC"); + uint32_t rawLo = bytebits_to_byte(bits + idx + 64, 32); uint32_t rawHi = bytebits_to_byte(bits + idx + 32, 32); uint32_t rawHi2 = bytebits_to_byte(bits + idx, 32); - PrintAndLogEx(NORMAL, "Paradox TAG ID: %x%08x - FC: %d - Card: %d - Checksum: %02x - RAW: %08x%08x%08x", + PrintAndLogEx(INFO, "Paradox TAG ID: " _GREEN_("%x%08x") " - FC: " _GREEN_("%d") ", CN: " _GREEN_("%d") " - Checksum: %02x - RAW: %08x%08x%08x", hi >> 10, (hi & 0x3) << 26 | (lo >> 10), - fc, cardnum, - (lo >> 2) & 0xFF, + fc, + cardnum, + chksum, rawHi2, rawHi, rawLo @@ -244,43 +322,25 @@ int CmdLFParadox(const char *Cmd) { } // loop to get raw paradox waveform then FSK demodulate the TAG ID from it -int detectParadox(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo, int *waveStartIdx) { +int detectParadox(uint8_t *dest, size_t *size, int *wave_start_idx) { //make sure buffer has data if (*size < 96 * 50) return -1; if (getSignalProperties()->isnoise) return -2; // FSK demodulator - *size = fskdemod(dest, *size, 50, 1, 10, 8, waveStartIdx); // paradox fsk2a + *size = fskdemod(dest, *size, 50, 1, 10, 8, wave_start_idx); // paradox fsk2a //did we get a good demod? if (*size < 96) return -3; // 00001111 bit pattern represent start of frame, 01 pattern represents a 0 and 10 represents a 1 - size_t startIdx = 0; + size_t idx = 0; uint8_t preamble[] = {0, 0, 0, 0, 1, 1, 1, 1}; - if (!preambleSearch(dest, preamble, sizeof(preamble), size, &startIdx)) + if (!preambleSearch(dest, preamble, sizeof(preamble), size, &idx)) return -4; //preamble not found - size_t numStart = startIdx + sizeof(preamble); - // final loop, go over previously decoded FSK data and manchester decode into usable tag ID - for (size_t idx = numStart; (idx - numStart) < *size - sizeof(preamble); idx += 2) { - if (dest[idx] == dest[idx + 1]) - return -5; //not manchester data - - *hi2 = (*hi2 << 1) | (*hi >> 31); - *hi = (*hi << 1) | (*lo >> 31); - //Then, shift in a 0 or one into low - *lo <<= 1; - if (dest[idx] && !dest[idx + 1]) // 1 0 - *lo |= 1; - else // 0 1 - *lo |= 0; - } - return (int)startIdx; + return (int)idx; } -int demodParadox(void) { - return CmdParadoxDemod(""); -} diff --git a/client/src/cmdlfpyramid.c b/client/src/cmdlfpyramid.c index 03a9a751c..65004f897 100644 --- a/client/src/cmdlfpyramid.c +++ b/client/src/cmdlfpyramid.c @@ -43,7 +43,7 @@ static int usage_lf_pyramid_clone(void) { PrintAndLogEx(NORMAL, " Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf pyramid clone 123 11223"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf pyramid clone 123 11223")); return PM3_SUCCESS; } @@ -60,7 +60,7 @@ static int usage_lf_pyramid_sim(void) { PrintAndLogEx(NORMAL, " : 16-bit value card number"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf pyramid sim 123 11223"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf pyramid sim 123 11223")); return PM3_SUCCESS; } @@ -181,12 +181,12 @@ int demodPyramid(void) { uint32_t fc = bytebits_to_byte(bits + 73, 8); uint32_t cardnum = bytebits_to_byte(bits + 81, 16); uint32_t code1 = bytebits_to_byte(bits + 72, fmtLen); - PrintAndLogEx(SUCCESS, "Pyramid ID Found - BitLength: %d, FC: %d, Card: %d - Wiegand: %x, Raw: %08x%08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi3, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "Pyramid ID Found - BitLength: %d, FC: " _GREEN_("%d") " Card: " _GREEN_("%d") " - Wiegand: " _GREEN_("%x")", Raw: %08x%08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi3, rawHi2, rawHi, rawLo); } else if (fmtLen == 45) { fmtLen = 42; //end = 10 bits not 7 like 26 bit fmt uint32_t fc = bytebits_to_byte(bits + 53, 10); uint32_t cardnum = bytebits_to_byte(bits + 63, 32); - PrintAndLogEx(SUCCESS, "Pyramid ID Found - BitLength: %d, FC: %d, Card: %d - Raw: %08x%08x%08x%08x", fmtLen, fc, cardnum, rawHi3, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "Pyramid ID Found - BitLength: %d, FC: " _GREEN_("%d") " Card: " _GREEN_("%d") " - Raw: %08x%08x%08x%08x", fmtLen, fc, cardnum, rawHi3, rawHi2, rawHi, rawLo); /* } else if (fmtLen > 32) { uint32_t cardnum = bytebits_to_byte(bits + 81, 16); @@ -197,13 +197,13 @@ int demodPyramid(void) { } else { uint32_t cardnum = bytebits_to_byte(bits + 81, 16); //uint32_t code1 = bytebits_to_byte(bits+(size-fmtLen),fmtLen); - PrintAndLogEx(SUCCESS, "Pyramid ID Found - BitLength: %d -unknown BitLength- (%d), Raw: %08x%08x%08x%08x", fmtLen, cardnum, rawHi3, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "Pyramid ID Found - BitLength: %d -unknown BitLength- Card: " _GREEN_("%d") ", Raw: %08x%08x%08x%08x", fmtLen, cardnum, rawHi3, rawHi2, rawHi, rawLo); } PrintAndLogEx(DEBUG, "DEBUG: Pyramid: checksum : 0x%02X - %02X - %s" , checksum , checkCS - , (checksum == checkCS) ? _GREEN_("Passed") : _RED_("Fail") + , (checksum == checkCS) ? _GREEN_("ok") : _RED_("fail") ); PrintAndLogEx(DEBUG, "DEBUG: Pyramid: idx: %d, Len: %d, Printing Demod Buffer:", idx, 128); diff --git a/client/src/cmdlfsecurakey.c b/client/src/cmdlfsecurakey.c index 4b01afe2d..3fd689360 100644 --- a/client/src/cmdlfsecurakey.c +++ b/client/src/cmdlfsecurakey.c @@ -118,9 +118,9 @@ int demodSecurakey(void) { // test parities - evenparity32 looks to add an even parity returns 0 if already even... bool parity = !evenparity32(lWiegand) && !oddparity32(rWiegand); - PrintAndLogEx(SUCCESS, "Securakey Tag Found--BitLen: %u, Card ID: %u, FC: 0x%X, Raw: %08X%08X%08X", bitLen, cardid, fc, raw1, raw2, raw3); + PrintAndLogEx(SUCCESS, "Securakey Tag Found--BitLen: " _GREEN_("%u") ", Card ID: " _GREEN_("%u") ", FC: " _GREEN_("0x%X")" Raw: %08X%08X%08X", bitLen, cardid, fc, raw1, raw2, raw3); if (bitLen <= 32) - PrintAndLogEx(SUCCESS, "Wiegand: %08X, Parity: %s", (lWiegand << (bitLen / 2)) | rWiegand, parity ? "Passed" : "Failed"); + PrintAndLogEx(SUCCESS, "Wiegand: " _GREEN_("%08X") ", Parity: %s", (lWiegand << (bitLen / 2)) | rWiegand, parity ? _GREEN_("ok") : _RED_("fail")); PrintAndLogEx(INFO, "\nHow the FC translates to printed FC is unknown"); PrintAndLogEx(INFO, "How the checksum is calculated is unknown"); From dbc2fb188a98b4f93ded774d76bab30f2c65c44d Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 12:02:57 +0200 Subject: [PATCH 18/35] text,color --- client/src/cmdlfgallagher.c | 8 ++++---- client/src/cmdlfparadox.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/cmdlfgallagher.c b/client/src/cmdlfgallagher.c index 30d836072..010fbaf47 100644 --- a/client/src/cmdlfgallagher.c +++ b/client/src/cmdlfgallagher.c @@ -36,7 +36,7 @@ static int usage_lf_gallagher_clone(void) { PrintAndLogEx(NORMAL, " b : raw hex data. 12 bytes max"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf gallagher clone b 0FFD5461A9DA1346B2D1AC32 "); + PrintAndLogEx(NORMAL, _YELLOW_(" lf gallagher clone b 0FFD5461A9DA1346B2D1AC32")); return PM3_SUCCESS; } @@ -127,10 +127,10 @@ static int CmdGallagherDemod(const char *Cmd) { // 4bit issue level uint8_t il = arr[7] & 0x0F; - PrintAndLogEx(SUCCESS, "GALLAGHER Tag Found -- Region: %u FC: %u CN: %u Issue Level: %u", rc, fc, cn, il); - PrintAndLogEx(SUCCESS, " Printed: %C%u", rc + 0x40, fc); + PrintAndLogEx(SUCCESS, "GALLAGHER Tag Found -- Region: " _GREEN_("%u") " FC: " _GREEN_("%u") " CN: " _GREEN_("%u") " Issue Level: " _GREEN_("%u"), rc, fc, cn, il); + PrintAndLogEx(SUCCESS, " Printed: " _GREEN_("%C%u"), rc + 0x40, fc); PrintAndLogEx(SUCCESS, " Raw: %08X%08X%08X", raw1, raw2, raw3); - PrintAndLogEx(SUCCESS, " CRC: %02X - %02X (%s)", crc, calc_crc, (crc == calc_crc) ? "OK" : "Failed"); + PrintAndLogEx(SUCCESS, " CRC: %02X - %02X (%s)", crc, calc_crc, (crc == calc_crc) ? "ok" : "fail"); return PM3_SUCCESS; } diff --git a/client/src/cmdlfparadox.h b/client/src/cmdlfparadox.h index 34c3cb6cd..159d66da9 100644 --- a/client/src/cmdlfparadox.h +++ b/client/src/cmdlfparadox.h @@ -14,5 +14,5 @@ int CmdLFParadox(const char *Cmd); int demodParadox(void); -int detectParadox(uint8_t *dest, size_t *size, uint32_t *hi2, uint32_t *hi, uint32_t *lo, int *waveStartIdx); +int detectParadox(uint8_t *dest, size_t *size, int *wave_start_idx); #endif From 5643eb685d88bcfa2a1dce1ba951c6fb991453c5 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 13:01:17 +0200 Subject: [PATCH 19/35] text, color --- client/src/cmdlfawid.c | 12 ++++++------ client/src/cmdlffdx.c | 8 ++++---- client/src/cmdlfgallagher.c | 2 +- client/src/cmdlfguard.c | 4 ++-- client/src/cmdlfhid.c | 8 +++++--- client/src/cmdlfindala.c | 33 +++++++++++++-------------------- client/src/cmdlfio.c | 2 +- client/src/cmdlfjablotron.c | 14 +++++--------- client/src/cmdlfkeri.c | 15 +++++++-------- client/src/cmdlfmotorola.c | 9 ++++----- client/src/cmdlfnedap.c | 14 +++++++------- client/src/cmdlfnexwatch.c | 12 ++++++------ client/src/cmdlfnoralsy.c | 6 +++--- client/src/cmdlfpac.c | 8 ++++---- client/src/cmdlfparadox.c | 2 +- client/src/cmdlfpresco.c | 8 ++++---- client/src/cmdlfpyramid.c | 6 +++--- client/src/cmdlfsecurakey.c | 4 ++-- client/src/cmdlfverichip.c | 4 ++-- client/src/cmdlfviking.c | 10 +++++----- client/src/cmdlfvisa2000.c | 6 +++--- 21 files changed, 88 insertions(+), 99 deletions(-) diff --git a/client/src/cmdlfawid.c b/client/src/cmdlfawid.c index a6fb9f81b..fcabbbd2b 100644 --- a/client/src/cmdlfawid.c +++ b/client/src/cmdlfawid.c @@ -290,21 +290,21 @@ static int CmdAWIDDemod(const char *Cmd) { fc = bytebits_to_byte(bits + 9, 8); cardnum = bytebits_to_byte(bits + 17, 16); code1 = bytebits_to_byte(bits + 8, fmtLen); - PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo); break; case 34: fc = bytebits_to_byte(bits + 9, 8); cardnum = bytebits_to_byte(bits + 17, 24); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); - PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; case 37: fc = bytebits_to_byte(bits + 9, 13); cardnum = bytebits_to_byte(bits + 22, 18); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); - PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d")" FC: " _GREEN_("%d")" Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d")" FC: " _GREEN_("%d")" Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; // case 40: // break; @@ -313,18 +313,18 @@ static int CmdAWIDDemod(const char *Cmd) { cardnum = bytebits_to_byte(bits + 25, 32); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); - PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, code2, rawHi2, rawHi, rawLo); break; default: if (fmtLen > 32) { cardnum = bytebits_to_byte(bits + 8 + (fmtLen - 17), 16); code1 = bytebits_to_byte(bits + 8, fmtLen - 32); code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 32); - PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d") " -unknown- (%u) - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d") " -unknown- (%u) - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo); } else { cardnum = bytebits_to_byte(bits + 8 + (fmtLen - 17), 16); code1 = bytebits_to_byte(bits + 8, fmtLen); - PrintAndLogEx(SUCCESS, "AWID Found - len: " _GREEN_("%d") " -unknown- (%u) - Wiegand: " _GREEN_("%x") ", Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "AWID - len: " _GREEN_("%d") " -unknown- (%u) - Wiegand: " _GREEN_("%x") ", Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo); } break; } diff --git a/client/src/cmdlffdx.c b/client/src/cmdlffdx.c index c9af2fffc..98f93baed 100644 --- a/client/src/cmdlffdx.c +++ b/client/src/cmdlffdx.c @@ -61,8 +61,8 @@ static int usage_lf_fdx_clone(void) { PrintAndLogEx(NORMAL, " : Specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf fdx clone 999 112233"); - PrintAndLogEx(NORMAL, " lf fdx clone 999 112233 16a"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf fdx clone 999 112233")); + PrintAndLogEx(NORMAL, _YELLOW_(" lf fdx clone 999 112233 16a")); return PM3_SUCCESS; } @@ -78,8 +78,8 @@ static int usage_lf_fdx_sim(void) { PrintAndLogEx(NORMAL, " : Extended data"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf fdx sim 999 112233"); - PrintAndLogEx(NORMAL, " lf fdx sim 999 112233 16a"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf fdx sim 999 112233")); + PrintAndLogEx(NORMAL, _YELLOW_(" lf fdx sim 999 112233 16a")); return PM3_SUCCESS; } diff --git a/client/src/cmdlfgallagher.c b/client/src/cmdlfgallagher.c index 010fbaf47..3bd68a89d 100644 --- a/client/src/cmdlfgallagher.c +++ b/client/src/cmdlfgallagher.c @@ -127,7 +127,7 @@ static int CmdGallagherDemod(const char *Cmd) { // 4bit issue level uint8_t il = arr[7] & 0x0F; - PrintAndLogEx(SUCCESS, "GALLAGHER Tag Found -- Region: " _GREEN_("%u") " FC: " _GREEN_("%u") " CN: " _GREEN_("%u") " Issue Level: " _GREEN_("%u"), rc, fc, cn, il); + PrintAndLogEx(SUCCESS, "GALLAGHER - Region: " _GREEN_("%u") " FC: " _GREEN_("%u") " CN: " _GREEN_("%u") " Issue Level: " _GREEN_("%u"), rc, fc, cn, il); PrintAndLogEx(SUCCESS, " Printed: " _GREEN_("%C%u"), rc + 0x40, fc); PrintAndLogEx(SUCCESS, " Raw: %08X%08X%08X", raw1, raw2, raw3); PrintAndLogEx(SUCCESS, " CRC: %02X - %02X (%s)", crc, calc_crc, (crc == calc_crc) ? "ok" : "fail"); diff --git a/client/src/cmdlfguard.c b/client/src/cmdlfguard.c index db67a3568..746ef7f11 100644 --- a/client/src/cmdlfguard.c +++ b/client/src/cmdlfguard.c @@ -139,9 +139,9 @@ static int CmdGuardDemod(const char *Cmd) { break; } if (!unknown) - PrintAndLogEx(SUCCESS, "G-Prox-II found - Fmt: " _GREEN_("%u")"bit FC: " _GREEN_("%u") " Card: " _GREEN_("%u") ", Raw: %08x%08x%08x", fmtLen, FC, Card, raw1, raw2, raw3); + PrintAndLogEx(SUCCESS, "G-Prox-II - len: " _GREEN_("%u")" FC: " _GREEN_("%u") " Card: " _GREEN_("%u") ", Raw: %08x%08x%08x", fmtLen, FC, Card, raw1, raw2, raw3); else - PrintAndLogEx(SUCCESS, "Unknown G-Prox-II found - Fmt: %u, Raw: %08x%08x%08x", fmtLen, raw1, raw2, raw3); + PrintAndLogEx(SUCCESS, "G-Prox-II - Unknown len: " _GREEN_("%u") ", Raw: %08x%08x%08x", fmtLen, raw1, raw2, raw3); return PM3_SUCCESS; } diff --git a/client/src/cmdlfhid.c b/client/src/cmdlfhid.c index 83a97c41d..35a00ab11 100644 --- a/client/src/cmdlfhid.c +++ b/client/src/cmdlfhid.c @@ -195,7 +195,7 @@ static int CmdHIDDemod(const char *Cmd) { } if (hi2 != 0) { //extra large HID tags - PrintAndLogEx(SUCCESS, "HID Prox TAG ID: " _GREEN_("%x%08x%08x (%u)"), hi2, hi, lo, (lo >> 1) & 0xFFFF); + PrintAndLogEx(SUCCESS, "HID Prox - " _GREEN_("%x%08x%08x (%u)"), hi2, hi, lo, (lo >> 1) & 0xFFFF); } else { //standard HID tags <38 bits uint8_t fmtLen = 0; uint32_t cc = 0; @@ -241,9 +241,11 @@ static int CmdHIDDemod(const char *Cmd) { fc = ((hi & 0xF) << 12) | (lo >> 20); } if (fmtLen == 32 && (lo & 0x40000000)) { //if 32 bit and Kastle bit set - PrintAndLogEx(SUCCESS, "HID Prox TAG (Kastle format) ID: " _GREEN_("%x%08x (%u)")" - Format Len: 32bit - CC: %u - FC: %u - Card: %u", hi, lo, (lo >> 1) & 0xFFFF, cc, fc, cardnum); + PrintAndLogEx(SUCCESS, + "HID Prox (Kastle format) - " _GREEN_("%x%08x (%u)") " - len: " _GREEN_("32") " bit CC: " _GREEN_("%u") " FC: " _GREEN_("%u") " Card: " _GREEN_("%u"), hi, lo, (lo >> 1) & 0xFFFF, cc, fc, cardnum); } else { - PrintAndLogEx(SUCCESS, "HID Prox TAG ID: " _GREEN_("%x%08x (%u)")" - Format Len: " _GREEN_("%u bit")" - OEM: %03u - FC: " _GREEN_("%u")" - Card: " _GREEN_("%u"), + PrintAndLogEx(SUCCESS, + "HID Prox - " _GREEN_("%x%08x (%u)") " - len: " _GREEN_("%u") " bit - OEM: " _GREEN_("%03u") " FC: " _GREEN_("%u")" Card: " _GREEN_("%u"), hi, lo, cardnum, fmtLen, oem, fc, cardnum); } } diff --git a/client/src/cmdlfindala.c b/client/src/cmdlfindala.c index 6457bf671..919c914b2 100644 --- a/client/src/cmdlfindala.c +++ b/client/src/cmdlfindala.c @@ -50,10 +50,10 @@ static int usage_lf_indala_demod(void) { PrintAndLogEx(NORMAL, " maxerror : Set maximum allowed errors, default = 100."); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf indala demod"); - PrintAndLogEx(NORMAL, " lf indala demod 32 = demod a Indala tag from GraphBuffer using a clock of RF/32"); - PrintAndLogEx(NORMAL, " lf indala demod 32 1 = demod a Indala tag from GraphBuffer using a clock of RF/32 and inverting data"); - PrintAndLogEx(NORMAL, " lf indala demod 64 1 0 = demod a Indala tag from GraphBuffer using a clock of RF/64, inverting data and allowing 0 demod errors"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf indala demod")); + PrintAndLogEx(NORMAL, _YELLOW_(" lf indala demod 32") " = demod a Indala tag from GraphBuffer using a clock of RF/32"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf indala demod 32 1") " = demod a Indala tag from GraphBuffer using a clock of RF/32 and inverting data"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf indala demod 64 1 0") " = demod a Indala tag from GraphBuffer using a clock of RF/64, inverting data and allowing 0 demod errors"); return PM3_SUCCESS; } @@ -68,7 +68,7 @@ static int usage_lf_indala_sim(void) { PrintAndLogEx(NORMAL, " c : Cardnumber for Heden 2L format (decimal)"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf indala sim deadc0de"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf indala sim deadc0de")); return PM3_SUCCESS; } @@ -143,7 +143,7 @@ static void decodeHeden2L(uint8_t *bits) { if (bits[offset + 7]) cardnumber += 16384; if (bits[offset + 23]) cardnumber += 32768; - PrintAndLogEx(SUCCESS, "\tHeden-2L | " _YELLOW_("%u"), cardnumber); + PrintAndLogEx(SUCCESS, "\tHeden-2L | " _GREEN_("%u"), cardnumber); } // Indala 26 bit decode @@ -193,13 +193,7 @@ static int CmdIndalaDemod(const char *Cmd) { uint64_t foo = uid2 & 0x7FFFFFFF; if (DemodBufferLen == 64) { - PrintAndLogEx( - SUCCESS - , "Indala Found - bitlength %zu, Raw " _YELLOW_("%x%08x") - , DemodBufferLen - , uid1 - , uid2 - ); + PrintAndLogEx(SUCCESS, "Indala - len %zu, Raw: %x%08x", DemodBufferLen, uid1, uid2); uint16_t p1 = 0; p1 |= DemodBuffer[32 + 3] << 8; @@ -246,8 +240,7 @@ static int CmdIndalaDemod(const char *Cmd) { checksum |= DemodBuffer[62] << 1; // b2 checksum |= DemodBuffer[63] << 0; // b1 - PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(SUCCESS, "Fmt 26 bit FC " _YELLOW_("%u") ", CN " _YELLOW_("%u") ", checksum " _YELLOW_("%1d%1d") + PrintAndLogEx(SUCCESS, "Fmt " _GREEN_("26") " FC: " _GREEN_("%u") " Card: " _GREEN_("%u") " checksum: " _GREEN_("%1d%1d") , fc , csn , checksum >> 1 & 0x01 @@ -267,7 +260,7 @@ static int CmdIndalaDemod(const char *Cmd) { uint32_t uid7 = bytebits_to_byte(DemodBuffer + 192, 32); PrintAndLogEx( SUCCESS - , "Indala Found - bitlength %zu, Raw 0x%x%08x%08x%08x%08x%08x%08x" + , "Indala - len %zu, Raw: 0x%x%08x%08x%08x%08x%08x%08x" , DemodBufferLen , uid1 , uid2 @@ -564,10 +557,10 @@ static int CmdIndalaClone(const char *Cmd) { CLIParserInit(&ctx, "lf indala clone", "clone INDALA tag to T55x7 (or to q5/T5555)", "Examples:\n" - "\tlf indala clone --heden 888\n" - "\tlf indala clone --fc 123 --cn 1337\n" - "\tlf indala clone -r a0000000a0002021\n" - "\tlf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5"); + _YELLOW_("\tlf indala clone --heden 888\n") + _YELLOW_("\tlf indala clone --fc 123 --cn 1337\n") + _YELLOW_("\tlf indala clone -r a0000000a0002021\n") + _YELLOW_("\tlf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5")); void *argtable[] = { arg_param_begin, diff --git a/client/src/cmdlfio.c b/client/src/cmdlfio.c index 5502786b6..10a4b5419 100644 --- a/client/src/cmdlfio.c +++ b/client/src/cmdlfio.c @@ -175,7 +175,7 @@ static int CmdIOProxDemod(const char *Cmd) { retval = PM3_ESOFT; } - PrintAndLogEx(SUCCESS, "IO Prox XSF(%02d)%02x:%05d (%08x%08x) %s", version, facilitycode, number, code, code2, crc_str); + PrintAndLogEx(SUCCESS, "IO Prox - " _GREEN_("XSF(%02d)%02x:%05d") ", Raw: %08x%08x %s", version, facilitycode, number, code, code2, crc_str); if (g_debugMode) { if (crc != calccrc) diff --git a/client/src/cmdlfjablotron.c b/client/src/cmdlfjablotron.c index 3d586215e..5d09fe066 100644 --- a/client/src/cmdlfjablotron.c +++ b/client/src/cmdlfjablotron.c @@ -38,7 +38,7 @@ static int usage_lf_jablotron_clone(void) { PrintAndLogEx(NORMAL, " : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf jablotron clone 112233"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf jablotron clone 112233")); return PM3_SUCCESS; } @@ -52,7 +52,7 @@ static int usage_lf_jablotron_sim(void) { PrintAndLogEx(NORMAL, " : jablotron card ID"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf jablotron sim 112233"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf jablotron sim 112233")); return PM3_SUCCESS; } @@ -115,20 +115,16 @@ static int CmdJablotronDemod(const char *Cmd) { uint64_t rawid = ((uint64_t)(bytebits_to_byte(DemodBuffer + 16, 8) & 0xff) << 32) | bytebits_to_byte(DemodBuffer + 24, 32); uint64_t id = getJablontronCardId(rawid); - PrintAndLogEx(SUCCESS, "Jablotron Tag Found: Card ID: %"PRIx64" :: Raw: %08X%08X", id, raw1, raw2); + PrintAndLogEx(SUCCESS, "Jablotron - Card: " _GREEN_("%"PRIx64) ", Raw: %08X%08X", id, raw1, raw2); uint8_t chksum = raw2 & 0xFF; bool isok = (chksum == jablontron_chksum(DemodBuffer)); - PrintAndLogEx(isok ? SUCCESS : INFO, - "Checksum: %02X [%s]", - chksum, - isok ? _GREEN_("OK") : _RED_("Fail") - ); + PrintAndLogEx(DEBUG, "Checksum: %02X (%s)", chksum, isok ? _GREEN_("ok") : _RED_("Fail")); id = DEC2BCD(id); // Printed format: 1410-nn-nnnn-nnnn - PrintAndLogEx(SUCCESS, "Printed: 1410-%02X-%04X-%04X", + PrintAndLogEx(SUCCESS, "Printed: " _GREEN_("1410-%02X-%04X-%04X"), (uint8_t)(id >> 32) & 0xFF, (uint16_t)(id >> 16) & 0xFFFF, (uint16_t)id & 0xFFFF diff --git a/client/src/cmdlfkeri.c b/client/src/cmdlfkeri.c index a26278f1c..7f5a83693 100644 --- a/client/src/cmdlfkeri.c +++ b/client/src/cmdlfkeri.c @@ -41,9 +41,9 @@ static int usage_lf_keri_clone(void) { PrintAndLogEx(NORMAL, " : Card Number"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf keri clone 112233"); - PrintAndLogEx(NORMAL, " lf keri clone type ms fc 6 cn 12345"); - PrintAndLogEx(NORMAL, " lf keri clone t m f 6 c 12345"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf keri clone 112233")); + PrintAndLogEx(NORMAL, _YELLOW_(" lf keri clone type ms fc 6 cn 12345")); + PrintAndLogEx(NORMAL, _YELLOW_(" lf keri clone t m f 6 c 12345")); return PM3_SUCCESS; } @@ -58,7 +58,7 @@ static int usage_lf_keri_sim(void) { PrintAndLogEx(NORMAL, " : Keri Internal ID"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf keri sim 112233"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf keri sim 112233")); return PM3_SUCCESS; } @@ -129,7 +129,7 @@ static int CmdKeriMSScramble(KeriMSScramble_t Action, uint32_t *FC, uint32_t *ID // Bit 31 was fixed but not in check/parity bits *CardID |= 1UL << 31; - PrintAndLogEx(SUCCESS, "Scrambled MS : FC %d - CN %d to RAW : E0000000%08X", *FC, *ID, *CardID); + PrintAndLogEx(SUCCESS, "Scrambled MS - FC: " _GREEN_("%d") " Card: " _GREEN_("%d") ", Raw: E0000000%08X", *FC, *ID, *CardID); } return PM3_SUCCESS; } @@ -184,8 +184,7 @@ static int CmdKeriDemod(const char *Cmd) { Might be a hash of FC & CN to generate Internal ID */ - PrintAndLogEx(SUCCESS, "KERI Tag Found -- Internal ID: %u", ID); - PrintAndLogEx(SUCCESS, "Raw: %08X%08X", raw1, raw2); + PrintAndLogEx(SUCCESS, "KERI - Internal ID: " _GREEN_("%u") ", Raw: %08X%08X" , ID, raw1, raw2); /* Descramble Data. */ @@ -195,7 +194,7 @@ static int CmdKeriDemod(const char *Cmd) { // Just need to the low 32 bits without the 111 trailer CmdKeriMSScramble(Descramble, &fc, &cardid, &raw2); - PrintAndLogEx(SUCCESS, "Descrambled MS : FC %d - CN %d\n", fc, cardid); + PrintAndLogEx(SUCCESS, "Descrambled MS - FC: " _GREEN_("%d") " Card: " _GREEN_("%d"), fc, cardid); if (invert) { PrintAndLogEx(INFO, "Had to Invert - probably KERI"); diff --git a/client/src/cmdlfmotorola.c b/client/src/cmdlfmotorola.c index fc2156c1a..1af4f120c 100644 --- a/client/src/cmdlfmotorola.c +++ b/client/src/cmdlfmotorola.c @@ -113,10 +113,9 @@ static int CmdMotorolaDemod(const char *Cmd) { checksum |= DemodBuffer[62] << 1; // b2 checksum |= DemodBuffer[63] << 0; // b1 - PrintAndLogEx(SUCCESS, "Motorola Tag Found -- Raw: %08X%08X", raw1, raw2); - PrintAndLogEx(SUCCESS, "Fmt 26 bit FC %u , CSN %u , checksum %1d%1d", fc, csn, checksum >> 1 & 0x01, checksum & 0x01); - PrintAndLogEx(NORMAL, ""); - + + PrintAndLogEx(SUCCESS, "Motorola - len: " _GREEN_("26") " FC: " _GREEN_("%u") " Card: " _GREEN_("%u") ", Raw: %08X%08X", fc, csn, raw1, raw2); + PrintAndLogEx(DEBUG, "checksum: " _GREEN_("%1d%1d"), fc, csn, checksum >> 1 & 0x01, checksum & 0x01); return PM3_SUCCESS; } @@ -156,7 +155,7 @@ static int CmdMotorolaClone(const char *Cmd) { "defaults to 64.\n", "\n" "Samples:\n" - "\tlf motorola clone a0000000a0002021\n" + _YELLOW_("\tlf motorola clone a0000000a0002021") "\n" ); void *argtable[] = { diff --git a/client/src/cmdlfnedap.c b/client/src/cmdlfnedap.c index c748a262a..da4354a49 100644 --- a/client/src/cmdlfnedap.c +++ b/client/src/cmdlfnedap.c @@ -41,7 +41,7 @@ static int usage_lf_nedap_gen(void) { PrintAndLogEx(NORMAL, " l : optional - long (128), default to short (64)"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf nedap generate s 1 c 123 i 12345"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf nedap generate s 1 c 123 i 12345")); return PM3_SUCCESS; } @@ -58,7 +58,7 @@ static int usage_lf_nedap_clone(void) { // PrintAndLogEx(NORMAL, " Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf nedap clone s 1 c 123 i 12345"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf nedap clone s 1 c 123 i 12345")); return PM3_SUCCESS; } @@ -76,7 +76,7 @@ static int usage_lf_nedap_sim(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); // TODO proper example? - PrintAndLogEx(NORMAL, " lf nedap sim s 1 c 7 i 1337"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf nedap sim s 1 c 7 i 1337")); return PM3_SUCCESS; } @@ -172,7 +172,7 @@ static int CmdLFNedapDemod(const char *Cmd) { customerCode = ((data[1] & 0x01) << 11) | (data[2] << 3) | ((data[3] & 0xe0) >> 5); if (isValid == false) { - PrintAndLogEx(ERR, "Checksum : %s (calc 0x%04X != 0x%04X)", _RED_("failed"), checksum, checksum2); + PrintAndLogEx(ERR, "Checksum : %s (calc 0x%04X != 0x%04X)", _RED_("fail"), checksum, checksum2); ret = PM3_ESOFT; } @@ -192,8 +192,8 @@ static int CmdLFNedapDemod(const char *Cmd) { badgeId = r1 * 10000 + r2 * 1000 + r3 * 100 + r4 * 10 + r5; - PrintAndLogEx(SUCCESS, "NEDAP Tag Found: Card ID "_YELLOW_("%05u")" subtype: "_YELLOW_("%1u")" customer code: "_YELLOW_("%03x"), badgeId, subtype, customerCode); - PrintAndLogEx(SUCCESS, "Checksum is %s (0x%04X)", _GREEN_("OK"), checksum); + PrintAndLogEx(SUCCESS, "NEDAP - Card: " _YELLOW_("%05u") " subtype: " _YELLOW_("%1u")" customer code: " _YELLOW_("%03x"), badgeId, subtype, customerCode); + PrintAndLogEx(SUCCESS, "Checksum (%s) 0x%04X", _GREEN_("ok"), checksum); PrintAndLogEx(SUCCESS, "Raw: %s", sprint_hex(data, size / 8)); } else { PrintAndLogEx(ERR, "Invalid idx (1:%02x - 2:%02x - 3:%02x - 4:%02x - 5:%02x)", idxC1, idxC2, idxC3, idxC4, idxC5); @@ -239,7 +239,7 @@ static int CmdLFNedapDemod(const char *Cmd) { if (!r0 && (r1 < 10) && (r2 < 10) && (r3 < 10) && (r4 < 10) && (r5 < 10)) { badgeId = r1 * 10000 + r2 * 1000 + r3 * 100 + r4 * 10 + r5; - PrintAndLogEx(SUCCESS, "Second Card Id " _YELLOW_("%05u"), badgeId); + PrintAndLogEx(SUCCESS, "Second Card: " _YELLOW_("%05u"), badgeId); if ((fixed0 == FIXED_71) && (fixed1 == FIXED_40)) PrintAndLogEx(DEBUG, "Fixed part {0 = 0x%02x, 1 = 0x%02x}", fixed0, fixed1); diff --git a/client/src/cmdlfnexwatch.c b/client/src/cmdlfnexwatch.c index fbf2d55eb..fda84b9b6 100644 --- a/client/src/cmdlfnexwatch.c +++ b/client/src/cmdlfnexwatch.c @@ -46,9 +46,9 @@ static int usage_lf_nexwatch_clone(void) { PrintAndLogEx(NORMAL, " q : Quadrakey credential"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf nexwatch clone r 5600000000213C9F8F150C"); - PrintAndLogEx(NORMAL, " lf nexwatch clone c 521512301 m 1 n -- Nexkey credential"); - PrintAndLogEx(NORMAL, " lf nexwatch clone c 521512301 m 1 q -- Quadrakey credential"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf nexwatch clone r 5600000000213C9F8F150C")); + PrintAndLogEx(NORMAL, _YELLOW_(" lf nexwatch clone c 521512301 m 1 n") " -- Nexkey credential"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf nexwatch clone c 521512301 m 1 q") " -- Quadrakey credential"); return PM3_SUCCESS; } @@ -68,9 +68,9 @@ static int usage_lf_nexwatch_sim(void) { PrintAndLogEx(NORMAL, " q : Quadrakey credential"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf nexwatch sim r 5600000000213C9F8F150C"); - PrintAndLogEx(NORMAL, " lf nexwatch sim c 521512301 m 1 n -- Nexkey credential"); - PrintAndLogEx(NORMAL, " lf nexwatch sim c 521512301 m 1 q -- Quadrakey credential"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf nexwatch sim r 5600000000213C9F8F150C")); + PrintAndLogEx(NORMAL, _YELLOW_(" lf nexwatch sim c 521512301 m 1 n") " -- Nexkey credential"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf nexwatch sim c 521512301 m 1 q") " -- Quadrakey credential"); return PM3_SUCCESS; } diff --git a/client/src/cmdlfnoralsy.c b/client/src/cmdlfnoralsy.c index a0ab69e3f..553450f12 100644 --- a/client/src/cmdlfnoralsy.c +++ b/client/src/cmdlfnoralsy.c @@ -35,7 +35,7 @@ static int usage_lf_noralsy_clone(void) { PrintAndLogEx(NORMAL, " : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf noralsy clone 112233"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf noralsy clone 112233")); return PM3_SUCCESS; } @@ -50,7 +50,7 @@ static int usage_lf_noralsy_sim(void) { PrintAndLogEx(NORMAL, " : Tag allocation year"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf noralsy sim 112233"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf noralsy sim 112233")); return PM3_SUCCESS; } @@ -124,7 +124,7 @@ static int CmdNoralsyDemod(const char *Cmd) { return PM3_ESOFT; } - PrintAndLogEx(SUCCESS, "Noralsy Tag Found: Card ID %u, Year: %u Raw: %08X%08X%08X", cardid, year, raw1, raw2, raw3); + PrintAndLogEx(SUCCESS, "Noralsy - Card: " _GREEN_("%u")", Year: " _GREEN_("%u") ", Raw: %08X%08X%08X", cardid, year, raw1, raw2, raw3); if (raw1 != 0xBB0214FF) { PrintAndLogEx(WARNING, "Unknown bits set in first block! Expected 0xBB0214FF, Found: 0x%08X", raw1); PrintAndLogEx(WARNING, "Please post this output in forum to further research on this format"); diff --git a/client/src/cmdlfpac.c b/client/src/cmdlfpac.c index a8e0401af..10365358e 100644 --- a/client/src/cmdlfpac.c +++ b/client/src/cmdlfpac.c @@ -37,8 +37,8 @@ static int usage_lf_pac_clone(void) { PrintAndLogEx(NORMAL, " b : raw hex data. 16 bytes max"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf pac clone c CD4F5552 "); - PrintAndLogEx(NORMAL, " lf pac clone b FF2049906D8511C593155B56D5B2649F "); + PrintAndLogEx(NORMAL, _YELLOW_(" lf pac clone c CD4F5552 ")); + PrintAndLogEx(NORMAL, _YELLOW_(" lf pac clone b FF2049906D8511C593155B56D5B2649F ")); return PM3_SUCCESS; } static int usage_lf_pac_sim(void) { @@ -51,7 +51,7 @@ static int usage_lf_pac_sim(void) { PrintAndLogEx(NORMAL, " : 8 byte PAC/Stanley card id"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf pac sim 12345678"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf pac sim 12345678")); return PM3_SUCCESS; } // by danshuk @@ -176,7 +176,7 @@ static int CmdPacDemod(const char *Cmd) { int retval = demodbuf_to_pacid(DemodBuffer, DemodBufferLen, cardid, sizeof(cardid)); if (retval == PM3_SUCCESS) - PrintAndLogEx(SUCCESS, "PAC/Stanley Tag Found -- Card ID: %s, Raw: %08X%08X%08X%08X", cardid, raw1, raw2, raw3, raw4); + PrintAndLogEx(SUCCESS, "PAC/Stanley - Card: " _GREEN_("%s") ", Raw: %08X%08X%08X%08X", cardid, raw1, raw2, raw3, raw4); return retval; } diff --git a/client/src/cmdlfparadox.c b/client/src/cmdlfparadox.c index 662ea781c..92cea3755 100644 --- a/client/src/cmdlfparadox.c +++ b/client/src/cmdlfparadox.c @@ -184,7 +184,7 @@ int demodParadox(void) { uint32_t rawHi = bytebits_to_byte(bits + idx + 32, 32); uint32_t rawHi2 = bytebits_to_byte(bits + idx, 32); - PrintAndLogEx(INFO, "Paradox TAG ID: " _GREEN_("%x%08x") " - FC: " _GREEN_("%d") ", CN: " _GREEN_("%d") " - Checksum: %02x - RAW: %08x%08x%08x", + PrintAndLogEx(INFO, "Paradox - ID: " _GREEN_("%x%08x") " FC: " _GREEN_("%d") " Card: " _GREEN_("%d") ", Checksum: %02x, Raw: %08x%08x%08x", hi >> 10, (hi & 0x3) << 26 | (lo >> 10), fc, diff --git a/client/src/cmdlfpresco.c b/client/src/cmdlfpresco.c index d7024633d..c9eb2ce29 100644 --- a/client/src/cmdlfpresco.c +++ b/client/src/cmdlfpresco.c @@ -36,7 +36,7 @@ static int usage_lf_presco_clone(void) { PrintAndLogEx(NORMAL, " : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf presco clone d 123456789"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf presco clone d 123456789")); return PM3_SUCCESS; } @@ -52,7 +52,7 @@ static int usage_lf_presco_sim(void) { PrintAndLogEx(NORMAL, " c : 8 digit hex card number"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf presco sim d 123456789"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf presco sim d 123456789")); return PM3_SUCCESS; } @@ -86,14 +86,14 @@ static int CmdPrescoDemod(const char *Cmd) { uint32_t raw3 = bytebits_to_byte(DemodBuffer + 64, 32); uint32_t raw4 = bytebits_to_byte(DemodBuffer + 96, 32); uint32_t cardid = raw4; - PrintAndLogEx(SUCCESS, "Presco Tag Found: Card ID %08X, Raw: %08X%08X%08X%08X", cardid, raw1, raw2, raw3, raw4); + PrintAndLogEx(SUCCESS, "Presco - Card: " _GREEN_("%08X") ", Raw: %08X%08X%08X%08X", cardid, raw1, raw2, raw3, raw4); uint32_t sitecode = 0, usercode = 0, fullcode = 0; bool Q5 = false; char cmd[12] = {0}; sprintf(cmd, "H %08X", cardid); getWiegandFromPresco(cmd, &sitecode, &usercode, &fullcode, &Q5); - PrintAndLogEx(SUCCESS, "SiteCode %u, UserCode %u, FullCode, %08X", sitecode, usercode, fullcode); + PrintAndLogEx(SUCCESS, "SiteCode: " _GREEN_("%u") " UserCode: " _GREEN_("%u") " FullCode: " _GREEN_("%08X"), sitecode, usercode, fullcode); return PM3_SUCCESS; } diff --git a/client/src/cmdlfpyramid.c b/client/src/cmdlfpyramid.c index 65004f897..71fe1ab7e 100644 --- a/client/src/cmdlfpyramid.c +++ b/client/src/cmdlfpyramid.c @@ -181,12 +181,12 @@ int demodPyramid(void) { uint32_t fc = bytebits_to_byte(bits + 73, 8); uint32_t cardnum = bytebits_to_byte(bits + 81, 16); uint32_t code1 = bytebits_to_byte(bits + 72, fmtLen); - PrintAndLogEx(SUCCESS, "Pyramid ID Found - BitLength: %d, FC: " _GREEN_("%d") " Card: " _GREEN_("%d") " - Wiegand: " _GREEN_("%x")", Raw: %08x%08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi3, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "Pyramid - len: " _GREEN_("%d") ", FC: " _GREEN_("%d") " Card: " _GREEN_("%d") " - Wiegand: " _GREEN_("%x")", Raw: %08x%08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi3, rawHi2, rawHi, rawLo); } else if (fmtLen == 45) { fmtLen = 42; //end = 10 bits not 7 like 26 bit fmt uint32_t fc = bytebits_to_byte(bits + 53, 10); uint32_t cardnum = bytebits_to_byte(bits + 63, 32); - PrintAndLogEx(SUCCESS, "Pyramid ID Found - BitLength: %d, FC: " _GREEN_("%d") " Card: " _GREEN_("%d") " - Raw: %08x%08x%08x%08x", fmtLen, fc, cardnum, rawHi3, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "Pyramid - len: " _GREEN_("%d") ", FC: " _GREEN_("%d") " Card: " _GREEN_("%d") ", Raw: %08x%08x%08x%08x", fmtLen, fc, cardnum, rawHi3, rawHi2, rawHi, rawLo); /* } else if (fmtLen > 32) { uint32_t cardnum = bytebits_to_byte(bits + 81, 16); @@ -197,7 +197,7 @@ int demodPyramid(void) { } else { uint32_t cardnum = bytebits_to_byte(bits + 81, 16); //uint32_t code1 = bytebits_to_byte(bits+(size-fmtLen),fmtLen); - PrintAndLogEx(SUCCESS, "Pyramid ID Found - BitLength: %d -unknown BitLength- Card: " _GREEN_("%d") ", Raw: %08x%08x%08x%08x", fmtLen, cardnum, rawHi3, rawHi2, rawHi, rawLo); + PrintAndLogEx(SUCCESS, "Pyramid - len: " _GREEN_("%d") " -unknown- Card: " _GREEN_("%d") ", Raw: %08x%08x%08x%08x", fmtLen, cardnum, rawHi3, rawHi2, rawHi, rawLo); } PrintAndLogEx(DEBUG, "DEBUG: Pyramid: checksum : 0x%02X - %02X - %s" diff --git a/client/src/cmdlfsecurakey.c b/client/src/cmdlfsecurakey.c index 3fd689360..ea188ec3b 100644 --- a/client/src/cmdlfsecurakey.c +++ b/client/src/cmdlfsecurakey.c @@ -118,9 +118,9 @@ int demodSecurakey(void) { // test parities - evenparity32 looks to add an even parity returns 0 if already even... bool parity = !evenparity32(lWiegand) && !oddparity32(rWiegand); - PrintAndLogEx(SUCCESS, "Securakey Tag Found--BitLen: " _GREEN_("%u") ", Card ID: " _GREEN_("%u") ", FC: " _GREEN_("0x%X")" Raw: %08X%08X%08X", bitLen, cardid, fc, raw1, raw2, raw3); + PrintAndLogEx(SUCCESS, "Securakey - len: " _GREEN_("%u") " FC: " _GREEN_("0x%X")" Card: " _GREEN_("%u") ", Raw: %08X%08X%08X", bitLen, fc, cardid, raw1, raw2, raw3); if (bitLen <= 32) - PrintAndLogEx(SUCCESS, "Wiegand: " _GREEN_("%08X") ", Parity: %s", (lWiegand << (bitLen / 2)) | rWiegand, parity ? _GREEN_("ok") : _RED_("fail")); + PrintAndLogEx(SUCCESS, "Wiegand: " _GREEN_("%08X") " parity (%s)", (lWiegand << (bitLen / 2)) | rWiegand, parity ? _GREEN_("ok") : _RED_("fail")); PrintAndLogEx(INFO, "\nHow the FC translates to printed FC is unknown"); PrintAndLogEx(INFO, "How the checksum is calculated is unknown"); diff --git a/client/src/cmdlfverichip.c b/client/src/cmdlfverichip.c index c3201e1f6..0eec31bf1 100644 --- a/client/src/cmdlfverichip.c +++ b/client/src/cmdlfverichip.c @@ -33,7 +33,7 @@ static int usage_lf_verichip_clone(void) { PrintAndLogEx(NORMAL, " b : raw hex data. 12 bytes max"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf verichip clone b FF2049906D8511C593155B56D5B2649F "); + PrintAndLogEx(NORMAL, _YELLOW_(" lf verichip clone b FF2049906D8511C593155B56D5B2649F ")); return PM3_SUCCESS; } @@ -72,7 +72,7 @@ static int CmdVerichipDemod(const char *Cmd) { // 11111111001000000 10 01001100 10 00001101 10 00001101 10 00001101 10 00001101 10 00001101 10 00001101 10 00001101 10 00001101 10 10001100 10 100000001 // unknown checksum 9 bits at the end - PrintAndLogEx(SUCCESS, "VERICHIP Tag Found -- Raw: %08X%08X%08X%08X", raw1, raw2, raw3, raw4); + PrintAndLogEx(SUCCESS, "VERICHIP - Raw: %08X%08X%08X%08X", raw1, raw2, raw3, raw4); PrintAndLogEx(INFO, "How the Raw ID is translated by the reader is unknown. Share your trace file on forum"); return PM3_SUCCESS; } diff --git a/client/src/cmdlfviking.c b/client/src/cmdlfviking.c index dccdb16c5..07d80af86 100644 --- a/client/src/cmdlfviking.c +++ b/client/src/cmdlfviking.c @@ -34,7 +34,7 @@ static int usage_lf_viking_clone(void) { PrintAndLogEx(NORMAL, " : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf viking clone 1A337 Q5"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf viking clone 1A337 Q5")); return PM3_SUCCESS; } @@ -48,7 +48,7 @@ static int usage_lf_viking_sim(void) { PrintAndLogEx(NORMAL, " : 8 digit hex viking card number"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " lf viking sim 1A337"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf viking sim 1A337")); return PM3_SUCCESS; } @@ -76,8 +76,8 @@ int demodViking(void) { uint32_t raw2 = bytebits_to_byte(DemodBuffer + ans + 32, 32); uint32_t cardid = bytebits_to_byte(DemodBuffer + ans + 24, 32); uint8_t checksum = bytebits_to_byte(DemodBuffer + ans + 32 + 24, 8); - PrintAndLogEx(SUCCESS, "Viking Tag Found: Card ID " _YELLOW_("%08X")" checksum "_YELLOW_("%02X"), cardid, checksum); - PrintAndLogEx(SUCCESS, "Raw hex: %08X%08X", raw1, raw2); + PrintAndLogEx(SUCCESS, "Viking - Card " _GREEN_("%08X") ", Raw: %08X%08X", cardid, raw1, raw2); + PrintAndLogEx(DEBUG, "Checksum: %02X", checksum); setDemodBuff(DemodBuffer, 64, ans); setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock)); return PM3_SUCCESS; @@ -139,7 +139,7 @@ static int CmdVikingSim(const char *Cmd) { rawID = getVikingBits(id); - PrintAndLogEx(SUCCESS, "Simulating Viking - ID " _YELLOW_("%08X")" raw "_YELLOW_("%08X%08X"), id, (uint32_t)(rawID >> 32), (uint32_t)(rawID & 0xFFFFFFFF)); + PrintAndLogEx(SUCCESS, "Simulating Viking - ID " _YELLOW_("%08X") " raw " _YELLOW_("%08X%08X"), id, (uint32_t)(rawID >> 32), (uint32_t)(rawID & 0xFFFFFFFF)); uint8_t bs[64]; num_to_bytebits(rawID, sizeof(bs), bs); diff --git a/client/src/cmdlfvisa2000.c b/client/src/cmdlfvisa2000.c index 91ad70490..4260fe6d4 100644 --- a/client/src/cmdlfvisa2000.c +++ b/client/src/cmdlfvisa2000.c @@ -143,7 +143,7 @@ int demodVisa2k(void) { // test checksums if (chk != calc) { - PrintAndLogEx(DEBUG, "DEBUG: error: Visa2000 checksum failed %x - %x\n", chk, calc); + PrintAndLogEx(DEBUG, "DEBUG: error: Visa2000 checksum (%s) %x - %x\n", _RED_("fail"), chk, calc); save_restoreGB(GRAPH_RESTORE); return PM3_ESOFT; } @@ -151,11 +151,11 @@ int demodVisa2k(void) { uint8_t calc_par = visa_parity(raw2); uint8_t chk_par = (raw3 & 0xFF0) >> 4; if (calc_par != chk_par) { - PrintAndLogEx(DEBUG, "DEBUG: error: Visa2000 parity failed %x - %x\n", chk_par, calc_par); + PrintAndLogEx(DEBUG, "DEBUG: error: Visa2000 parity (%s) %x - %x\n", _RED_("fail"), chk_par, calc_par); save_restoreGB(GRAPH_RESTORE); return PM3_ESOFT; } - PrintAndLogEx(SUCCESS, "Visa2000 Tag Found: Card ID " _GREEN_("%u") " Raw: %08X%08X%08X", raw2, raw1, raw2, raw3); + PrintAndLogEx(SUCCESS, "Visa2000 - Card " _GREEN_("%u") ", Raw: %08X%08X%08X", raw2, raw1, raw2, raw3); return PM3_SUCCESS; } From ba8f60298a14cec105b9d54a7826487b52d058e2 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 13:17:41 +0200 Subject: [PATCH 20/35] text --- client/src/cmdlf.c | 3 ++- client/src/cmdlffdx.c | 4 +++- client/src/cmdlfhid.c | 4 ++++ client/src/cmdlfindala.c | 6 ++++-- client/src/cmdlfio.c | 3 +++ 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/client/src/cmdlf.c b/client/src/cmdlf.c index ace50f2d7..0d3703808 100644 --- a/client/src/cmdlf.c +++ b/client/src/cmdlf.c @@ -1274,6 +1274,7 @@ int CmdLFfind(const char *Cmd) { if (demodHID() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("HID Prox ID") " found!"); goto out;} if (demodAWID() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("AWID ID") " found!"); goto out;} + if (demodIOProx() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("IO Prox ID") " found!"); goto out;} if (demodParadox() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Paradox ID") " found!"); goto out;} if (demodEM410x() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("EM410x ID") " found!"); goto out;} @@ -1281,7 +1282,7 @@ int CmdLFfind(const char *Cmd) { if (demodGuard() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Guardall G-Prox II ID") " found!"); goto out; } if (demodIdteck() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Idteck ID") " found!"); goto out;} if (demodIndala() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Indala ID") " found!"); goto out;} - if (demodIOProx() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("IO Prox ID") " found!"); goto out;} + if (demodJablotron() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Jablotron ID") " found!"); goto out;} if (demodNedap() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NEDAP ID") " found!"); goto out;} if (demodNexWatch() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NexWatch ID") " found!"); goto out;} diff --git a/client/src/cmdlffdx.c b/client/src/cmdlffdx.c index 98f93baed..28d3ff12c 100644 --- a/client/src/cmdlffdx.c +++ b/client/src/cmdlffdx.c @@ -247,7 +247,7 @@ int demodFDX(void) { uint8_t raw[8]; num_to_bytes(rawid, 8, raw); - PrintAndLogEx(SUCCESS, "\nFDX-B / ISO 11784/5 Animal Tag ID Found: Raw : %s", sprint_hex(raw, 8)); + PrintAndLogEx(SUCCESS, "FDX-B / ISO 11784/5 Animal"); PrintAndLogEx(SUCCESS, "Animal ID " _GREEN_("%04u-%012"PRIu64), countryCode, NationalCode); PrintAndLogEx(SUCCESS, "National Code " _GREEN_("%012" PRIu64) " (0x%" PRIx64 ")", NationalCode, NationalCode); PrintAndLogEx(SUCCESS, "Country Code %04u", countryCode); @@ -259,6 +259,8 @@ int demodFDX(void) { compute_crc(CRC_11784, raw, sizeof(raw), &c[0], &c[1]); PrintAndLogEx(SUCCESS, "CRC-16 0x%04X (%s) ", crc, (crc == (c[1] << 8 | c[0])) ? _GREEN_("ok") : _RED_("fail")); + PrintAndLogEx(SUCCESS, "Raw " _GREEN_("%s"), sprint_hex(raw, 8)); + if (g_debugMode) { PrintAndLogEx(DEBUG, "Start marker %d; Size %zu", preambleIndex, size); char *bin = sprint_bin_break(DemodBuffer, size, 16); diff --git a/client/src/cmdlfhid.c b/client/src/cmdlfhid.c index 35a00ab11..be34148a6 100644 --- a/client/src/cmdlfhid.c +++ b/client/src/cmdlfhid.c @@ -51,6 +51,7 @@ static int usage_lf_hid_watch(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf hid watch")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } static int usage_lf_hid_sim(void) { @@ -63,6 +64,7 @@ static int usage_lf_hid_sim(void) { PrintAndLogEx(NORMAL, " ID - HID id"); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf hid sim 2006ec0c86")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } static int usage_lf_hid_clone(void) { @@ -76,6 +78,7 @@ static int usage_lf_hid_clone(void) { PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf hid clone 2006ec0c86")); PrintAndLogEx(NORMAL, _YELLOW_(" lf hid clone l 2006ec0c86")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } static int usage_lf_hid_brute(void) { @@ -100,6 +103,7 @@ static int usage_lf_hid_brute(void) { PrintAndLogEx(NORMAL, _YELLOW_(" lf hid brute w H10301 f 224")); PrintAndLogEx(NORMAL, _YELLOW_(" lf hid brute w H10301 f 21 d 2000")); PrintAndLogEx(NORMAL, _YELLOW_(" lf hid brute v w H10301 f 21 c 200 d 2000")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } diff --git a/client/src/cmdlfindala.c b/client/src/cmdlfindala.c index 919c914b2..421c3001a 100644 --- a/client/src/cmdlfindala.c +++ b/client/src/cmdlfindala.c @@ -52,8 +52,9 @@ static int usage_lf_indala_demod(void) { PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf indala demod")); PrintAndLogEx(NORMAL, _YELLOW_(" lf indala demod 32") " = demod a Indala tag from GraphBuffer using a clock of RF/32"); - PrintAndLogEx(NORMAL, _YELLOW_(" lf indala demod 32 1") " = demod a Indala tag from GraphBuffer using a clock of RF/32 and inverting data"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf indala demod 32 1") " = demod a Indala tag from GraphBuffer using a clock of RF/32 and inverting data"); PrintAndLogEx(NORMAL, _YELLOW_(" lf indala demod 64 1 0") " = demod a Indala tag from GraphBuffer using a clock of RF/64, inverting data and allowing 0 demod errors"); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -69,6 +70,7 @@ static int usage_lf_indala_sim(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf indala sim deadc0de")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -260,7 +262,7 @@ static int CmdIndalaDemod(const char *Cmd) { uint32_t uid7 = bytebits_to_byte(DemodBuffer + 192, 32); PrintAndLogEx( SUCCESS - , "Indala - len %zu, Raw: 0x%x%08x%08x%08x%08x%08x%08x" + , "Indala - len %zu, Raw: %x%08x%08x%08x%08x%08x%08x" , DemodBufferLen , uid1 , uid2 diff --git a/client/src/cmdlfio.c b/client/src/cmdlfio.c index 10a4b5419..e9a0b25ae 100644 --- a/client/src/cmdlfio.c +++ b/client/src/cmdlfio.c @@ -37,6 +37,7 @@ static int usage_lf_io_watch(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf io watch")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -53,6 +54,7 @@ static int usage_lf_io_sim(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf io sim 01 101 1337")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -70,6 +72,7 @@ static int usage_lf_io_clone(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf io clone 01 101 1337")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } From c65c683d065f647b6386e123d02978a75d65f462 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 13:21:32 +0200 Subject: [PATCH 21/35] text --- client/src/cmdlfjablotron.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/src/cmdlfjablotron.c b/client/src/cmdlfjablotron.c index 5d09fe066..464b6e282 100644 --- a/client/src/cmdlfjablotron.c +++ b/client/src/cmdlfjablotron.c @@ -39,6 +39,7 @@ static int usage_lf_jablotron_clone(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf jablotron clone 112233")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -53,6 +54,7 @@ static int usage_lf_jablotron_sim(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf jablotron sim 112233")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -79,7 +81,10 @@ static uint64_t getJablontronCardId(uint64_t rawcode) { //see ASKDemod for what args are accepted static int CmdJablotronDemod(const char *Cmd) { (void)Cmd; // Cmd is not used so far + return demodJablotron(); +} +int demodJablotron(void) { //Differential Biphase / di-phase (inverted biphase) //get binary from ask wave if (ASKbiphaseDemod("0 64 1 0", false) != PM3_SUCCESS) { @@ -133,8 +138,8 @@ static int CmdJablotronDemod(const char *Cmd) { } static int CmdJablotronRead(const char *Cmd) { - lf_read(true, 10000); - return CmdJablotronDemod(Cmd); + lf_read(false, 16000); + return demodJablotron(); } static int CmdJablotronClone(const char *Cmd) { @@ -276,6 +281,3 @@ int detectJablotron(uint8_t *bits, size_t *size) { return (int)startIdx; } -int demodJablotron(void) { - return CmdJablotronDemod(""); -} From 42415e41ab7f26a703143d150f43199ca078f8ef Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 13:23:37 +0200 Subject: [PATCH 22/35] text --- client/src/cmdlfkeri.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/cmdlfkeri.c b/client/src/cmdlfkeri.c index 7f5a83693..b1a73cc9d 100644 --- a/client/src/cmdlfkeri.c +++ b/client/src/cmdlfkeri.c @@ -44,7 +44,7 @@ static int usage_lf_keri_clone(void) { PrintAndLogEx(NORMAL, _YELLOW_(" lf keri clone 112233")); PrintAndLogEx(NORMAL, _YELLOW_(" lf keri clone type ms fc 6 cn 12345")); PrintAndLogEx(NORMAL, _YELLOW_(" lf keri clone t m f 6 c 12345")); - + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -59,6 +59,7 @@ static int usage_lf_keri_sim(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf keri sim 112233")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } From f330f3925b1fd6627fd150127fffc5b9614740b6 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 18:33:56 +0200 Subject: [PATCH 23/35] text --- client/src/cmdlf.c | 6 +++--- client/src/cmdlfjablotron.c | 2 +- client/src/cmdlfmotorola.c | 11 ++++++----- client/src/cmdlfnedap.c | 9 ++++++--- client/src/cmdlfnexwatch.c | 20 +++++++++----------- client/src/cmdlfviking.c | 1 + 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/client/src/cmdlf.c b/client/src/cmdlf.c index 0d3703808..748c9557a 100644 --- a/client/src/cmdlf.c +++ b/client/src/cmdlf.c @@ -1276,16 +1276,16 @@ int CmdLFfind(const char *Cmd) { if (demodAWID() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("AWID ID") " found!"); goto out;} if (demodIOProx() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("IO Prox ID") " found!"); goto out;} if (demodParadox() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Paradox ID") " found!"); goto out;} - + if (demodNexWatch() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NexWatch ID") " found!"); goto out;} + if (demodIndala() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Indala ID") " found!"); goto out;} + if (demodEM410x() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("EM410x ID") " found!"); goto out;} if (demodFDX() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("FDX-B ID") " found!"); goto out;} if (demodGuard() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Guardall G-Prox II ID") " found!"); goto out; } if (demodIdteck() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Idteck ID") " found!"); goto out;} - if (demodIndala() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Indala ID") " found!"); goto out;} if (demodJablotron() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Jablotron ID") " found!"); goto out;} if (demodNedap() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NEDAP ID") " found!"); goto out;} - if (demodNexWatch() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NexWatch ID") " found!"); goto out;} if (demodNoralsy() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Noralsy ID") " found!"); goto out;} if (demodKeri() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("KERI ID") " found!"); goto out;} if (demodPac() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("PAC/Stanley ID") " found!"); goto out;} diff --git a/client/src/cmdlfjablotron.c b/client/src/cmdlfjablotron.c index 464b6e282..a2859fbb4 100644 --- a/client/src/cmdlfjablotron.c +++ b/client/src/cmdlfjablotron.c @@ -120,7 +120,7 @@ int demodJablotron(void) { uint64_t rawid = ((uint64_t)(bytebits_to_byte(DemodBuffer + 16, 8) & 0xff) << 32) | bytebits_to_byte(DemodBuffer + 24, 32); uint64_t id = getJablontronCardId(rawid); - PrintAndLogEx(SUCCESS, "Jablotron - Card: " _GREEN_("%"PRIx64) ", Raw: %08X%08X", id, raw1, raw2); + PrintAndLogEx(SUCCESS, "Jablotron - Card: " _GREEN_("%"PRIx64) ", Raw: %08X%08X", id, raw1, raw2); uint8_t chksum = raw2 & 0xFF; bool isok = (chksum == jablontron_chksum(DemodBuffer)); diff --git a/client/src/cmdlfmotorola.c b/client/src/cmdlfmotorola.c index 1af4f120c..36777be02 100644 --- a/client/src/cmdlfmotorola.c +++ b/client/src/cmdlfmotorola.c @@ -30,7 +30,12 @@ static int CmdHelp(const char *Cmd); //see PSKDemod for what args are accepted static int CmdMotorolaDemod(const char *Cmd) { + (void)Cmd; + return demodMotorola(); +} +int demodMotorola(void) { + //PSK1 if (PSKDemod("32 1", true) != PM3_SUCCESS) { PrintAndLogEx(DEBUG, "DEBUG: Error - Motorola: PSK Demod failed"); @@ -140,7 +145,7 @@ static int CmdMotorolaRead(const char *Cmd) { sc.divisor = LF_DIVISOR_125; sc.samples_to_skip = 0; lf_config(&sc); - return CmdMotorolaDemod(Cmd); + return demodMotorola(); } static int CmdMotorolaClone(const char *Cmd) { @@ -252,10 +257,6 @@ int detectMotorola(uint8_t *dest, size_t *size) { return (int)start_idx; } -int demodMotorola(void) { - return CmdMotorolaDemod(""); -} - int readMotorolaUid(void) { return (CmdMotorolaRead("") == PM3_SUCCESS); } diff --git a/client/src/cmdlfnedap.c b/client/src/cmdlfnedap.c index da4354a49..ddd734eb3 100644 --- a/client/src/cmdlfnedap.c +++ b/client/src/cmdlfnedap.c @@ -42,6 +42,7 @@ static int usage_lf_nedap_gen(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf nedap generate s 1 c 123 i 12345")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -59,6 +60,7 @@ static int usage_lf_nedap_clone(void) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" lf nedap clone s 1 c 123 i 12345")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -77,6 +79,7 @@ static int usage_lf_nedap_sim(void) { PrintAndLogEx(NORMAL, "Examples:"); // TODO proper example? PrintAndLogEx(NORMAL, _YELLOW_(" lf nedap sim s 1 c 7 i 1337")); + PrintAndLogEx(NORMAL, ""); return PM3_SUCCESS; } @@ -192,9 +195,9 @@ static int CmdLFNedapDemod(const char *Cmd) { badgeId = r1 * 10000 + r2 * 1000 + r3 * 100 + r4 * 10 + r5; - PrintAndLogEx(SUCCESS, "NEDAP - Card: " _YELLOW_("%05u") " subtype: " _YELLOW_("%1u")" customer code: " _YELLOW_("%03x"), badgeId, subtype, customerCode); - PrintAndLogEx(SUCCESS, "Checksum (%s) 0x%04X", _GREEN_("ok"), checksum); - PrintAndLogEx(SUCCESS, "Raw: %s", sprint_hex(data, size / 8)); + PrintAndLogEx(SUCCESS, "NEDAP - Card: " _YELLOW_("%05u") " subtype: " _YELLOW_("%1u")" customer code: " _YELLOW_("%03x") ", Raw: %s", badgeId, subtype, customerCode, sprint_hex(data, size / 8)); + PrintAndLogEx(DEBUG, "Checksum (%s) 0x%04X", _GREEN_("ok"), checksum); + } else { PrintAndLogEx(ERR, "Invalid idx (1:%02x - 2:%02x - 3:%02x - 4:%02x - 5:%02x)", idxC1, idxC2, idxC3, idxC4, idxC5); ret = PM3_ESOFT; diff --git a/client/src/cmdlfnexwatch.c b/client/src/cmdlfnexwatch.c index fda84b9b6..11541b29c 100644 --- a/client/src/cmdlfnexwatch.c +++ b/client/src/cmdlfnexwatch.c @@ -244,18 +244,16 @@ int demodNexWatch(void) { } PrintAndLogEx(SUCCESS, " 88bit id : " _YELLOW_("%"PRIu32) " (" _YELLOW_("0x%"PRIx32)")", cn, cn); PrintAndLogEx(SUCCESS, " mode : %x", mode); - if (parity == calc_parity) { - PrintAndLogEx(SUCCESS, " parity : %s (0x%X)", _GREEN_("ok"), parity); - } else { - PrintAndLogEx(WARNING, " parity : %s (0x%X != 0x%X)", _RED_("fail"), parity, calc_parity); - } - if (m_idx < ARRAYLEN(items)) { - PrintAndLogEx(SUCCESS, " checksum : %s (0x%02X)", _GREEN_("ok"), chk); - } else { - PrintAndLogEx(WARNING, " checksum : %s (0x%02X)", _RED_("fail"), chk); - } - PrintAndLogEx(INFO, " raw : " _YELLOW_("%"PRIX32"%"PRIX32"%"PRIX32), raw1, raw2, raw3); + if (parity == calc_parity) { + PrintAndLogEx(DEBUG, " parity : %s (0x%X)", _GREEN_("ok"), parity); + } else { + PrintAndLogEx(DEBUG, " parity : %s (0x%X != 0x%X)", _RED_("fail"), parity, calc_parity); + } + + PrintAndLogEx(DEBUG, " checksum : %s (0x%02X)", (m_idx < ARRAYLEN(items)) ? _GREEN_("ok") : _RED_("fail"), chk); + + PrintAndLogEx(INFO, " Raw : " _YELLOW_("%"PRIX32"%"PRIX32"%"PRIX32), raw1, raw2, raw3); return PM3_SUCCESS; } diff --git a/client/src/cmdlfviking.c b/client/src/cmdlfviking.c index 07d80af86..445dbc209 100644 --- a/client/src/cmdlfviking.c +++ b/client/src/cmdlfviking.c @@ -34,6 +34,7 @@ static int usage_lf_viking_clone(void) { PrintAndLogEx(NORMAL, " : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); + PrintAndLogEx(NORMAL, _YELLOW_(" lf viking clone 1A337")); PrintAndLogEx(NORMAL, _YELLOW_(" lf viking clone 1A337 Q5")); return PM3_SUCCESS; } From 669bb1d5971e394248d95a39046f49372e97ad36 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 21:49:19 +0200 Subject: [PATCH 24/35] client/src/cmdhficlass.c --- client/src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/util.c b/client/src/util.c index 5e1e55d67..80def08ef 100644 --- a/client/src/util.c +++ b/client/src/util.c @@ -301,7 +301,7 @@ char *sprint_hex_ascii(const uint8_t *data, const size_t len) { memset(buf, 0x00, UTIL_BUFFER_SIZE_SPRINT); size_t max_len = (len > 1010) ? 1010 : len; - snprintf(tmp, UTIL_BUFFER_SIZE_SPRINT, "%s | ", sprint_hex(data, max_len)); + snprintf(tmp, UTIL_BUFFER_SIZE_SPRINT, "%s| ", sprint_hex(data, max_len)); size_t i = 0; size_t pos = (max_len * 3) + 2; From 71e30a8c4faf9d179cb8c95801f46718debf41d4 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 21:49:50 +0200 Subject: [PATCH 25/35] layout --- client/src/cmdhficlass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 98fd29562..3f7dd178d 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -1419,7 +1419,7 @@ static int CmdHFiClassReader_Dump(const char *Cmd) { // print the dump PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "------+--+-------------------------+----------"); - PrintAndLogEx(INFO, " CSN |00| " _GREEN_("%s") " |", sprint_hex(tag_data, 8)); + PrintAndLogEx(INFO, " CSN |00| " _GREEN_("%s") "|", sprint_hex(tag_data, 8)); printIclassDumpContents(tag_data, 1, (gotBytes / 8), gotBytes); if (filename[0] == 0) { @@ -2055,7 +2055,7 @@ static int CmdHFiClassReadTagFile(const char *Cmd) { uint8_t *csn = dump; PrintAndLogEx(INFO, "------+--+-------------------------+----------"); - PrintAndLogEx(INFO, " CSN |00| " _GREEN_("%s") " |", sprint_hex(csn, 8)); + PrintAndLogEx(INFO, " CSN |00| " _GREEN_("%s") "|", sprint_hex(csn, 8)); printIclassDumpContents(dump, startblock, endblock, bytes_read); free(dump); return PM3_SUCCESS; From 5cce99db99044393e553da651e7b972d5d7919df Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 21:50:49 +0200 Subject: [PATCH 26/35] cleaning --- client/src/cmdhfmfu.c | 1 + client/src/cmdhfmfu.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index da2071fb7..c4a8ce0eb 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -1090,6 +1090,7 @@ uint32_t GetHF14AMfU_Type(void) { NT2H1001G0DUx 0004040202000B03 Micron UL 0034210101000E03 */ + if (memcmp(version, "\x00\x04\x03\x01\x01\x00\x0B", 7) == 0) { tagtype = UL_EV1_48; break; } else if (memcmp(version, "\x00\x04\x03\x01\x02\x00\x0B", 7) == 0) { tagtype = UL_NANO_40; break; } else if (memcmp(version, "\x00\x04\x03\x02\x01\x00\x0B", 7) == 0) { tagtype = UL_EV1_48; break; } diff --git a/client/src/cmdhfmfu.h b/client/src/cmdhfmfu.h index eb81c8dea..67e405677 100644 --- a/client/src/cmdhfmfu.h +++ b/client/src/cmdhfmfu.h @@ -22,7 +22,6 @@ typedef struct { uint32_t GetHF14AMfU_Type(void); int ul_print_type(uint32_t tagtype, uint8_t spaces); -void printMFUdump(mfu_dump_t *card); void printMFUdumpEx(mfu_dump_t *card, uint16_t pages, uint8_t startpage); int CmdHFMFUltra(const char *Cmd); From 1a490470c979179c134a557aa521790fe56807dd Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 21:53:19 +0200 Subject: [PATCH 27/35] chg: 15693 use bigbuf malloc to keep tracelog --- armsrc/iso15693.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/armsrc/iso15693.c b/armsrc/iso15693.c index 9dbdd4f94..d88bae1f0 100644 --- a/armsrc/iso15693.c +++ b/armsrc/iso15693.c @@ -387,9 +387,10 @@ static int DemodAnswer(uint8_t *received, uint8_t *dest, uint16_t samplecount) { // returns: // number of decoded bytes // logging enabled +#define SIGNAL_BUFF_SIZE 20000 + static int GetIso15693AnswerFromTag(uint8_t *received, int *elapsed) { -#define SIGNAL_BUFF_SIZE 15000 // get current clock uint32_t time_0 = GetCountSspClk(); uint32_t time_stop = 0; @@ -446,7 +447,7 @@ static int GetIso15693AnswerFromSniff(uint8_t *received, int *samples, int *elap bool getNext = false; int counter = 0, ci, cq = 0; uint32_t time_0 = 0, time_stop = 0; - uint8_t *buf = BigBuf_get_addr(); + uint8_t *buf = BigBuf_malloc(SIGNAL_BUFF_SIZE); // get current clock time_0 = GetCountSspClk(); @@ -481,6 +482,7 @@ static int GetIso15693AnswerFromSniff(uint8_t *received, int *samples, int *elap time_stop = GetCountSspClk(); int k = DemodAnswer(received, buf, counter); LogTrace(received, k, time_0 << 4, time_stop << 4, NULL, false); + BigBuf_free(); return k; } @@ -521,7 +523,6 @@ void AcquireRawAdcSamplesIso15693(void) { } } - LogTrace(cmd, CMD_ID_RESP, time_start << 4, GetCountSspClk() << 4, NULL, true); FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR); From 06aecb09b79deae925abe73bcbea5680a828b136 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 22:20:32 +0200 Subject: [PATCH 28/35] chg: hf iclass reader - textual --- client/src/cmdhficlass.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 3f7dd178d..0505ecb80 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -465,13 +465,14 @@ static void mem_app_config(const picopass_hdr *hdr) { if (applimit < 6) applimit = 26; if (kb == 2 && (applimit > 0x1f)) applimit = 26; - PrintAndLogEx(INFO, "------ " _CYAN_("Memory") "------"); - PrintAndLogEx(INFO, " %u KBits/%u App Areas (%u * 8 bytes) [%02X]", kb, app_areas, max_blk, mem); - PrintAndLogEx(INFO, " AA1 blocks 06-%02X", applimit); - PrintAndLogEx(INFO, " AA2 blocks %02X-%02X", applimit + 1, max_blk); - PrintAndLogEx(INFO, " OTP 0x%02X%02X", hdr->conf.otp[1], hdr->conf.otp[0]); + PrintAndLogEx(INFO, "------ " _CYAN_("Memory") " ------"); + PrintAndLogEx(INFO, " %u KBits/%u App Areas (%u bytes), max blocks 0x%02X (%02d)", kb, app_areas, max_blk * 8, mem, mem); + PrintAndLogEx(INFO, " AA1 blocks 0x06 - 0x%02X (06 - %02d)", applimit, applimit); + PrintAndLogEx(INFO, " AA2 blocks 0x%02X - 0x%02X (%02d - %02d)", applimit + 1, max_blk, applimit + 1, max_blk); + PrintAndLogEx(INFO, " OTP 0x%02X%02X", hdr->conf.otp[1], hdr->conf.otp[0]); - PrintAndLogEx(INFO, "------ " _CYAN_("KeyAccess") "------"); + PrintAndLogEx(INFO, "------ " _CYAN_("KeyAccess") " ------"); + PrintAndLogEx(INFO, " Kd = Debit key (AA1), Kc = Credit key (AA2)"); uint8_t book = isset(mem, 0x20); if (book) { PrintAndLogEx(INFO, " Read A - Kd"); @@ -2941,9 +2942,12 @@ int readIclass(bool loop, bool verbose) { DropField(); return PM3_EOPABORTED; } + + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " --------------------------"); + PrintAndLogEx(INFO, "-------------------------------------------------------------"); if (readStatus & FLAG_ICLASS_READER_CSN) { - PrintAndLogEx(NORMAL, "\n"); PrintAndLogEx(SUCCESS, " CSN: " _YELLOW_("%s"), sprint_hex(data, 8)); tagFound = true; } @@ -2964,7 +2968,9 @@ int readIclass(bool loop, bool verbose) { bool se_enabled = (memcmp((uint8_t *)(data + 8 * 5), "\xff\xff\xff\x00\x06\xff\xff\xff", 8) == 0); + PrintAndLogEx(INFO, "--------- " _CYAN_("AIA") " ---------"); PrintAndLogEx(SUCCESS, " App IA: %s", sprint_hex(data + 8 * 5, 8)); + PrintAndLogEx(INFO, "------ " _CYAN_("fingerprint") " ------"); if (isHidRange) { @@ -2982,6 +2988,7 @@ int readIclass(bool loop, bool verbose) { } if (tagFound && !loop) { + PrintAndLogEx(NORMAL, ""); DropField(); return PM3_SUCCESS; } @@ -2991,6 +2998,7 @@ int readIclass(bool loop, bool verbose) { } if (!loop) break; } + PrintAndLogEx(NORMAL, ""); DropField(); return res; } From 2aa7c8f6604e911742391f9e6757a317cc9b7a81 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 23:31:32 +0200 Subject: [PATCH 29/35] textual --- client/src/cmdhf.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/client/src/cmdhf.c b/client/src/cmdhf.c index 989211f1b..4fc138a98 100644 --- a/client/src/cmdhf.c +++ b/client/src/cmdhf.c @@ -94,7 +94,7 @@ int CmdHFSearch(const char *Cmd) { int res = PM3_ESOFT; PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, "Searching for ThinFilm tag..."); + PrintAndLogEx(INPLACE, " Searching for ThinFilm tag..."); if (IfPm3NfcBarcode()) { if (infoThinFilm(false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Thinfilm tag") " found\n"); @@ -103,7 +103,7 @@ int CmdHFSearch(const char *Cmd) { } PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, "Searching for LTO-CM tag..."); + PrintAndLogEx(INPLACE, " Searching for LTO-CM tag..."); if (IfPm3Iso14443a()) { if (infoLTO(false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LTO-CM tag") " found\n"); @@ -112,7 +112,7 @@ int CmdHFSearch(const char *Cmd) { } PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, "Searching for ISO14443-A tag..."); + PrintAndLogEx(INPLACE, " Searching for ISO14443-A tag..."); if (IfPm3Iso14443a()) { if (infoHF14A(false, false, false) > 0) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-A tag") " found\n"); @@ -121,7 +121,7 @@ int CmdHFSearch(const char *Cmd) { } PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, "Searching for ISO15693 tag..."); + PrintAndLogEx(INPLACE, " Searching for ISO15693 tag..."); if (IfPm3Iso15693()) { if (readHF15Uid(false)) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO15693 tag") " found\n"); @@ -130,7 +130,7 @@ int CmdHFSearch(const char *Cmd) { } PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, "Searching for LEGIC tag..."); + PrintAndLogEx(INPLACE, " Searching for LEGIC tag..."); if (IfPm3Legicrf()) { if (readLegicUid(false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LEGIC Prime tag") " found\n"); @@ -139,7 +139,7 @@ int CmdHFSearch(const char *Cmd) { } PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, "Searching for Topaz tag..."); + PrintAndLogEx(INPLACE, " Searching for Topaz tag..."); if (IfPm3Iso14443a()) { if (readTopazUid(false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Topaz tag") " found\n"); @@ -148,7 +148,7 @@ int CmdHFSearch(const char *Cmd) { } PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, "Searching for FeliCa tag..."); + PrintAndLogEx(INPLACE, " Searching for FeliCa tag..."); if (IfPm3Felica()) { if (readFelicaUid(false) == PM3_SUCCESS) { PrintAndLogEx(NORMAL, "\nValid " _GREEN_("ISO18092 / FeliCa tag") " found\n"); @@ -158,7 +158,7 @@ int CmdHFSearch(const char *Cmd) { /* // 14b and iclass is the longest test (put last) PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, "Searching for CryptoRF tag..."); + PrintAndLogEx(INPLACE, " Searching for CryptoRF tag..."); if (IfPm3Iso14443b()) { if (readHFCryptoRF(false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("CryptoRF tag") " found\n"); @@ -169,7 +169,7 @@ int CmdHFSearch(const char *Cmd) { // 14b and iclass is the longest test (put last) PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, "Searching for ISO14443-B tag..."); + PrintAndLogEx(INPLACE, " Searching for ISO14443-B tag..."); if (IfPm3Iso14443b()) { if (readHF14B(false) == 1) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-B tag") " found\n"); @@ -178,7 +178,7 @@ int CmdHFSearch(const char *Cmd) { } PROMPT_CLEARLINE; - PrintAndLogEx(INPLACE, "Searching for iClass / PicoPass tag..."); + PrintAndLogEx(INPLACE, " Searching for iClass / PicoPass tag..."); if (IfPm3Iclass()) { if (readIclass(false, false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iClass tag / PicoPass tag") " found\n"); From e7514ecbc0b7fed2175138d889b8c0ac3973e227 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 23:50:22 +0200 Subject: [PATCH 30/35] text --- client/src/cmdhf15.c | 5 +++-- client/src/cmdhfmf.c | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index 627e7e4bc..2b8812d33 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -1835,6 +1835,7 @@ static int CmdHF15CSetUID(const char *Cmd) { } static command_t CommandTable[] = { + {"-----------", CmdHF15Help, AlwaysAvailable, "--------------------- " _CYAN_("General") " ---------------------"}, {"help", CmdHF15Help, AlwaysAvailable, "This help"}, {"list", CmdHF15List, AlwaysAvailable, "List ISO15693 history"}, {"demod", CmdHF15Demod, AlwaysAvailable, "Demodulate ISO15693 from tag"}, @@ -1850,11 +1851,11 @@ static command_t CommandTable[] = { {"samples", CmdHF15Samples, IfPm3Iso15693, "Acquire Samples as Reader (enables carrier, sends inquiry)"}, {"sim", CmdHF15Sim, IfPm3Iso15693, "Fake an ISO15693 tag"}, {"write", CmdHF15Write, IfPm3Iso15693, "Write a block"}, - {"-----------", CmdHF15Help, IfPm3Iso15693, ""}, + {"-----------", CmdHF15Help, IfPm3Iso15693, "----------------------- " _CYAN_("afi") " -----------------------"}, {"findafi", CmdHF15FindAfi, IfPm3Iso15693, "Brute force AFI of an ISO15693 tag"}, {"writeafi", CmdHF15WriteAfi, IfPm3Iso15693, "Writes the AFI on an ISO15693 tag"}, {"writedsfid", CmdHF15WriteDsfid, IfPm3Iso15693, "Writes the DSFID on an ISO15693 tag"}, - {"-----------", CmdHF15Help, IfPm3Iso15693, ""}, + {"-----------", CmdHF15Help, IfPm3Iso15693, "----------------------- " _CYAN_("magic") " -----------------------"}, {"csetuid", CmdHF15CSetUID, IfPm3Iso15693, "Set UID for magic Chinese card"}, {NULL, NULL, NULL, NULL} }; diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index eb9670b70..0aa6bfd9b 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -4828,6 +4828,7 @@ static int CmdHF14AMfList(const char *Cmd) { static command_t CommandTable[] = { {"help", CmdHelp, AlwaysAvailable, "This help"}, {"list", CmdHF14AMfList, AlwaysAvailable, "List MIFARE history"}, + {"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("recovery") " -----------------------"}, {"darkside", CmdHF14AMfDarkside, IfPm3Iso14443a, "Darkside attack"}, {"nested", CmdHF14AMfNested, IfPm3Iso14443a, "Nested attack"}, {"hardnested", CmdHF14AMfNestedHard, AlwaysAvailable, "Nested attack for hardened MIFARE Classic cards"}, @@ -4838,7 +4839,7 @@ static command_t CommandTable[] = { {"chk", CmdHF14AMfChk, IfPm3Iso14443a, "Check keys"}, {"fchk", CmdHF14AMfChk_fast, IfPm3Iso14443a, "Check keys fast, targets all keys on card"}, {"decrypt", CmdHf14AMfDecryptBytes, AlwaysAvailable, "[nt] [ar_enc] [at_enc] [data] - to decrypt sniff or trace"}, - {"-----------", CmdHelp, IfPm3Iso14443a, ""}, + {"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("operations") " -----------------------"}, {"auth4", CmdHF14AMfAuth4, IfPm3Iso14443a, "ISO14443-4 AES authentication"}, {"dump", CmdHF14AMfDump, IfPm3Iso14443a, "Dump MIFARE classic tag to binary file"}, {"mad", CmdHF14AMfMAD, IfPm3Iso14443a, "Checks and prints MAD"}, @@ -4850,7 +4851,7 @@ static command_t CommandTable[] = { {"wrbl", CmdHF14AMfWrBl, IfPm3Iso14443a, "Write MIFARE classic block"}, {"setmod", CmdHf14AMfSetMod, IfPm3Iso14443a, "Set MIFARE Classic EV1 load modulation strength"}, // {"sniff", CmdHF14AMfSniff, 0, "Sniff card-reader communication"}, - {"-----------", CmdHelp, IfPm3Iso14443a, ""}, + {"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("simulation") " -----------------------"}, {"sim", CmdHF14AMfSim, IfPm3Iso14443a, "Simulate MIFARE card"}, {"eclr", CmdHF14AMfEClear, IfPm3Iso14443a, "Clear simulator memory"}, {"eget", CmdHF14AMfEGet, IfPm3Iso14443a, "Get simulator memory block"}, @@ -4859,7 +4860,7 @@ static command_t CommandTable[] = { {"esave", CmdHF14AMfESave, IfPm3Iso14443a, "Save to file emul dump"}, {"ecfill", CmdHF14AMfECFill, IfPm3Iso14443a, "Fill simulator memory with help of keys from simulator"}, {"ekeyprn", CmdHF14AMfEKeyPrn, IfPm3Iso14443a, "Print keys from simulator memory"}, - {"-----------", CmdHelp, IfPm3Iso14443a, ""}, + {"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("magic") " -----------------------"}, {"csetuid", CmdHF14AMfCSetUID, IfPm3Iso14443a, "Set UID (magic chinese card)"}, {"cwipe", CmdHF14AMfCWipe, IfPm3Iso14443a, "Wipe card to default UID/Sectors/Keys"}, {"csetblk", CmdHF14AMfCSetBlk, IfPm3Iso14443a, "Write block (magic chinese card)"}, @@ -4867,7 +4868,7 @@ static command_t CommandTable[] = { {"cgetsc", CmdHF14AMfCGetSc, IfPm3Iso14443a, "Read sector (magic chinese card)"}, {"cload", CmdHF14AMfCLoad, IfPm3Iso14443a, "Load dump (magic chinese card)"}, {"csave", CmdHF14AMfCSave, IfPm3Iso14443a, "Save dump from magic chinese card into file or emulator"}, - {"-----------", CmdHelp, IfPm3Iso14443a, ""}, + {"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("i") " -----------------------"}, {"ice", CmdHF14AMfice, IfPm3Iso14443a, "collect MIFARE Classic nonces to file"}, {NULL, NULL, NULL, NULL} }; From 5e7911becb75ceab802a45dddcea8948b63ec37d Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 23:50:36 +0200 Subject: [PATCH 31/35] text --- client/src/cmdhffelica.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/client/src/cmdhffelica.c b/client/src/cmdhffelica.c index 1fcf23fa3..f62a9a8ff 100644 --- a/client/src/cmdhffelica.c +++ b/client/src/cmdhffelica.c @@ -1848,7 +1848,8 @@ int readFelicaUid(bool verbose) { } static command_t CommandTable[] = { - {"----------- General -----------", CmdHelp, AlwaysAvailable, ""}, + + {"-----------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("General") " -----------------------"}, {"help", CmdHelp, AlwaysAvailable, "This help"}, {"list", CmdHFFelicaList, AlwaysAvailable, "List ISO 18092/FeliCa history"}, {"reader", CmdHFFelicaReader, IfPm3Felica, "Act like an ISO18092/FeliCa reader"}, @@ -1856,7 +1857,7 @@ static command_t CommandTable[] = { {"raw", CmdHFFelicaCmdRaw, IfPm3Felica, "Send raw hex data to tag"}, {"rdunencrypted", CmdHFFelicaReadWithoutEncryption, IfPm3Felica, "read Block Data from authentication-not-required Service."}, {"wrunencrypted", CmdHFFelicaWriteWithoutEncryption, IfPm3Felica, "write Block Data to an authentication-not-required Service."}, - {"----------- FeliCa Standard -----------", CmdHelp, AlwaysAvailable, ""}, + {"-----------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("FeliCa Standard") " -----------------------"}, //{"dump", CmdHFFelicaDump, IfPm3Felica, "Wait for and try dumping FeliCa"}, {"rqservice", CmdHFFelicaRequestService, IfPm3Felica, "verify the existence of Area and Service, and to acquire Key Version."}, {"rqresponse", CmdHFFelicaRequestResponse, IfPm3Felica, "verify the existence of a card and its Mode."}, @@ -1875,7 +1876,7 @@ static command_t CommandTable[] = { //{"readv2", CmdHFFelicaNotImplementedYet, IfPm3Felica, "read Block Data from authentication-required Service."}, //{"writev2", CmdHFFelicaNotImplementedYet, IfPm3Felica, "write Block Data to authentication-required Service."}, //{"uprandomid", CmdHFFelicaNotImplementedYet, IfPm3Felica, "update Random ID (IDr)."}, - {"----------- FeliCa Light -----------", CmdHelp, AlwaysAvailable, ""}, + {"-----------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("FeliCa Light") " -----------------------"}, {"litesim", CmdHFFelicaSimLite, IfPm3Felica, " - only reply to poll request"}, {"litedump", CmdHFFelicaDumpLite, IfPm3Felica, "Wait for and try dumping FelicaLite"}, // {"sim", CmdHFFelicaSim, IfPm3Felica, " -- Simulate ISO 18092/FeliCa tag"} From d4b752e23b46b21ade13cbe5dcdf73b9136a9ad2 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 26 Jun 2020 23:53:34 +0200 Subject: [PATCH 32/35] text --- client/src/cmdmain.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/cmdmain.c b/client/src/cmdmain.c index 0ca9826d8..1c6cbd82c 100644 --- a/client/src/cmdmain.c +++ b/client/src/cmdmain.c @@ -50,7 +50,7 @@ static int usage_hints(void) { PrintAndLogEx(NORMAL, " <0|1> off or on"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " hints 1"); + PrintAndLogEx(NORMAL, _YELLOW_(" hints 1")); return PM3_SUCCESS; } @@ -63,7 +63,7 @@ static int usage_msleep(void) { PrintAndLogEx(NORMAL, " time in milliseconds"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " msleep 100"); + PrintAndLogEx(NORMAL, _YELLOW_(" msleep 100")); return PM3_SUCCESS; } @@ -75,7 +75,7 @@ static int usage_auto(void) { PrintAndLogEx(NORMAL, " h This help"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, " auto"); + PrintAndLogEx(NORMAL, _YELLOW_(" auto")); return PM3_SUCCESS; } @@ -249,7 +249,7 @@ static int CmdPref(const char *Cmd) { static command_t CommandTable[] = { - {"--------",CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("sub") " -----------------------"}, + {"--------",CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Technology") " -----------------------"}, {"analyse", CmdAnalyse, AlwaysAvailable, "{ Analyse utils... }"}, {"data", CmdData, AlwaysAvailable, "{ Plot window / data buffer manipulation... }"}, @@ -264,7 +264,7 @@ static command_t CommandTable[] = { {"trace", CmdTrace, AlwaysAvailable, "{ Trace manipulation... }"}, {"usart", CmdUsart, IfPm3FpcUsartFromUsb, "{ USART commands... }"}, {"wiegand", CmdWiegand, AlwaysAvailable, "{ Wiegand format manipulation... }"}, - {"--------",CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("sub") " -----------------------"}, + {"--------",CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("General") " -----------------------"}, {"auto", CmdAuto, IfPm3Present, "Automated detection process for unknown tags"}, {"help", CmdHelp, AlwaysAvailable, "This help. Use " _YELLOW_("' help'") " for details of a particular command."}, {"hints", CmdHints, AlwaysAvailable, "Turn hints on / off"}, From b06ffe947393716fdcd46d34a1ab486fa242ea12 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 27 Jun 2020 00:06:03 +0200 Subject: [PATCH 33/35] text --- doc/cheatsheet.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/cheatsheet.md b/doc/cheatsheet.md index 0ae47b68c..0217600d6 100644 --- a/doc/cheatsheet.md +++ b/doc/cheatsheet.md @@ -205,7 +205,7 @@ k : key filename, if no given, UID will be used as filename" f : data filename, if no given, UID will be used as filename pm3 --> hf mf dump 1 -pm3 --> hf mf dump 1 k hf-mf-A29558E4-key.bin f hf-mf-A29558E4-data.bin +pm3 --> hf mf dump 1 k hf-mf-A29558E4-key.bin f hf-mf-A29558E4-dump.bin ``` Convert .bin to .eml @@ -275,7 +275,7 @@ Clone Mifare 1K Sequence ``` pm3 --> hf mf chk *1 ? d mfc_default_keys pm3 --> hf mf dump -pm3 --> hf mf restore 1 u 4A6CE843 k hf-mf-A29558E4-key.bin f hf-mf-A29558E4-data.bin +pm3 --> hf mf restore 1 u 4A6CE843 k hf-mf-A29558E4-key.bin f hf-mf-A29558E4-dump.bin ``` Read Mifare Ultralight EV1 From fb2735ef86c04c7cad6d9c94aaf2d8f05e37776c Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 27 Jun 2020 00:07:09 +0200 Subject: [PATCH 34/35] text --- tools/pm3_mf7b_wipe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/pm3_mf7b_wipe.py b/tools/pm3_mf7b_wipe.py index 9f7b29c6b..1bc0db4b9 100755 --- a/tools/pm3_mf7b_wipe.py +++ b/tools/pm3_mf7b_wipe.py @@ -79,7 +79,7 @@ import subprocess # EML data var te get keys of -EML_FILE_DATA = """PLACE RAW hf-mf-CARD_UID-data.eml FILE CONTENT OF CURRENTLY LOADED CARD HERE""" +EML_FILE_DATA = """PLACE RAW hf-mf-CARD_UID-dump.eml FILE CONTENT OF CURRENTLY LOADED CARD HERE""" # Change your device name here if it differs from the default Proxmark3 RDV4.0 PROXMARK_BIN_EXEC_STRING = 'proxmark3 -c "%s" /dev/tty.usbmodemiceman1' # Constants From 1f04fa7ba0d3472637c18ce9a9b878aab2da88a6 Mon Sep 17 00:00:00 2001 From: tharexde Date: Sat, 27 Jun 2020 00:25:04 +0200 Subject: [PATCH 35/35] added lf em function 4x50_sread --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6791e748a..416f063b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] + - Added lf em function: 4x50_sread (@tharexde) - Added lf em functions: 4x50_info, 4x50_write, 4x50_write_password (@tharexde) - Fix em4x50 demodulation error (@tharexde) - Fix `hf mfdes` authentification issues, DES working (@bkerler)