Merge branch 'master' into dev-em4x50_sread

update
This commit is contained in:
tharexde 2020-06-27 00:37:32 +02:00
commit 81cd478883
49 changed files with 522 additions and 375 deletions

View file

@ -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... 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] ## [unreleased][unreleased]
- Added lf em function: 4x50_sread (@tharexde)
- Added lf em functions: 4x50_info, 4x50_write, 4x50_write_password (@tharexde) - Added lf em functions: 4x50_info, 4x50_write, 4x50_write_password (@tharexde)
- Fix em4x50 demodulation error (@tharexde) - Fix em4x50 demodulation error (@tharexde)
- Fix `hf mfdes` authentification issues, DES working (@bkerler) - Fix `hf mfdes` authentification issues, DES working (@bkerler)

View file

@ -48,7 +48,7 @@ void ModInfo(void) {
DbpString(" LF EM4100 read/write/clone mode"); 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; uint64_t result = 0;
for (int i = 0; i < 16; i++) { for (int i = 0; i < 16; i++) {
result += ((bits >> (60 - 4 * i)) & 0xf) << (4 * i); result += ((bits >> (60 - 4 * i)) & 0xf) << (4 * i);
@ -56,35 +56,41 @@ static uint64_t ReversQuads(uint64_t bits) {
return result >> 24; return result >> 24;
} }
static void FillBuff(uint8_t bit) { static void fillbuff(uint8_t bit) {
memset(bba + buflen, bit, CLOCK / 2); memset(bba + buflen, bit, CLOCK / 2);
buflen += (CLOCK / 2); buflen += (CLOCK / 2);
memset(bba + buflen, bit ^ 1, CLOCK / 2); memset(bba + buflen, bit ^ 1, CLOCK / 2);
buflen += (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; buflen = 0;
for (i = 0; i < 9; i++)
FillBuff(1); for (uint8_t i = 0; i < 9; i++)
parity[0] = parity[1] = parity[2] = parity[3] = 0; fillbuff(1);
for (i = 0; i < 10; i++) {
for (j = 3; j >= 0; j--, id /= 2) for (uint8_t i = 0; i < 10; i++) {
for (uint8_t j = 3; j > 0; j--, id /= 2)
binary[j] = id % 2; binary[j] = id % 2;
for (j = 0; j < 4; j++)
FillBuff(binary[j]); for (uint8_t j = 0; j < 4; j++)
FillBuff(binary[0] ^ binary[1] ^ binary[2] ^ binary[3]); fillbuff(binary[j]);
for (j = 0; j < 4; j++)
fillbuff(binary[0] ^ binary[1] ^ binary[2] ^ binary[3]);
for (uint8_t j = 0; j < 4; j++)
parity[j] ^= binary[j]; parity[j] ^= binary[j];
} }
for (j = 0; j < 4; j++)
FillBuff(parity[j]); for (uint8_t j = 0; j < 4; j++)
FillBuff(0); fillbuff(parity[j]);
fillbuff(0);
} }
static void LED_Slot(int i) { static void led_slot(int i) {
LEDsoff(); LEDsoff();
if (slots_count > 4) { if (slots_count > 4) {
LED(i % MAX_IND, 0); //binary indication, usefully for 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) { static void flash_leds(uint32_t speed, uint8_t times) {
for (int i = 0; i < times * 2; i++) { for (uint16_t i = 0; i < times * 2; i++) {
LED_A_INV(); LED_A_INV();
LED_B_INV(); LED_B_INV();
LED_C_INV(); LED_C_INV();
@ -132,24 +138,28 @@ void RunMod(void) {
uint8_t state = 0; uint8_t state = 0;
slots_count = ARRAYLEN(low); slots_count = ARRAYLEN(low);
bba = BigBuf_get_addr(); bba = BigBuf_get_addr();
LED_Slot(selected); led_slot(selected);
for (;;) { for (;;) {
WDT_HIT(); WDT_HIT();
if (data_available()) break; if (data_available()) break;
int button_pressed = BUTTON_HELD(1000); int button_pressed = BUTTON_HELD(1000);
SpinDelay(300); SpinDelay(300);
switch (state) { switch (state) {
case 0: case 0:
// Select mode // Select mode
if (button_pressed == BUTTON_HOLD) { if (button_pressed == BUTTON_HOLD) {
// Long press - switch to simulate mode // Long press - switch to simulate mode
SpinUp(100); SpinUp(100);
LED_Slot(selected); led_slot(selected);
state = 2; state = 2;
} else if (button_pressed == BUTTON_SINGLE_CLICK) { } else if (button_pressed == BUTTON_SINGLE_CLICK) {
// Click - switch to next slot // Click - switch to next slot
selected = (selected + 1) % slots_count; selected = (selected + 1) % slots_count;
LED_Slot(selected); led_slot(selected);
} }
break; break;
case 1: case 1:
@ -157,12 +167,12 @@ void RunMod(void) {
if (button_pressed == BUTTON_HOLD) { if (button_pressed == BUTTON_HOLD) {
// Long press - switch to read mode // Long press - switch to read mode
SpinUp(100); SpinUp(100);
LED_Slot(selected); led_slot(selected);
state = 3; state = 3;
} else if (button_pressed == BUTTON_SINGLE_CLICK) { } else if (button_pressed == BUTTON_SINGLE_CLICK) {
// Click - exit to select mode // Click - exit to select mode
CmdEM410xdemod(1, &high[selected], &low[selected]); lf_em410x_watch(1, &high[selected], &low[selected]);
FlashLEDs(100, 5); flash_leds(100, 5);
#ifdef WITH_FLASH #ifdef WITH_FLASH
SaveIDtoFlash(selected, low[selected]); SaveIDtoFlash(selected, low[selected]);
#endif #endif
@ -174,15 +184,17 @@ void RunMod(void) {
if (button_pressed == BUTTON_HOLD) { if (button_pressed == BUTTON_HOLD) {
// Long press - switch to read mode // Long press - switch to read mode
SpinDown(100); SpinDown(100);
LED_Slot(selected); led_slot(selected);
state = 1; state = 1;
} else if (button_pressed == BUTTON_SINGLE_CLICK) { } else if (button_pressed == BUTTON_SINGLE_CLICK) {
// Click - start simulating. Click again to exit from simulate mode // Click - start simulating. Click again to exit from simulate mode
LED_Slot(selected); led_slot(selected);
ConstructEM410xEmulBuf(ReversQuads(low[selected]));
FlashLEDs(100, 5); construct_EM410x_emul(rev_quads(low[selected]));
flash_leds(100, 5);
SimulateTagLowFrequency(buflen, 0, 1); SimulateTagLowFrequency(buflen, 0, 1);
LED_Slot(selected); led_slot(selected);
state = 0; // Switch to select mode state = 0; // Switch to select mode
} }
break; break;
@ -191,12 +203,12 @@ void RunMod(void) {
if (button_pressed == BUTTON_HOLD) { if (button_pressed == BUTTON_HOLD) {
// Long press - switch to select mode // Long press - switch to select mode
SpinDown(100); SpinDown(100);
LED_Slot(selected); led_slot(selected);
state = 0; state = 0;
} else if (button_pressed == BUTTON_SINGLE_CLICK) { } else if (button_pressed == BUTTON_SINGLE_CLICK) {
// Click - write ID to tag // Click - write ID to tag
WriteEM410x(0, (uint32_t)(low[selected] >> 32), (uint32_t)(low[selected] & 0xffffffff)); copy_em410x_to_t55xx(0, CLOCK, (uint32_t)(low[selected] >> 32), (uint32_t)(low[selected] & 0xffffffff));
LED_Slot(selected); led_slot(selected);
state = 0; // Switch to select mode state = 0; // Switch to select mode
} }
break; break;

View file

@ -75,7 +75,7 @@ void RunMod(void) {
// record // record
DbpString("[=] starting recording"); 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]); Dbprintf("[=] recorded %x %x %08x", selected, high[selected], low[selected]);
LEDsoff(); LEDsoff();

View file

@ -56,9 +56,8 @@ void RunMod(void) {
DbpString("[=] starting recording"); DbpString("[=] starting recording");
// findone, high, low
// findone, high, low, no ledcontrol (A) lf_hid_watch(1, &high, &low);
CmdHIDdemodFSK(1, &high, &low, 0);
Dbprintf("[=] recorded | %x%08x", high, low); Dbprintf("[=] recorded | %x%08x", high, low);

View file

@ -77,7 +77,7 @@ void RunMod(void) {
// findone, high, low, no ledcontrol (A) // findone, high, low, no ledcontrol (A)
uint32_t hi = 0, lo = 0; uint32_t hi = 0, lo = 0;
CmdHIDdemodFSK(1, &hi, &lo, 0); lf_hid_watch(1, &hi, &lo);
high[selected] = hi; high[selected] = hi;
low[selected] = lo; low[selected] = lo;

View file

@ -36,7 +36,7 @@
#include "lfsampling.h" #include "lfsampling.h"
#include "lfdemod.h" #include "lfdemod.h"
#include "commonutil.h" #include "commonutil.h"
#include "appmain.h"
#define test_bit(data, i) (*(data + (i/8)) >> (7-(i % 8))) & 1 #define test_bit(data, i) (*(data + (i/8)) >> (7-(i % 8))) & 1
#define set_bit(data, i) *(data + (i/8)) |= (1 << (7-(i % 8))) #define set_bit(data, i) *(data + (i/8)) |= (1 << (7-(i % 8)))
@ -1002,15 +1002,20 @@ void SniffHitag2(void) {
size_t periods = 0; size_t periods = 0;
uint8_t periods_bytes[4]; uint8_t periods_bytes[4];
int16_t checked = 0; // int16_t checked = 0;
/*bool waiting_for_first_edge = true;*/ /*bool waiting_for_first_edge = true;*/
LED_C_ON(); LED_C_ON();
uint32_t signal_size = 10000;
while (!BUTTON_PRESS()) { while (!BUTTON_PRESS()) {
// use malloc
initSampleBufferEx(&signal_size, false);
WDT_HIT(); WDT_HIT();
/*
// only every 1000th times, in order to save time when collecting samples. // only every 1000th times, in order to save time when collecting samples.
if (checked == 1000) { if (checked == 1000) {
if (data_available()) { if (data_available()) {
@ -1021,13 +1026,14 @@ void SniffHitag2(void) {
} }
} }
++checked; ++checked;
*/
// Receive frame, watch for at most T0*EOF periods // Receive frame, watch for at most T0*EOF periods
// lf_reset_counter(); // lf_reset_counter();
// Wait "infinite" for reader modulation // Wait "infinite" for reader modulation
periods = lf_detect_gap(20000); periods = lf_detect_gap(10000);
// Test if we detected the first reader modulation edge // Test if we detected the first reader modulation edge
if (periods != 0) { if (periods != 0) {
@ -1042,7 +1048,6 @@ void SniffHitag2(void) {
num_to_bytes(periods, 4, periods_bytes); num_to_bytes(periods, 4, periods_bytes);
LogTrace(periods_bytes, 4, 0, 0, NULL, true); LogTrace(periods_bytes, 4, 0, 0, NULL, true);
} }
} }
lf_finalize(); lf_finalize();
@ -1064,7 +1069,7 @@ void SimulateHitag2(bool tag_mem_supplied, uint8_t *data) {
int response = 0; int response = 0;
uint8_t rx[HITAG_FRAME_LEN] = {0}; uint8_t rx[HITAG_FRAME_LEN] = {0};
size_t rxlen = 0; size_t rxlen = 0;
uint8_t tx[HITAG_FRAME_LEN]; uint8_t tx[HITAG_FRAME_LEN] = {0};
size_t txlen = 0; size_t txlen = 0;
auth_table_len = 0; auth_table_len = 0;
@ -1108,8 +1113,11 @@ void SimulateHitag2(bool tag_mem_supplied, uint8_t *data) {
// int16_t checked = 0; // int16_t checked = 0;
// SIMULATE // SIMULATE
uint32_t signal_size = 10000;
while (BUTTON_PRESS() == false) {
while (!BUTTON_PRESS()) { // use malloc
initSampleBufferEx(&signal_size, true);
LED_D_ON(); 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 command_start = 0, command_duration = 0;
uint32_t response_start = 0, response_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; size_t rxlen = 0;
uint8_t txbuf[HITAG_FRAME_LEN]; uint8_t txbuf[HITAG_FRAME_LEN] = {0};
uint8_t *tx = txbuf; uint8_t *tx = txbuf;
size_t txlen = 0; size_t txlen = 0;
@ -1430,12 +1438,17 @@ void ReaderHitag(hitag_function htf, hitag_data *htd) {
size_t nrzs = 0; size_t nrzs = 0;
int16_t checked = 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(); WDT_HIT();
// only every 1000th times, in order to save time when collecting samples. // only every 1000th times, in order to save time when collecting samples.
if (checked == 1000) { if (checked == 4000) {
if (data_available()) { if (data_available()) {
checked = -1; checked = -1;
break; break;
@ -1615,13 +1628,13 @@ void ReaderHitag(hitag_function htf, hitag_data *htd) {
} }
// Pack the response into a byte array // 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]; uint8_t bit = nrz_samples[i];
if (bit > 1) { // When Manchester detects impossible symbol it writes "7" if (bit > 1) { // When Manchester detects impossible symbol it writes "7"
DBG Dbprintf("Error in Manchester decoding, abort"); DBG Dbprintf("Error in Manchester decoding, abort");
break; break;
} }
rx[rxlen / 8] |= bit << (7 - (rxlen % 8)); rx[rxlen >> 3] |= bit << (7 - (rxlen % 8));
rxlen++; rxlen++;
} }
@ -1756,10 +1769,14 @@ void WriterHitag(hitag_function htf, hitag_data *htd, int page) {
size_t nrzs = 0; size_t nrzs = 0;
int16_t checked = 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. // use malloc
if (checked == 1000) { initSampleBufferEx(&signal_size, true);
// only every 4000th times, in order to save time when collecting samples.
if (checked == 4000) {
if (data_available()) { if (data_available()) {
checked = -1; checked = -1;
break; break;
@ -1920,12 +1937,13 @@ void WriterHitag(hitag_function htf, hitag_data *htd, int page) {
} }
// Pack the response into a byte array // 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]; uint8_t bit = nrz_samples[i];
if (bit > 1) { // When Manchester detects impossible symbol it writes "7" if (bit > 1) { // When Manchester detects impossible symbol it writes "7"
break; break;
} }
rx[rxlen / 8] |= bit << (7 - (rxlen % 8)); // >> 3 instead of div by 8
rx[rxlen >> 3] |= bit << (7 - (rxlen % 8));
rxlen++; rxlen++;
} }

View file

@ -387,9 +387,10 @@ static int DemodAnswer(uint8_t *received, uint8_t *dest, uint16_t samplecount) {
// returns: // returns:
// number of decoded bytes // number of decoded bytes
// logging enabled // logging enabled
#define SIGNAL_BUFF_SIZE 20000
static int GetIso15693AnswerFromTag(uint8_t *received, int *elapsed) { static int GetIso15693AnswerFromTag(uint8_t *received, int *elapsed) {
#define SIGNAL_BUFF_SIZE 15000
// get current clock // get current clock
uint32_t time_0 = GetCountSspClk(); uint32_t time_0 = GetCountSspClk();
uint32_t time_stop = 0; uint32_t time_stop = 0;
@ -446,7 +447,7 @@ static int GetIso15693AnswerFromSniff(uint8_t *received, int *samples, int *elap
bool getNext = false; bool getNext = false;
int counter = 0, ci, cq = 0; int counter = 0, ci, cq = 0;
uint32_t time_0 = 0, time_stop = 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 // get current clock
time_0 = GetCountSspClk(); time_0 = GetCountSspClk();
@ -481,6 +482,7 @@ static int GetIso15693AnswerFromSniff(uint8_t *received, int *samples, int *elap
time_stop = GetCountSspClk(); time_stop = GetCountSspClk();
int k = DemodAnswer(received, buf, counter); int k = DemodAnswer(received, buf, counter);
LogTrace(received, k, time_0 << 4, time_stop << 4, NULL, false); LogTrace(received, k, time_0 << 4, time_stop << 4, NULL, false);
BigBuf_free();
return k; return k;
} }
@ -521,7 +523,6 @@ void AcquireRawAdcSamplesIso15693(void) {
} }
} }
LogTrace(cmd, CMD_ID_RESP, time_start << 4, GetCountSspClk() << 4, NULL, true); LogTrace(cmd, CMD_ID_RESP, time_start << 4, GetCountSspClk() << 4, NULL, true);
FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR); FpgaWriteConfWord(FPGA_MAJOR_MODE_HF_READER_RX_XCORR);

View file

@ -11,6 +11,7 @@
#include "fpgaloader.h" #include "fpgaloader.h"
#include "ticks.h" #include "ticks.h"
#include "dbprint.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) // 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 // 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) { static size_t lf_count_edge_periods_ex(size_t max, bool wait, bool detect_gap) {
size_t periods = 0; size_t periods = 0;
volatile uint8_t adc_val;
uint8_t avg_peak = adc_avg + 3, avg_through = adc_avg - 3; 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)) { 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++; periods++;
if (g_logging) logSampleSimple(adc_val); 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) { if (adc_val == 0) {
return periods; return periods;
} }
} else { } else {
// Trigger on a modulation swap by observing an edge change // Trigger on a modulation swap by observing an edge change
if (rising_edge) { 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 (periods >= max) return 0;
} }
} }
if (g_logging) logSampleSimple(0xFF); if (g_logging) logSampleSimple(0xFF);
return 0; return 0;
} }
@ -161,6 +148,7 @@ bool lf_get_reader_modulation(void) {
} }
void lf_wait_periods(size_t periods) { void lf_wait_periods(size_t periods) {
// wait detect gap
lf_count_edge_periods_ex(periods, true, false); 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 lf_detect_field_drop(size_t max) {
/*
size_t periods = 0; size_t periods = 0;
// int16_t checked = 0; // int16_t checked = 0;
while (!BUTTON_PRESS()) { while (BUTTON_PRESS() == false) {
/* // // only every 1000th times, in order to save time when collecting samples.
// only every 1000th times, in order to save time when collecting samples. // if (checked == 4000) {
if (checked == 1000) { // if (data_available()) {
if (data_available()) { // checked = -1;
checked = -1; // break;
break; // } else {
} else { // checked = 0;
checked = 0; // }
} // }
} // ++checked;
++checked;
*/
WDT_HIT(); WDT_HIT();
@ -284,6 +271,7 @@ size_t lf_detect_field_drop(size_t max) {
if (periods == max) return 0; if (periods == max) return 0;
} }
} }
*/
return 0; return 0;
} }

View file

@ -16,6 +16,7 @@
#include "util.h" #include "util.h"
#include "lfdemod.h" #include "lfdemod.h"
#include "string.h" // memset #include "string.h" // memset
#include "appmain.h" // print stack
/* /*
Default LF config is set to: 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} ; 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) { void printConfig(void) {
uint32_t d = config.divisor; uint32_t d = config.divisor;
DbpString(_CYAN_("LF Sampling config")); DbpString(_CYAN_("LF Sampling config"));
@ -38,6 +45,18 @@ void printConfig(void) {
Dbprintf(" [a] averaging...........%s", (config.averaging) ? "Yes" : "No"); Dbprintf(" [a] averaging...........%s", (config.averaging) ? "Yes" : "No");
Dbprintf(" [t] trigger threshold...%d", config.trigger_threshold); Dbprintf(" [t] trigger threshold...%d", config.trigger_threshold);
Dbprintf(" [s] samples to skip.....%d ", config.samples_to_skip); 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++; 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) { void initSampleBuffer(uint32_t *sample_size) {
initSampleBufferEx(sample_size, false); initSampleBufferEx(sample_size, false);
} }
@ -116,9 +129,7 @@ void initSampleBufferEx(uint32_t *sample_size, bool use_malloc) {
} }
BigBuf_free(); BigBuf_free();
// We can't erase the buffer now, it would drastically delay the acquisition // We can't erase the buffer now, it would drastically delay the acquisition
if (use_malloc) { if (use_malloc) {
if (*sample_size == 0) { if (*sample_size == 0) {
@ -141,7 +152,7 @@ void initSampleBufferEx(uint32_t *sample_size, bool use_malloc) {
// //
samples.dec_counter = 0; samples.dec_counter = 0;
samples.sum = 0; samples.sum = 0;
samples.counter = 0; samples.counter = *sample_size;
samples.total_saved = 0; 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 (!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 (bits_per_sample > 8) bits_per_sample = 8;
if (decimation == 0) decimation = 1; if (decimation == 0) decimation = 1;
// keep track of total gather samples regardless how many was discarded.
samples.counter++;
if (avg) { if (avg) {
samples.sum += sample; 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. // Connect the A/D to the peak-detected low-frequency path.
SetAdcMuxFor(GPIO_MUXSEL_LOPKD); SetAdcMuxFor(GPIO_MUXSEL_LOPKD);
// 50ms for the resonant antenna to settle. // 50ms for the resonant antenna to settle.
if (reader_field) if (reader_field)
SpinDelay(50); SpinDelay(50);
@ -255,6 +267,11 @@ uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, in
initSampleBuffer(&sample_size); initSampleBuffer(&sample_size);
if (DBGLEVEL >= DBG_DEBUG) {
Dbprintf("lf sampling - after init");
printSamples();
}
uint32_t cancel_counter = 0; uint32_t cancel_counter = 0;
int16_t checked = 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. // only every 1000th times, in order to save time when collecting samples.
// interruptible only when logging not yet triggered // interruptible only when logging not yet triggered
if ((checked == 2000) && (trigger_threshold > 0)) { if ((checked == 4000) && (trigger_threshold > 0)) {
if (data_available()) { if (data_available()) {
checked = -1; checked = -1;
break; break;
@ -398,9 +415,18 @@ void doT55x7Acquisition(size_t sample_size) {
uint16_t checker = 0; uint16_t checker = 0;
if (DBGLEVEL >= DBG_DEBUG) {
Dbprintf("doT55x7Acquisition - after init");
print_stack_usage();
}
while (skipCnt < 1000 && (i < bufsize)) { while (skipCnt < 1000 && (i < bufsize)) {
if (checker == 1000) {
if (BUTTON_PRESS() || data_available()) if (BUTTON_PRESS())
break;
if (checker == 4000) {
if (data_available())
break; break;
else else
checker = 0; checker = 0;
@ -462,21 +488,24 @@ void doT55x7Acquisition(size_t sample_size) {
void doCotagAcquisition(size_t sample_size) { void doCotagAcquisition(size_t sample_size) {
uint8_t *dest = BigBuf_get_addr(); uint8_t *dest = BigBuf_get_addr();
uint16_t bufsize = BigBuf_max_traceLen(); uint16_t bufsize = MIN(sample_size, BigBuf_max_traceLen());
if (bufsize > sample_size)
bufsize = sample_size;
dest[0] = 0; dest[0] = 0;
uint8_t firsthigh = 0, firstlow = 0; uint8_t firsthigh = 0, firstlow = 0;
uint16_t i = 0; uint16_t i = 0, noise_counter = 0, checker = 0;
uint16_t noise_counter = 0;
uint16_t checker = 0; if (DBGLEVEL >= DBG_DEBUG) {
Dbprintf("doCotagAcquisition - after init");
print_stack_usage();
}
while ((i < bufsize) && (noise_counter < (COTAG_T1 << 1))) { 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; break;
else else
checker = 0; checker = 0;
@ -530,21 +559,26 @@ void doCotagAcquisition(size_t sample_size) {
uint32_t doCotagAcquisitionManchester(void) { uint32_t doCotagAcquisitionManchester(void) {
uint8_t *dest = BigBuf_get_addr(); uint8_t *dest = BigBuf_get_addr();
uint16_t bufsize = BigBuf_max_traceLen(); uint16_t bufsize = MIN(COTAG_BITS, BigBuf_max_traceLen());
if (bufsize > COTAG_BITS)
bufsize = COTAG_BITS;
dest[0] = 0; dest[0] = 0;
uint8_t firsthigh = 0, firstlow = 0; uint8_t firsthigh = 0, firstlow = 0;
uint16_t sample_counter = 0, period = 0;
uint8_t curr = 0, prev = 0; uint8_t curr = 0, prev = 0;
uint16_t noise_counter = 0; uint16_t sample_counter = 0, period = 0;
uint16_t checker = 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))) { 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; break;
else else
checker = 0; checker = 0;

View file

@ -100,5 +100,6 @@ void setSamplingConfig(sample_config *sc);
sample_config *getSamplingConfig(void); sample_config *getSamplingConfig(void);
void printConfig(void); void printConfig(void);
void printSamples(void);
#endif // __LFSAMPLING_H #endif // __LFSAMPLING_H

View file

@ -10,9 +10,17 @@
{ {
"AID": "D3494F", "AID": "D3494F",
"Vendor": "HID", "Vendor": "HID",
"Country": "United States", "Country": "US",
"Name": "SIO DESFire Ev1", "Name": "SIO DESFire Ev1",
"Description": "", "Description": "Field Encoder",
"Type": "pacs"
},
{
"AID": "D9494F",
"Vendor": "HID",
"Country": "US",
"Name": "Access control",
"Description": "Genuine HID",
"Type": "pacs" "Type": "pacs"
}, },
{ {
@ -321,4 +329,5 @@ FFFFFF General Issuer Information (FIDs 00: MAD Version; 01: Card Holder; 02: Ca
"Description": "CAR2GO - Member Card", "Description": "CAR2GO - Member Card",
"Type": "carsharing" "Type": "carsharing"
} }
] ]

View file

@ -94,7 +94,7 @@ int CmdHFSearch(const char *Cmd) {
int res = PM3_ESOFT; int res = PM3_ESOFT;
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, "Searching for ThinFilm tag..."); PrintAndLogEx(INPLACE, " Searching for ThinFilm tag...");
if (IfPm3NfcBarcode()) { if (IfPm3NfcBarcode()) {
if (infoThinFilm(false) == PM3_SUCCESS) { if (infoThinFilm(false) == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Thinfilm tag") " found\n"); PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Thinfilm tag") " found\n");
@ -103,7 +103,7 @@ int CmdHFSearch(const char *Cmd) {
} }
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, "Searching for LTO-CM tag..."); PrintAndLogEx(INPLACE, " Searching for LTO-CM tag...");
if (IfPm3Iso14443a()) { if (IfPm3Iso14443a()) {
if (infoLTO(false) == PM3_SUCCESS) { if (infoLTO(false) == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LTO-CM tag") " found\n"); PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LTO-CM tag") " found\n");
@ -112,7 +112,7 @@ int CmdHFSearch(const char *Cmd) {
} }
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, "Searching for ISO14443-A tag..."); PrintAndLogEx(INPLACE, " Searching for ISO14443-A tag...");
if (IfPm3Iso14443a()) { if (IfPm3Iso14443a()) {
if (infoHF14A(false, false, false) > 0) { if (infoHF14A(false, false, false) > 0) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-A tag") " found\n"); PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-A tag") " found\n");
@ -121,7 +121,7 @@ int CmdHFSearch(const char *Cmd) {
} }
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, "Searching for ISO15693 tag..."); PrintAndLogEx(INPLACE, " Searching for ISO15693 tag...");
if (IfPm3Iso15693()) { if (IfPm3Iso15693()) {
if (readHF15Uid(false)) { if (readHF15Uid(false)) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO15693 tag") " found\n"); PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO15693 tag") " found\n");
@ -130,7 +130,7 @@ int CmdHFSearch(const char *Cmd) {
} }
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, "Searching for LEGIC tag..."); PrintAndLogEx(INPLACE, " Searching for LEGIC tag...");
if (IfPm3Legicrf()) { if (IfPm3Legicrf()) {
if (readLegicUid(false) == PM3_SUCCESS) { if (readLegicUid(false) == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LEGIC Prime tag") " found\n"); PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LEGIC Prime tag") " found\n");
@ -139,7 +139,7 @@ int CmdHFSearch(const char *Cmd) {
} }
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, "Searching for Topaz tag..."); PrintAndLogEx(INPLACE, " Searching for Topaz tag...");
if (IfPm3Iso14443a()) { if (IfPm3Iso14443a()) {
if (readTopazUid(false) == PM3_SUCCESS) { if (readTopazUid(false) == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Topaz tag") " found\n"); PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Topaz tag") " found\n");
@ -148,7 +148,7 @@ int CmdHFSearch(const char *Cmd) {
} }
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, "Searching for FeliCa tag..."); PrintAndLogEx(INPLACE, " Searching for FeliCa tag...");
if (IfPm3Felica()) { if (IfPm3Felica()) {
if (readFelicaUid(false) == PM3_SUCCESS) { if (readFelicaUid(false) == PM3_SUCCESS) {
PrintAndLogEx(NORMAL, "\nValid " _GREEN_("ISO18092 / FeliCa tag") " found\n"); 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) // 14b and iclass is the longest test (put last)
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, "Searching for CryptoRF tag..."); PrintAndLogEx(INPLACE, " Searching for CryptoRF tag...");
if (IfPm3Iso14443b()) { if (IfPm3Iso14443b()) {
if (readHFCryptoRF(false) == PM3_SUCCESS) { if (readHFCryptoRF(false) == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("CryptoRF tag") " found\n"); 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) // 14b and iclass is the longest test (put last)
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, "Searching for ISO14443-B tag..."); PrintAndLogEx(INPLACE, " Searching for ISO14443-B tag...");
if (IfPm3Iso14443b()) { if (IfPm3Iso14443b()) {
if (readHF14B(false) == 1) { if (readHF14B(false) == 1) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-B tag") " found\n"); PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-B tag") " found\n");
@ -178,7 +178,7 @@ int CmdHFSearch(const char *Cmd) {
} }
PROMPT_CLEARLINE; PROMPT_CLEARLINE;
PrintAndLogEx(INPLACE, "Searching for iClass / PicoPass tag..."); PrintAndLogEx(INPLACE, " Searching for iClass / PicoPass tag...");
if (IfPm3Iclass()) { if (IfPm3Iclass()) {
if (readIclass(false, false) == PM3_SUCCESS) { if (readIclass(false, false) == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iClass tag / PicoPass tag") " found\n"); PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iClass tag / PicoPass tag") " found\n");
@ -231,7 +231,7 @@ int CmdHFTune(const char *Cmd) {
} }
uint16_t volt = resp.data.asDwords[0] & 0xFFFF; 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; mode[0] = 3;

View file

@ -1835,6 +1835,7 @@ static int CmdHF15CSetUID(const char *Cmd) {
} }
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"-----------", CmdHF15Help, AlwaysAvailable, "--------------------- " _CYAN_("General") " ---------------------"},
{"help", CmdHF15Help, AlwaysAvailable, "This help"}, {"help", CmdHF15Help, AlwaysAvailable, "This help"},
{"list", CmdHF15List, AlwaysAvailable, "List ISO15693 history"}, {"list", CmdHF15List, AlwaysAvailable, "List ISO15693 history"},
{"demod", CmdHF15Demod, AlwaysAvailable, "Demodulate ISO15693 from tag"}, {"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)"}, {"samples", CmdHF15Samples, IfPm3Iso15693, "Acquire Samples as Reader (enables carrier, sends inquiry)"},
{"sim", CmdHF15Sim, IfPm3Iso15693, "Fake an ISO15693 tag"}, {"sim", CmdHF15Sim, IfPm3Iso15693, "Fake an ISO15693 tag"},
{"write", CmdHF15Write, IfPm3Iso15693, "Write a block"}, {"write", CmdHF15Write, IfPm3Iso15693, "Write a block"},
{"-----------", CmdHF15Help, IfPm3Iso15693, ""}, {"-----------", CmdHF15Help, IfPm3Iso15693, "----------------------- " _CYAN_("afi") " -----------------------"},
{"findafi", CmdHF15FindAfi, IfPm3Iso15693, "Brute force AFI of an ISO15693 tag"}, {"findafi", CmdHF15FindAfi, IfPm3Iso15693, "Brute force AFI of an ISO15693 tag"},
{"writeafi", CmdHF15WriteAfi, IfPm3Iso15693, "Writes the AFI on an ISO15693 tag"}, {"writeafi", CmdHF15WriteAfi, IfPm3Iso15693, "Writes the AFI on an ISO15693 tag"},
{"writedsfid", CmdHF15WriteDsfid, IfPm3Iso15693, "Writes the DSFID 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"}, {"csetuid", CmdHF15CSetUID, IfPm3Iso15693, "Set UID for magic Chinese card"},
{NULL, NULL, NULL, NULL} {NULL, NULL, NULL, NULL}
}; };

View file

@ -1848,7 +1848,8 @@ int readFelicaUid(bool verbose) {
} }
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"----------- General -----------", CmdHelp, AlwaysAvailable, ""},
{"-----------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("General") " -----------------------"},
{"help", CmdHelp, AlwaysAvailable, "This help"}, {"help", CmdHelp, AlwaysAvailable, "This help"},
{"list", CmdHFFelicaList, AlwaysAvailable, "List ISO 18092/FeliCa history"}, {"list", CmdHFFelicaList, AlwaysAvailable, "List ISO 18092/FeliCa history"},
{"reader", CmdHFFelicaReader, IfPm3Felica, "Act like an ISO18092/FeliCa reader"}, {"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"}, {"raw", CmdHFFelicaCmdRaw, IfPm3Felica, "Send raw hex data to tag"},
{"rdunencrypted", CmdHFFelicaReadWithoutEncryption, IfPm3Felica, "read Block Data from authentication-not-required Service."}, {"rdunencrypted", CmdHFFelicaReadWithoutEncryption, IfPm3Felica, "read Block Data from authentication-not-required Service."},
{"wrunencrypted", CmdHFFelicaWriteWithoutEncryption, IfPm3Felica, "write Block Data to an 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"}, //{"dump", CmdHFFelicaDump, IfPm3Felica, "Wait for and try dumping FeliCa"},
{"rqservice", CmdHFFelicaRequestService, IfPm3Felica, "verify the existence of Area and Service, and to acquire Key Version."}, {"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."}, {"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."}, //{"readv2", CmdHFFelicaNotImplementedYet, IfPm3Felica, "read Block Data from authentication-required Service."},
//{"writev2", CmdHFFelicaNotImplementedYet, IfPm3Felica, "write Block Data to authentication-required Service."}, //{"writev2", CmdHFFelicaNotImplementedYet, IfPm3Felica, "write Block Data to authentication-required Service."},
//{"uprandomid", CmdHFFelicaNotImplementedYet, IfPm3Felica, "update Random ID (IDr)."}, //{"uprandomid", CmdHFFelicaNotImplementedYet, IfPm3Felica, "update Random ID (IDr)."},
{"----------- FeliCa Light -----------", CmdHelp, AlwaysAvailable, ""}, {"-----------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("FeliCa Light") " -----------------------"},
{"litesim", CmdHFFelicaSimLite, IfPm3Felica, "<NDEF2> - only reply to poll request"}, {"litesim", CmdHFFelicaSimLite, IfPm3Felica, "<NDEF2> - only reply to poll request"},
{"litedump", CmdHFFelicaDumpLite, IfPm3Felica, "Wait for and try dumping FelicaLite"}, {"litedump", CmdHFFelicaDumpLite, IfPm3Felica, "Wait for and try dumping FelicaLite"},
// {"sim", CmdHFFelicaSim, IfPm3Felica, "<UID> -- Simulate ISO 18092/FeliCa tag"} // {"sim", CmdHFFelicaSim, IfPm3Felica, "<UID> -- Simulate ISO 18092/FeliCa tag"}

View file

@ -465,13 +465,14 @@ static void mem_app_config(const picopass_hdr *hdr) {
if (applimit < 6) applimit = 26; if (applimit < 6) applimit = 26;
if (kb == 2 && (applimit > 0x1f)) applimit = 26; if (kb == 2 && (applimit > 0x1f)) applimit = 26;
PrintAndLogEx(INFO, "------ " _CYAN_("Memory") "------"); PrintAndLogEx(INFO, "------ " _CYAN_("Memory") " ------");
PrintAndLogEx(INFO, " %u KBits/%u App Areas (%u * 8 bytes) [%02X]", kb, app_areas, max_blk, mem); 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 06-%02X", applimit); PrintAndLogEx(INFO, " AA1 blocks 0x06 - 0x%02X (06 - %02d)", applimit, applimit);
PrintAndLogEx(INFO, " AA2 blocks %02X-%02X", applimit + 1, max_blk); 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, " 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); uint8_t book = isset(mem, 0x20);
if (book) { if (book) {
PrintAndLogEx(INFO, " Read A - Kd"); PrintAndLogEx(INFO, " Read A - Kd");
@ -1419,7 +1420,7 @@ static int CmdHFiClassReader_Dump(const char *Cmd) {
// print the dump // print the dump
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "------+--+-------------------------+----------"); 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); printIclassDumpContents(tag_data, 1, (gotBytes / 8), gotBytes);
if (filename[0] == 0) { if (filename[0] == 0) {
@ -2055,7 +2056,7 @@ static int CmdHFiClassReadTagFile(const char *Cmd) {
uint8_t *csn = dump; uint8_t *csn = dump;
PrintAndLogEx(INFO, "------+--+-------------------------+----------"); 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); printIclassDumpContents(dump, startblock, endblock, bytes_read);
free(dump); free(dump);
return PM3_SUCCESS; return PM3_SUCCESS;
@ -2942,8 +2943,11 @@ int readIclass(bool loop, bool verbose) {
return PM3_EOPABORTED; return PM3_EOPABORTED;
} }
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " --------------------------");
PrintAndLogEx(INFO, "-------------------------------------------------------------");
if (readStatus & FLAG_ICLASS_READER_CSN) { if (readStatus & FLAG_ICLASS_READER_CSN) {
PrintAndLogEx(NORMAL, "\n");
PrintAndLogEx(SUCCESS, " CSN: " _YELLOW_("%s"), sprint_hex(data, 8)); PrintAndLogEx(SUCCESS, " CSN: " _YELLOW_("%s"), sprint_hex(data, 8));
tagFound = true; 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); 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(SUCCESS, " App IA: %s", sprint_hex(data + 8 * 5, 8));
PrintAndLogEx(INFO, "------ " _CYAN_("fingerprint") " ------"); PrintAndLogEx(INFO, "------ " _CYAN_("fingerprint") " ------");
if (isHidRange) { if (isHidRange) {
@ -2982,6 +2988,7 @@ int readIclass(bool loop, bool verbose) {
} }
if (tagFound && !loop) { if (tagFound && !loop) {
PrintAndLogEx(NORMAL, "");
DropField(); DropField();
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -2991,6 +2998,7 @@ int readIclass(bool loop, bool verbose) {
} }
if (!loop) break; if (!loop) break;
} }
PrintAndLogEx(NORMAL, "");
DropField(); DropField();
return res; return res;
} }

View file

@ -4828,6 +4828,7 @@ static int CmdHF14AMfList(const char *Cmd) {
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"}, {"help", CmdHelp, AlwaysAvailable, "This help"},
{"list", CmdHF14AMfList, AlwaysAvailable, "List MIFARE history"}, {"list", CmdHF14AMfList, AlwaysAvailable, "List MIFARE history"},
{"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("recovery") " -----------------------"},
{"darkside", CmdHF14AMfDarkside, IfPm3Iso14443a, "Darkside attack"}, {"darkside", CmdHF14AMfDarkside, IfPm3Iso14443a, "Darkside attack"},
{"nested", CmdHF14AMfNested, IfPm3Iso14443a, "Nested attack"}, {"nested", CmdHF14AMfNested, IfPm3Iso14443a, "Nested attack"},
{"hardnested", CmdHF14AMfNestedHard, AlwaysAvailable, "Nested attack for hardened MIFARE Classic cards"}, {"hardnested", CmdHF14AMfNestedHard, AlwaysAvailable, "Nested attack for hardened MIFARE Classic cards"},
@ -4838,7 +4839,7 @@ static command_t CommandTable[] = {
{"chk", CmdHF14AMfChk, IfPm3Iso14443a, "Check keys"}, {"chk", CmdHF14AMfChk, IfPm3Iso14443a, "Check keys"},
{"fchk", CmdHF14AMfChk_fast, IfPm3Iso14443a, "Check keys fast, targets all keys on card"}, {"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"}, {"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"}, {"auth4", CmdHF14AMfAuth4, IfPm3Iso14443a, "ISO14443-4 AES authentication"},
{"dump", CmdHF14AMfDump, IfPm3Iso14443a, "Dump MIFARE classic tag to binary file"}, {"dump", CmdHF14AMfDump, IfPm3Iso14443a, "Dump MIFARE classic tag to binary file"},
{"mad", CmdHF14AMfMAD, IfPm3Iso14443a, "Checks and prints MAD"}, {"mad", CmdHF14AMfMAD, IfPm3Iso14443a, "Checks and prints MAD"},
@ -4850,7 +4851,7 @@ static command_t CommandTable[] = {
{"wrbl", CmdHF14AMfWrBl, IfPm3Iso14443a, "Write MIFARE classic block"}, {"wrbl", CmdHF14AMfWrBl, IfPm3Iso14443a, "Write MIFARE classic block"},
{"setmod", CmdHf14AMfSetMod, IfPm3Iso14443a, "Set MIFARE Classic EV1 load modulation strength"}, {"setmod", CmdHf14AMfSetMod, IfPm3Iso14443a, "Set MIFARE Classic EV1 load modulation strength"},
// {"sniff", CmdHF14AMfSniff, 0, "Sniff card-reader communication"}, // {"sniff", CmdHF14AMfSniff, 0, "Sniff card-reader communication"},
{"-----------", CmdHelp, IfPm3Iso14443a, ""}, {"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("simulation") " -----------------------"},
{"sim", CmdHF14AMfSim, IfPm3Iso14443a, "Simulate MIFARE card"}, {"sim", CmdHF14AMfSim, IfPm3Iso14443a, "Simulate MIFARE card"},
{"eclr", CmdHF14AMfEClear, IfPm3Iso14443a, "Clear simulator memory"}, {"eclr", CmdHF14AMfEClear, IfPm3Iso14443a, "Clear simulator memory"},
{"eget", CmdHF14AMfEGet, IfPm3Iso14443a, "Get simulator memory block"}, {"eget", CmdHF14AMfEGet, IfPm3Iso14443a, "Get simulator memory block"},
@ -4859,7 +4860,7 @@ static command_t CommandTable[] = {
{"esave", CmdHF14AMfESave, IfPm3Iso14443a, "Save to file emul dump"}, {"esave", CmdHF14AMfESave, IfPm3Iso14443a, "Save to file emul dump"},
{"ecfill", CmdHF14AMfECFill, IfPm3Iso14443a, "Fill simulator memory with help of keys from simulator"}, {"ecfill", CmdHF14AMfECFill, IfPm3Iso14443a, "Fill simulator memory with help of keys from simulator"},
{"ekeyprn", CmdHF14AMfEKeyPrn, IfPm3Iso14443a, "Print keys from simulator memory"}, {"ekeyprn", CmdHF14AMfEKeyPrn, IfPm3Iso14443a, "Print keys from simulator memory"},
{"-----------", CmdHelp, IfPm3Iso14443a, ""}, {"-----------", CmdHelp, IfPm3Iso14443a, "----------------------- " _CYAN_("magic") " -----------------------"},
{"csetuid", CmdHF14AMfCSetUID, IfPm3Iso14443a, "Set UID (magic chinese card)"}, {"csetuid", CmdHF14AMfCSetUID, IfPm3Iso14443a, "Set UID (magic chinese card)"},
{"cwipe", CmdHF14AMfCWipe, IfPm3Iso14443a, "Wipe card to default UID/Sectors/Keys"}, {"cwipe", CmdHF14AMfCWipe, IfPm3Iso14443a, "Wipe card to default UID/Sectors/Keys"},
{"csetblk", CmdHF14AMfCSetBlk, IfPm3Iso14443a, "Write block (magic chinese card)"}, {"csetblk", CmdHF14AMfCSetBlk, IfPm3Iso14443a, "Write block (magic chinese card)"},
@ -4867,7 +4868,7 @@ static command_t CommandTable[] = {
{"cgetsc", CmdHF14AMfCGetSc, IfPm3Iso14443a, "Read sector (magic chinese card)"}, {"cgetsc", CmdHF14AMfCGetSc, IfPm3Iso14443a, "Read sector (magic chinese card)"},
{"cload", CmdHF14AMfCLoad, IfPm3Iso14443a, "Load dump (magic chinese card)"}, {"cload", CmdHF14AMfCLoad, IfPm3Iso14443a, "Load dump (magic chinese card)"},
{"csave", CmdHF14AMfCSave, IfPm3Iso14443a, "Save dump from magic chinese card into file or emulator"}, {"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"}, {"ice", CmdHF14AMfice, IfPm3Iso14443a, "collect MIFARE Classic nonces to file"},
{NULL, NULL, NULL, NULL} {NULL, NULL, NULL, NULL}
}; };

View file

@ -1240,15 +1240,14 @@ static int handler_desfire_signature(uint8_t *signature, size_t *signature_len)
} }
// --- KEY SETTING // --- 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); PrintAndLogEx(SUCCESS, " AID Key settings : 0x%02x", key_settings);
// 2 MSB denotes // 2 MSB denotes
const char *str = " Max key number and type : %d, " _YELLOW_("%s"); const char *str = " Max key number and type : %d, " _YELLOW_("%s");
if (algo == MFDES_ALGO_DES) PrintAndLogEx(SUCCESS, str, "(3)DES"); if (algo == MFDES_ALGO_DES) PrintAndLogEx(SUCCESS, str, num_keys & 0x3F, "(3)DES");
else if (algo == MFDES_ALGO_AES) PrintAndLogEx(SUCCESS, str, "AES"); else if (algo == MFDES_ALGO_AES) PrintAndLogEx(SUCCESS, str, num_keys & 0x3F, "AES");
else if (algo == MFDES_ALGO_3K3DES) PrintAndLogEx(SUCCESS, str, "3K3DES"); 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(SUCCESS, " Max number of keys in AID : %d", num_keys & 0x3F);
PrintAndLogEx(INFO, "-------------------------------------------------------------"); PrintAndLogEx(INFO, "-------------------------------------------------------------");
@ -1449,14 +1448,14 @@ static int handler_desfire_select_application(uint8_t *aid) {
return PM3_SUCCESS; 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); int res = handler_desfire_select_application(aid);
if (res != PM3_SUCCESS) return res; if (res != PM3_SUCCESS) return res;
uint8_t num_keys = 0; *num_keys = 0;
res = handler_desfire_getkeysettings(key_setting, &num_keys); res = handler_desfire_getkeysettings(key_setting, num_keys);
if (res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
switch (num_keys >> 6) { switch (*num_keys >> 6) {
case 0: case 0:
*algo = MFDES_ALGO_DES; *algo = MFDES_ALGO_DES;
break; break;
@ -1863,8 +1862,8 @@ static int getKeySettings(uint8_t *aid) {
// KEY Settings - AMK // KEY Settings - AMK
uint8_t num_keys = 0; uint8_t num_keys = 0;
uint8_t key_setting = 0; uint8_t key_setting = 0;
mifare_des_authalgo_t algo; mifare_des_authalgo_t algo=MFDES_ALGO_DES;
res = key_setting_to_algo(aid, &key_setting, &algo); res = key_setting_to_algo(aid, &key_setting, &algo, &num_keys);
if (res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
// number of Master keys (0x01) // number of Master keys (0x01)
@ -1915,10 +1914,10 @@ static int getKeySettings(uint8_t *aid) {
// KEY Settings - AMK // KEY Settings - AMK
uint8_t num_keys = 0; uint8_t num_keys = 0;
uint8_t key_setting = 0; uint8_t key_setting = 0;
mifare_des_authalgo_t algo; mifare_des_authalgo_t algo=MFDES_ALGO_DES;
res = key_setting_to_algo(aid, &key_setting, &algo); res = key_setting_to_algo(aid, &key_setting, &algo, &num_keys);
if (res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
desfire_print_keysetting(key_setting, algo); desfire_print_keysetting(key_setting, num_keys, algo);
} else { } else {
PrintAndLogEx(WARNING, _RED_(" Can't read Application Master key settings")); PrintAndLogEx(WARNING, _RED_(" Can't read Application Master key settings"));
} }

View file

@ -1088,6 +1088,7 @@ uint32_t GetHF14AMfU_Type(void) {
MF0UNH1001DUx 0004030203000B03 MF0UNH1001DUx 0004030203000B03
NT2L1001G0DUx 0004040102000B03 NT2L1001G0DUx 0004040102000B03
NT2H1001G0DUx 0004040202000B03 NT2H1001G0DUx 0004040202000B03
Micron UL 0034210101000E03
*/ */
if (memcmp(version, "\x00\x04\x03\x01\x01\x00\x0B", 7) == 0) { tagtype = UL_EV1_48; break; } if (memcmp(version, "\x00\x04\x03\x01\x01\x00\x0B", 7) == 0) { tagtype = UL_EV1_48; break; }
@ -1106,6 +1107,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\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\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\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] == 0x04) { tagtype = NTAG; break; }
else if (version[2] == 0x03) { tagtype = UL_EV1; } else if (version[2] == 0x03) { tagtype = UL_EV1; }
break; break;

View file

@ -22,7 +22,6 @@ typedef struct {
uint32_t GetHF14AMfU_Type(void); uint32_t GetHF14AMfU_Type(void);
int ul_print_type(uint32_t tagtype, uint8_t spaces); 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); void printMFUdumpEx(mfu_dump_t *card, uint16_t pages, uint8_t startpage);
int CmdHFMFUltra(const char *Cmd); int CmdHFMFUltra(const char *Cmd);

View file

@ -286,7 +286,7 @@ static int CmdLFTune(const char *Cmd) {
} }
uint32_t volt = resp.data.asDwords[0]; 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; params[0] = 3;
@ -1274,17 +1274,18 @@ int CmdLFfind(const char *Cmd) {
if (demodHID() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("HID Prox ID") " found!"); goto out;} 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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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;} if (demodPac() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("PAC/Stanley ID") " found!"); goto out;}

View file

@ -290,21 +290,21 @@ static int CmdAWIDDemod(const char *Cmd) {
fc = bytebits_to_byte(bits + 9, 8); fc = bytebits_to_byte(bits + 9, 8);
cardnum = bytebits_to_byte(bits + 17, 16); cardnum = bytebits_to_byte(bits + 17, 16);
code1 = bytebits_to_byte(bits + 8, fmtLen); 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 - len: " _GREEN_("%d") " FC: " _GREEN_("%d") " Card: " _GREEN_("%u") " - Wiegand: " _GREEN_("%x") ", Raw: %08x%08x%08x", fmtLen, fc, cardnum, code1, rawHi2, rawHi, rawLo);
break; break;
case 34: case 34:
fc = bytebits_to_byte(bits + 9, 8); fc = bytebits_to_byte(bits + 9, 8);
cardnum = bytebits_to_byte(bits + 17, 24); cardnum = bytebits_to_byte(bits + 17, 24);
code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32));
code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 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 - 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; break;
case 37: case 37:
fc = bytebits_to_byte(bits + 9, 13); fc = bytebits_to_byte(bits + 9, 13);
cardnum = bytebits_to_byte(bits + 22, 18); cardnum = bytebits_to_byte(bits + 22, 18);
code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32));
code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 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 - 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; break;
// case 40: // case 40:
// break; // break;
@ -313,18 +313,18 @@ static int CmdAWIDDemod(const char *Cmd) {
cardnum = bytebits_to_byte(bits + 25, 32); cardnum = bytebits_to_byte(bits + 25, 32);
code1 = bytebits_to_byte(bits + 8, (fmtLen - 32)); code1 = bytebits_to_byte(bits + 8, (fmtLen - 32));
code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 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 - 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; break;
default: default:
if (fmtLen > 32) { if (fmtLen > 32) {
cardnum = bytebits_to_byte(bits + 8 + (fmtLen - 17), 16); cardnum = bytebits_to_byte(bits + 8 + (fmtLen - 17), 16);
code1 = bytebits_to_byte(bits + 8, fmtLen - 32); code1 = bytebits_to_byte(bits + 8, fmtLen - 32);
code2 = bytebits_to_byte(bits + 8 + (fmtLen - 32), 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 - len: " _GREEN_("%d") " -unknown- (%u) - Wiegand: " _GREEN_("%x%08x") ", Raw: %08x%08x%08x", fmtLen, cardnum, code1, code2, rawHi2, rawHi, rawLo);
} else { } else {
cardnum = bytebits_to_byte(bits + 8 + (fmtLen - 17), 16); cardnum = bytebits_to_byte(bits + 8 + (fmtLen - 17), 16);
code1 = bytebits_to_byte(bits + 8, fmtLen); 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 - len: " _GREEN_("%d") " -unknown- (%u) - Wiegand: " _GREEN_("%x") ", Raw: %08x%08x%08x", fmtLen, cardnum, code1, rawHi2, rawHi, rawLo);
} }
break; break;
} }

View file

@ -61,8 +61,8 @@ static int usage_lf_fdx_clone(void) {
PrintAndLogEx(NORMAL, " <Q5> : Specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, " <Q5> : Specify write to Q5 (t5555 instead of t55x7)");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf fdx clone 999 112233"); PrintAndLogEx(NORMAL, _YELLOW_(" lf fdx clone 999 112233"));
PrintAndLogEx(NORMAL, " lf fdx clone 999 112233 16a"); PrintAndLogEx(NORMAL, _YELLOW_(" lf fdx clone 999 112233 16a"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -78,8 +78,8 @@ static int usage_lf_fdx_sim(void) {
PrintAndLogEx(NORMAL, " <extended> : Extended data"); PrintAndLogEx(NORMAL, " <extended> : Extended data");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf fdx sim 999 112233"); PrintAndLogEx(NORMAL, _YELLOW_(" lf fdx sim 999 112233"));
PrintAndLogEx(NORMAL, " lf fdx sim 999 112233 16a"); PrintAndLogEx(NORMAL, _YELLOW_(" lf fdx sim 999 112233 16a"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -247,7 +247,7 @@ int demodFDX(void) {
uint8_t raw[8]; uint8_t raw[8];
num_to_bytes(rawid, 8, raw); 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, "Animal ID " _GREEN_("%04u-%012"PRIu64), countryCode, NationalCode);
PrintAndLogEx(SUCCESS, "National Code " _GREEN_("%012" PRIu64) " (0x%" PRIx64 ")", NationalCode, NationalCode); PrintAndLogEx(SUCCESS, "National Code " _GREEN_("%012" PRIu64) " (0x%" PRIx64 ")", NationalCode, NationalCode);
PrintAndLogEx(SUCCESS, "Country Code %04u", countryCode); PrintAndLogEx(SUCCESS, "Country Code %04u", countryCode);
@ -259,6 +259,8 @@ int demodFDX(void) {
compute_crc(CRC_11784, raw, sizeof(raw), &c[0], &c[1]); 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, "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) { if (g_debugMode) {
PrintAndLogEx(DEBUG, "Start marker %d; Size %zu", preambleIndex, size); PrintAndLogEx(DEBUG, "Start marker %d; Size %zu", preambleIndex, size);
char *bin = sprint_bin_break(DemodBuffer, size, 16); char *bin = sprint_bin_break(DemodBuffer, size, 16);

View file

@ -36,7 +36,7 @@ static int usage_lf_gallagher_clone(void) {
PrintAndLogEx(NORMAL, " b <raw hex> : raw hex data. 12 bytes max"); PrintAndLogEx(NORMAL, " b <raw hex> : raw hex data. 12 bytes max");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf gallagher clone b 0FFD5461A9DA1346B2D1AC32 "); PrintAndLogEx(NORMAL, _YELLOW_(" lf gallagher clone b 0FFD5461A9DA1346B2D1AC32"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -127,10 +127,10 @@ static int CmdGallagherDemod(const char *Cmd) {
// 4bit issue level // 4bit issue level
uint8_t il = arr[7] & 0x0F; 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, "GALLAGHER - Region: " _GREEN_("%u") " FC: " _GREEN_("%u") " CN: " _GREEN_("%u") " Issue Level: " _GREEN_("%u"), rc, fc, cn, il);
PrintAndLogEx(SUCCESS, " Printed: %C%u", rc + 0x40, fc); PrintAndLogEx(SUCCESS, " Printed: " _GREEN_("%C%u"), rc + 0x40, fc);
PrintAndLogEx(SUCCESS, " Raw: %08X%08X%08X", raw1, raw2, raw3); 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; return PM3_SUCCESS;
} }

View file

@ -38,7 +38,7 @@ static int usage_lf_guard_clone(void) {
PrintAndLogEx(NORMAL, " <Card Number> : 16-bit value card number"); PrintAndLogEx(NORMAL, " <Card Number> : 16-bit value card number");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf gprox clone 26 123 11223"); PrintAndLogEx(NORMAL, _YELLOW_(" lf gprox clone 26 123 11223"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -55,7 +55,7 @@ static int usage_lf_guard_sim(void) {
PrintAndLogEx(NORMAL, " <Card Number> : 16-bit value card number"); PrintAndLogEx(NORMAL, " <Card Number> : 16-bit value card number");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf gprox sim 26 123 11223"); PrintAndLogEx(NORMAL, _YELLOW_(" lf gprox sim 26 123 11223"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -139,9 +139,9 @@ static int CmdGuardDemod(const char *Cmd) {
break; break;
} }
if (!unknown) 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 - len: " _GREEN_("%u")" FC: " _GREEN_("%u") " Card: " _GREEN_("%u") ", Raw: %08x%08x%08x", fmtLen, FC, Card, raw1, raw2, raw3);
else else
PrintAndLogEx(SUCCESS, "Unknown G-Prox-II Fmt Found: Format Len: %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; return PM3_SUCCESS;
} }

View file

@ -51,6 +51,7 @@ static int usage_lf_hid_watch(void) {
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, _YELLOW_(" lf hid watch")); PrintAndLogEx(NORMAL, _YELLOW_(" lf hid watch"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static int usage_lf_hid_sim(void) { 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, " ID - HID id");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, _YELLOW_(" lf hid sim 2006ec0c86")); PrintAndLogEx(NORMAL, _YELLOW_(" lf hid sim 2006ec0c86"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static int usage_lf_hid_clone(void) { static int usage_lf_hid_clone(void) {
@ -76,6 +78,7 @@ static int usage_lf_hid_clone(void) {
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, _YELLOW_(" lf hid clone 2006ec0c86")); PrintAndLogEx(NORMAL, _YELLOW_(" lf hid clone 2006ec0c86"));
PrintAndLogEx(NORMAL, _YELLOW_(" lf hid clone l 2006ec0c86")); PrintAndLogEx(NORMAL, _YELLOW_(" lf hid clone l 2006ec0c86"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static int usage_lf_hid_brute(void) { 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 224"));
PrintAndLogEx(NORMAL, _YELLOW_(" lf hid brute w H10301 f 21 d 2000")); 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, _YELLOW_(" lf hid brute v w H10301 f 21 c 200 d 2000"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -195,7 +199,7 @@ static int CmdHIDDemod(const char *Cmd) {
} }
if (hi2 != 0) { //extra large HID tags 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 } else { //standard HID tags <38 bits
uint8_t fmtLen = 0; uint8_t fmtLen = 0;
uint32_t cc = 0; uint32_t cc = 0;
@ -241,9 +245,11 @@ static int CmdHIDDemod(const char *Cmd) {
fc = ((hi & 0xF) << 12) | (lo >> 20); fc = ((hi & 0xF) << 12) | (lo >> 20);
} }
if (fmtLen == 32 && (lo & 0x40000000)) { //if 32 bit and Kastle bit set 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 { } 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); hi, lo, cardnum, fmtLen, oem, fc, cardnum);
} }
} }

View file

@ -572,6 +572,7 @@ static int CmdLFHitagReader(const char *Cmd) {
// No additional parameters needed // No additional parameters needed
break; break;
} }
default:
case RHT1F_PLAIN: case RHT1F_PLAIN:
case RHT1F_AUTHENTICATE: case RHT1F_AUTHENTICATE:
case WHTSF_CHALLENGE: case WHTSF_CHALLENGE:
@ -584,7 +585,7 @@ static int CmdLFHitagReader(const char *Cmd) {
clearCommandBuffer(); clearCommandBuffer();
SendCommandMIX(cmd, htf, 0, 0, &htd, sizeof(htd)); SendCommandMIX(cmd, htf, 0, 0, &htd, sizeof(htd));
PacketResponseNG resp; PacketResponseNG resp;
if (!WaitForResponseTimeout(CMD_ACK, &resp, 4000)) { if (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
PrintAndLogEx(WARNING, "timeout while waiting for reply."); PrintAndLogEx(WARNING, "timeout while waiting for reply.");
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
@ -680,6 +681,7 @@ static int CmdLFHitagWriter(const char *Cmd) {
num_to_bytes(param_get32ex(Cmd, 3, 0, 16), 4, htd.crypto.data); num_to_bytes(param_get32ex(Cmd, 3, 0, 16), 4, htd.crypto.data);
break; break;
} }
default:
case RHT1F_PLAIN: case RHT1F_PLAIN:
case RHT1F_AUTHENTICATE: case RHT1F_AUTHENTICATE:
case RHTSF_CHALLENGE: case RHTSF_CHALLENGE:

View file

@ -50,10 +50,11 @@ static int usage_lf_indala_demod(void) {
PrintAndLogEx(NORMAL, " maxerror : Set maximum allowed errors, default = 100."); PrintAndLogEx(NORMAL, " maxerror : Set maximum allowed errors, default = 100.");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf indala demod"); PrintAndLogEx(NORMAL, _YELLOW_(" lf indala demod"));
PrintAndLogEx(NORMAL, " lf indala demod 32 = demod a Indala tag from GraphBuffer using a clock of RF/32"); PrintAndLogEx(NORMAL, _YELLOW_(" 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, _YELLOW_(" 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 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; return PM3_SUCCESS;
} }
@ -68,7 +69,8 @@ static int usage_lf_indala_sim(void) {
PrintAndLogEx(NORMAL, " c <cardnum> : Cardnumber for Heden 2L format (decimal)"); PrintAndLogEx(NORMAL, " c <cardnum> : Cardnumber for Heden 2L format (decimal)");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf indala sim deadc0de"); PrintAndLogEx(NORMAL, _YELLOW_(" lf indala sim deadc0de"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -143,7 +145,7 @@ static void decodeHeden2L(uint8_t *bits) {
if (bits[offset + 7]) cardnumber += 16384; if (bits[offset + 7]) cardnumber += 16384;
if (bits[offset + 23]) cardnumber += 32768; if (bits[offset + 23]) cardnumber += 32768;
PrintAndLogEx(SUCCESS, "\tHeden-2L | " _YELLOW_("%u"), cardnumber); PrintAndLogEx(SUCCESS, "\tHeden-2L | " _GREEN_("%u"), cardnumber);
} }
// Indala 26 bit decode // Indala 26 bit decode
@ -193,13 +195,7 @@ static int CmdIndalaDemod(const char *Cmd) {
uint64_t foo = uid2 & 0x7FFFFFFF; uint64_t foo = uid2 & 0x7FFFFFFF;
if (DemodBufferLen == 64) { if (DemodBufferLen == 64) {
PrintAndLogEx( PrintAndLogEx(SUCCESS, "Indala - len %zu, Raw: %x%08x", DemodBufferLen, uid1, uid2);
SUCCESS
, "Indala Found - bitlength %zu, Raw " _YELLOW_("%x%08x")
, DemodBufferLen
, uid1
, uid2
);
uint16_t p1 = 0; uint16_t p1 = 0;
p1 |= DemodBuffer[32 + 3] << 8; p1 |= DemodBuffer[32 + 3] << 8;
@ -246,8 +242,7 @@ static int CmdIndalaDemod(const char *Cmd) {
checksum |= DemodBuffer[62] << 1; // b2 checksum |= DemodBuffer[62] << 1; // b2
checksum |= DemodBuffer[63] << 0; // b1 checksum |= DemodBuffer[63] << 0; // b1
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(SUCCESS, "Fmt " _GREEN_("26") " FC: " _GREEN_("%u") " Card: " _GREEN_("%u") " checksum: " _GREEN_("%1d%1d")
PrintAndLogEx(SUCCESS, "Fmt 26 bit FC " _YELLOW_("%u") ", CN " _YELLOW_("%u") ", checksum " _YELLOW_("%1d%1d")
, fc , fc
, csn , csn
, checksum >> 1 & 0x01 , checksum >> 1 & 0x01
@ -267,7 +262,7 @@ static int CmdIndalaDemod(const char *Cmd) {
uint32_t uid7 = bytebits_to_byte(DemodBuffer + 192, 32); uint32_t uid7 = bytebits_to_byte(DemodBuffer + 192, 32);
PrintAndLogEx( PrintAndLogEx(
SUCCESS SUCCESS
, "Indala Found - bitlength %zu, Raw 0x%x%08x%08x%08x%08x%08x%08x" , "Indala - len %zu, Raw: %x%08x%08x%08x%08x%08x%08x"
, DemodBufferLen , DemodBufferLen
, uid1 , uid1
, uid2 , uid2
@ -564,10 +559,10 @@ static int CmdIndalaClone(const char *Cmd) {
CLIParserInit(&ctx, "lf indala clone", CLIParserInit(&ctx, "lf indala clone",
"clone INDALA tag to T55x7 (or to q5/T5555)", "clone INDALA tag to T55x7 (or to q5/T5555)",
"Examples:\n" "Examples:\n"
"\tlf indala clone --heden 888\n" _YELLOW_("\tlf indala clone --heden 888\n")
"\tlf indala clone --fc 123 --cn 1337\n" _YELLOW_("\tlf indala clone --fc 123 --cn 1337\n")
"\tlf indala clone -r a0000000a0002021\n" _YELLOW_("\tlf indala clone -r a0000000a0002021\n")
"\tlf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5"); _YELLOW_("\tlf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5"));
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,

View file

@ -37,6 +37,7 @@ static int usage_lf_io_watch(void) {
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, _YELLOW_(" lf io watch")); PrintAndLogEx(NORMAL, _YELLOW_(" lf io watch"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -47,12 +48,13 @@ static int usage_lf_io_sim(void) {
PrintAndLogEx(NORMAL, "Usage: lf io sim [h] <version> <facility-code> <card-number>"); PrintAndLogEx(NORMAL, "Usage: lf io sim [h] <version> <facility-code> <card-number>");
PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h : This help"); PrintAndLogEx(NORMAL, " h : This help");
PrintAndLogEx(NORMAL, " <version> : 8bit version (decimal)"); PrintAndLogEx(NORMAL, " <version> : 8bit version (" _YELLOW_("decimal") ")");
PrintAndLogEx(NORMAL, " <facility-code> : 8bit value facility code (hex)"); PrintAndLogEx(NORMAL, " <facility-code> : 8bit value facility code (" _YELLOW_("hex") ")");
PrintAndLogEx(NORMAL, " <card number> : 16bit value card number (decimal)"); PrintAndLogEx(NORMAL, " <card number> : 16bit value card number (" _YELLOW_("decimal") ")");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, _YELLOW_(" lf io sim 26 101 1337")); PrintAndLogEx(NORMAL, _YELLOW_(" lf io sim 01 101 1337"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -63,13 +65,14 @@ static int usage_lf_io_clone(void) {
PrintAndLogEx(NORMAL, "Usage: lf io clone [h] <version> <facility-code> <card-number> [Q5]"); PrintAndLogEx(NORMAL, "Usage: lf io clone [h] <version> <facility-code> <card-number> [Q5]");
PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, "Options:");
PrintAndLogEx(NORMAL, " h : This help"); PrintAndLogEx(NORMAL, " h : This help");
PrintAndLogEx(NORMAL, " <version> : 8bit version (decimal)"); PrintAndLogEx(NORMAL, " <version> : 8bit version (" _YELLOW_("decimal") ")");
PrintAndLogEx(NORMAL, " <facility-code> : 8bit value facility code (hex)"); PrintAndLogEx(NORMAL, " <facility-code> : 8bit value facility code (" _YELLOW_("hex") ")");
PrintAndLogEx(NORMAL, " <card number> : 16bit value card number (decimal)"); PrintAndLogEx(NORMAL, " <card number> : 16bit value card number (" _YELLOW_("decimal") ")");
PrintAndLogEx(NORMAL, " Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); PrintAndLogEx(NORMAL, " Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, _YELLOW_(" lf io clone 26 101 1337")); PrintAndLogEx(NORMAL, _YELLOW_(" lf io clone 01 101 1337"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -166,22 +169,21 @@ static int CmdIOProxDemod(const char *Cmd) {
calccrc &= 0xff; calccrc &= 0xff;
calccrc = 0xff - calccrc; calccrc = 0xff - calccrc;
char crcStr[30]; char crc_str[30] = {0};
memset(crcStr, 0x00, sizeof(crcStr));
if (crc == calccrc) { if (crc == calccrc) {
snprintf(crcStr, 3, "ok"); snprintf(crc_str, sizeof(crc_str), "(" _GREEN_("ok") ")" );
} else { } else {
PrintAndLogEx(DEBUG, "DEBUG: Error - IO prox crc failed"); snprintf(crc_str, sizeof(crc_str), "(" _RED_("fail") ") 0x%02X != 0x%02X", crc, calccrc);
snprintf(crcStr, sizeof(crcStr), "failed 0x%02X != 0x%02X", crc, calccrc);
retval = PM3_ESOFT; 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 - " _GREEN_("XSF(%02d)%02x:%05d") ", Raw: %08x%08x %s", version, facilitycode, number, code, code2, crc_str);
if (g_debugMode) { 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); PrintAndLogEx(DEBUG, "DEBUG: IO prox idx: %d, Len: %zu, Printing demod buffer:", idx, size);
printDemodBuff(); printDemodBuff();
} }

View file

@ -38,7 +38,8 @@ static int usage_lf_jablotron_clone(void) {
PrintAndLogEx(NORMAL, " <Q5> : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, " <Q5> : specify write to Q5 (t5555 instead of t55x7)");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf jablotron clone 112233"); PrintAndLogEx(NORMAL, _YELLOW_(" lf jablotron clone 112233"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -52,7 +53,8 @@ static int usage_lf_jablotron_sim(void) {
PrintAndLogEx(NORMAL, " <card ID> : jablotron card ID"); PrintAndLogEx(NORMAL, " <card ID> : jablotron card ID");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf jablotron sim 112233"); PrintAndLogEx(NORMAL, _YELLOW_(" lf jablotron sim 112233"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -79,7 +81,10 @@ static uint64_t getJablontronCardId(uint64_t rawcode) {
//see ASKDemod for what args are accepted //see ASKDemod for what args are accepted
static int CmdJablotronDemod(const char *Cmd) { static int CmdJablotronDemod(const char *Cmd) {
(void)Cmd; // Cmd is not used so far (void)Cmd; // Cmd is not used so far
return demodJablotron();
}
int demodJablotron(void) {
//Differential Biphase / di-phase (inverted biphase) //Differential Biphase / di-phase (inverted biphase)
//get binary from ask wave //get binary from ask wave
if (ASKbiphaseDemod("0 64 1 0", false) != PM3_SUCCESS) { if (ASKbiphaseDemod("0 64 1 0", false) != PM3_SUCCESS) {
@ -115,20 +120,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 rawid = ((uint64_t)(bytebits_to_byte(DemodBuffer + 16, 8) & 0xff) << 32) | bytebits_to_byte(DemodBuffer + 24, 32);
uint64_t id = getJablontronCardId(rawid); 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; uint8_t chksum = raw2 & 0xFF;
bool isok = (chksum == jablontron_chksum(DemodBuffer)); bool isok = (chksum == jablontron_chksum(DemodBuffer));
PrintAndLogEx(isok ? SUCCESS : INFO, PrintAndLogEx(DEBUG, "Checksum: %02X (%s)", chksum, isok ? _GREEN_("ok") : _RED_("Fail"));
"Checksum: %02X [%s]",
chksum,
isok ? _GREEN_("OK") : _RED_("Fail")
);
id = DEC2BCD(id); id = DEC2BCD(id);
// Printed format: 1410-nn-nnnn-nnnn // 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, (uint8_t)(id >> 32) & 0xFF,
(uint16_t)(id >> 16) & 0xFFFF, (uint16_t)(id >> 16) & 0xFFFF,
(uint16_t)id & 0xFFFF (uint16_t)id & 0xFFFF
@ -137,8 +138,8 @@ static int CmdJablotronDemod(const char *Cmd) {
} }
static int CmdJablotronRead(const char *Cmd) { static int CmdJablotronRead(const char *Cmd) {
lf_read(true, 10000); lf_read(false, 16000);
return CmdJablotronDemod(Cmd); return demodJablotron();
} }
static int CmdJablotronClone(const char *Cmd) { static int CmdJablotronClone(const char *Cmd) {
@ -280,6 +281,3 @@ int detectJablotron(uint8_t *bits, size_t *size) {
return (int)startIdx; return (int)startIdx;
} }
int demodJablotron(void) {
return CmdJablotronDemod("");
}

View file

@ -41,10 +41,10 @@ static int usage_lf_keri_clone(void) {
PrintAndLogEx(NORMAL, " <c> <cn> : Card Number"); PrintAndLogEx(NORMAL, " <c> <cn> : Card Number");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf keri clone 112233"); PrintAndLogEx(NORMAL, _YELLOW_(" lf keri clone 112233"));
PrintAndLogEx(NORMAL, " lf keri clone type ms fc 6 cn 12345"); PrintAndLogEx(NORMAL, _YELLOW_(" 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 t m f 6 c 12345"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -58,7 +58,8 @@ static int usage_lf_keri_sim(void) {
PrintAndLogEx(NORMAL, " <id> : Keri Internal ID"); PrintAndLogEx(NORMAL, " <id> : Keri Internal ID");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf keri sim 112233"); PrintAndLogEx(NORMAL, _YELLOW_(" lf keri sim 112233"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -129,7 +130,7 @@ static int CmdKeriMSScramble(KeriMSScramble_t Action, uint32_t *FC, uint32_t *ID
// Bit 31 was fixed but not in check/parity bits // Bit 31 was fixed but not in check/parity bits
*CardID |= 1UL << 31; *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; return PM3_SUCCESS;
} }
@ -184,8 +185,7 @@ static int CmdKeriDemod(const char *Cmd) {
Might be a hash of FC & CN to generate Internal ID Might be a hash of FC & CN to generate Internal ID
*/ */
PrintAndLogEx(SUCCESS, "KERI Tag Found -- Internal ID: %u", ID); PrintAndLogEx(SUCCESS, "KERI - Internal ID: " _GREEN_("%u") ", Raw: %08X%08X" , ID, raw1, raw2);
PrintAndLogEx(SUCCESS, "Raw: %08X%08X", raw1, raw2);
/* /*
Descramble Data. Descramble Data.
*/ */
@ -195,7 +195,7 @@ static int CmdKeriDemod(const char *Cmd) {
// Just need to the low 32 bits without the 111 trailer // Just need to the low 32 bits without the 111 trailer
CmdKeriMSScramble(Descramble, &fc, &cardid, &raw2); 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) { if (invert) {
PrintAndLogEx(INFO, "Had to Invert - probably KERI"); PrintAndLogEx(INFO, "Had to Invert - probably KERI");

View file

@ -30,6 +30,11 @@ static int CmdHelp(const char *Cmd);
//see PSKDemod for what args are accepted //see PSKDemod for what args are accepted
static int CmdMotorolaDemod(const char *Cmd) { static int CmdMotorolaDemod(const char *Cmd) {
(void)Cmd;
return demodMotorola();
}
int demodMotorola(void) {
//PSK1 //PSK1
if (PSKDemod("32 1", true) != PM3_SUCCESS) { if (PSKDemod("32 1", true) != PM3_SUCCESS) {
@ -113,10 +118,9 @@ static int CmdMotorolaDemod(const char *Cmd) {
checksum |= DemodBuffer[62] << 1; // b2 checksum |= DemodBuffer[62] << 1; // b2
checksum |= DemodBuffer[63] << 0; // b1 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; return PM3_SUCCESS;
} }
@ -141,7 +145,7 @@ static int CmdMotorolaRead(const char *Cmd) {
sc.divisor = LF_DIVISOR_125; sc.divisor = LF_DIVISOR_125;
sc.samples_to_skip = 0; sc.samples_to_skip = 0;
lf_config(&sc); lf_config(&sc);
return CmdMotorolaDemod(Cmd); return demodMotorola();
} }
static int CmdMotorolaClone(const char *Cmd) { static int CmdMotorolaClone(const char *Cmd) {
@ -156,7 +160,7 @@ static int CmdMotorolaClone(const char *Cmd) {
"defaults to 64.\n", "defaults to 64.\n",
"\n" "\n"
"Samples:\n" "Samples:\n"
"\tlf motorola clone a0000000a0002021\n" _YELLOW_("\tlf motorola clone a0000000a0002021") "\n"
); );
void *argtable[] = { void *argtable[] = {
@ -253,10 +257,6 @@ int detectMotorola(uint8_t *dest, size_t *size) {
return (int)start_idx; return (int)start_idx;
} }
int demodMotorola(void) {
return CmdMotorolaDemod("");
}
int readMotorolaUid(void) { int readMotorolaUid(void) {
return (CmdMotorolaRead("") == PM3_SUCCESS); return (CmdMotorolaRead("") == PM3_SUCCESS);
} }

View file

@ -41,7 +41,8 @@ static int usage_lf_nedap_gen(void) {
PrintAndLogEx(NORMAL, " l : optional - long (128), default to short (64)"); PrintAndLogEx(NORMAL, " l : optional - long (128), default to short (64)");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); 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"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -58,7 +59,8 @@ static int usage_lf_nedap_clone(void) {
// PrintAndLogEx(NORMAL, " Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip"); // PrintAndLogEx(NORMAL, " Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); 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"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -76,7 +78,8 @@ static int usage_lf_nedap_sim(void) {
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
// TODO proper example? // 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"));
PrintAndLogEx(NORMAL, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -172,7 +175,7 @@ static int CmdLFNedapDemod(const char *Cmd) {
customerCode = ((data[1] & 0x01) << 11) | (data[2] << 3) | ((data[3] & 0xe0) >> 5); customerCode = ((data[1] & 0x01) << 11) | (data[2] << 3) | ((data[3] & 0xe0) >> 5);
if (isValid == false) { 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; ret = PM3_ESOFT;
} }
@ -192,9 +195,9 @@ static int CmdLFNedapDemod(const char *Cmd) {
badgeId = r1 * 10000 + r2 * 1000 + r3 * 100 + r4 * 10 + r5; 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, "NEDAP - Card: " _YELLOW_("%05u") " subtype: " _YELLOW_("%1u")" customer code: " _YELLOW_("%03x") ", Raw: %s", badgeId, subtype, customerCode, sprint_hex(data, size / 8));
PrintAndLogEx(SUCCESS, "Checksum is %s (0x%04X)", _GREEN_("OK"), checksum); PrintAndLogEx(DEBUG, "Checksum (%s) 0x%04X", _GREEN_("ok"), checksum);
PrintAndLogEx(SUCCESS, "Raw: %s", sprint_hex(data, size / 8));
} else { } else {
PrintAndLogEx(ERR, "Invalid idx (1:%02x - 2:%02x - 3:%02x - 4:%02x - 5:%02x)", idxC1, idxC2, idxC3, idxC4, idxC5); PrintAndLogEx(ERR, "Invalid idx (1:%02x - 2:%02x - 3:%02x - 4:%02x - 5:%02x)", idxC1, idxC2, idxC3, idxC4, idxC5);
ret = PM3_ESOFT; ret = PM3_ESOFT;
@ -239,7 +242,7 @@ static int CmdLFNedapDemod(const char *Cmd) {
if (!r0 && (r1 < 10) && (r2 < 10) && (r3 < 10) && (r4 < 10) && (r5 < 10)) { if (!r0 && (r1 < 10) && (r2 < 10) && (r3 < 10) && (r4 < 10) && (r5 < 10)) {
badgeId = r1 * 10000 + r2 * 1000 + r3 * 100 + r4 * 10 + r5; 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)) if ((fixed0 == FIXED_71) && (fixed1 == FIXED_40))
PrintAndLogEx(DEBUG, "Fixed part {0 = 0x%02x, 1 = 0x%02x}", fixed0, fixed1); PrintAndLogEx(DEBUG, "Fixed part {0 = 0x%02x, 1 = 0x%02x}", fixed0, fixed1);

View file

@ -46,9 +46,9 @@ static int usage_lf_nexwatch_clone(void) {
PrintAndLogEx(NORMAL, " q : Quadrakey credential"); PrintAndLogEx(NORMAL, " q : Quadrakey credential");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf nexwatch clone r 5600000000213C9F8F150C"); PrintAndLogEx(NORMAL, _YELLOW_(" lf nexwatch clone r 5600000000213C9F8F150C"));
PrintAndLogEx(NORMAL, " lf nexwatch clone c 521512301 m 1 n -- Nexkey credential"); PrintAndLogEx(NORMAL, _YELLOW_(" 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 c 521512301 m 1 q") " -- Quadrakey credential");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -68,9 +68,9 @@ static int usage_lf_nexwatch_sim(void) {
PrintAndLogEx(NORMAL, " q : Quadrakey credential"); PrintAndLogEx(NORMAL, " q : Quadrakey credential");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf nexwatch sim r 5600000000213C9F8F150C"); PrintAndLogEx(NORMAL, _YELLOW_(" lf nexwatch sim r 5600000000213C9F8F150C"));
PrintAndLogEx(NORMAL, " lf nexwatch sim c 521512301 m 1 n -- Nexkey credential"); PrintAndLogEx(NORMAL, _YELLOW_(" 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 c 521512301 m 1 q") " -- Quadrakey credential");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -244,18 +244,16 @@ int demodNexWatch(void) {
} }
PrintAndLogEx(SUCCESS, " 88bit id : " _YELLOW_("%"PRIu32) " (" _YELLOW_("0x%"PRIx32)")", cn, cn); PrintAndLogEx(SUCCESS, " 88bit id : " _YELLOW_("%"PRIu32) " (" _YELLOW_("0x%"PRIx32)")", cn, cn);
PrintAndLogEx(SUCCESS, " mode : %x", mode); PrintAndLogEx(SUCCESS, " mode : %x", mode);
if (parity == calc_parity) { if (parity == calc_parity) {
PrintAndLogEx(SUCCESS, " parity : %s (0x%X)", _GREEN_("ok"), parity); PrintAndLogEx(DEBUG, " parity : %s (0x%X)", _GREEN_("ok"), parity);
} else { } else {
PrintAndLogEx(WARNING, " parity : %s (0x%X != 0x%X)", _RED_("fail"), parity, calc_parity); PrintAndLogEx(DEBUG, " 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); 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; return PM3_SUCCESS;
} }

View file

@ -35,7 +35,7 @@ static int usage_lf_noralsy_clone(void) {
PrintAndLogEx(NORMAL, " <Q5> : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, " <Q5> : specify write to Q5 (t5555 instead of t55x7)");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf noralsy clone 112233"); PrintAndLogEx(NORMAL, _YELLOW_(" lf noralsy clone 112233"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -50,7 +50,7 @@ static int usage_lf_noralsy_sim(void) {
PrintAndLogEx(NORMAL, " <year> : Tag allocation year"); PrintAndLogEx(NORMAL, " <year> : Tag allocation year");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf noralsy sim 112233"); PrintAndLogEx(NORMAL, _YELLOW_(" lf noralsy sim 112233"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -124,7 +124,7 @@ static int CmdNoralsyDemod(const char *Cmd) {
return PM3_ESOFT; 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) { if (raw1 != 0xBB0214FF) {
PrintAndLogEx(WARNING, "Unknown bits set in first block! Expected 0xBB0214FF, Found: 0x%08X", raw1); 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"); PrintAndLogEx(WARNING, "Please post this output in forum to further research on this format");

View file

@ -37,8 +37,8 @@ static int usage_lf_pac_clone(void) {
PrintAndLogEx(NORMAL, " b <raw hex> : raw hex data. 16 bytes max"); PrintAndLogEx(NORMAL, " b <raw hex> : raw hex data. 16 bytes max");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf pac clone c CD4F5552 "); PrintAndLogEx(NORMAL, _YELLOW_(" lf pac clone c CD4F5552 "));
PrintAndLogEx(NORMAL, " lf pac clone b FF2049906D8511C593155B56D5B2649F "); PrintAndLogEx(NORMAL, _YELLOW_(" lf pac clone b FF2049906D8511C593155B56D5B2649F "));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
static int usage_lf_pac_sim(void) { static int usage_lf_pac_sim(void) {
@ -51,7 +51,7 @@ static int usage_lf_pac_sim(void) {
PrintAndLogEx(NORMAL, " <Card ID> : 8 byte PAC/Stanley card id"); PrintAndLogEx(NORMAL, " <Card ID> : 8 byte PAC/Stanley card id");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf pac sim 12345678"); PrintAndLogEx(NORMAL, _YELLOW_(" lf pac sim 12345678"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
// by danshuk // by danshuk
@ -176,7 +176,7 @@ static int CmdPacDemod(const char *Cmd) {
int retval = demodbuf_to_pacid(DemodBuffer, DemodBufferLen, cardid, sizeof(cardid)); int retval = demodbuf_to_pacid(DemodBuffer, DemodBufferLen, cardid, sizeof(cardid));
if (retval == PM3_SUCCESS) 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; return retval;
} }

View file

@ -24,6 +24,7 @@
#include "lfdemod.h" #include "lfdemod.h"
#include "protocols.h" // t55xx defines #include "protocols.h" // t55xx defines
#include "cmdlft55xx.h" // clone.. #include "cmdlft55xx.h" // clone..
#include "crc.h" // maxim
static int CmdHelp(const char *Cmd); static int CmdHelp(const char *Cmd);
@ -36,7 +37,7 @@ static int usage_lf_paradox_clone(void) {
PrintAndLogEx(NORMAL, " b <raw hex> : raw hex data. 12 bytes max"); PrintAndLogEx(NORMAL, " b <raw hex> : raw hex data. 12 bytes max");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf paradox clone b 0f55555695596a6a9999a59a"); PrintAndLogEx(NORMAL, _YELLOW_(" lf paradox clone b 0f55555695596a6a9999a59a"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -53,16 +54,33 @@ static int usage_lf_paradox_sim(void) {
PrintAndLogEx(NORMAL, " <Card Number> : 16-bit value card number"); PrintAndLogEx(NORMAL, " <Card Number> : 16-bit value card number");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf paradox sim 123 11223"); PrintAndLogEx(NORMAL, _YELLOW_(" lf paradox sim 123 11223"));
return PM3_SUCCESS; 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 //by marshmellow
//Paradox Prox demod - FSK2a RF/50 with preamble of 00001111 (then manchester encoded) //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 //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 //raw fsk demod no manchester decoding no start bit finding just get binary from wave
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0}; uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0};
size_t size = getFromGraphBuf(bits); size_t size = getFromGraphBuf(bits);
@ -71,12 +89,10 @@ static int CmdParadoxDemod(const char *Cmd) {
return PM3_ESOFT; return PM3_ESOFT;
} }
uint32_t hi2 = 0, hi = 0, lo = 0; int wave_idx = 0;
int waveIdx = 0;
//get binary from fsk wave //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 < 0) {
if (idx == -1) if (idx == -1)
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples"); PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox not enough samples");
else if (idx == -2) else if (idx == -2)
@ -85,16 +101,52 @@ static int CmdParadoxDemod(const char *Cmd) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox problem during FSK demod"); PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox problem during FSK demod");
else if (idx == -4) else if (idx == -4)
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox preamble not found"); 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 else
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error demoding fsk %d", idx); PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox error demoding fsk %d", idx);
return PM3_ESOFT; 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); setDemodBuff(bits, size, idx);
setClockGrid(50, waveIdx + (idx * 50)); setClockGrid(50, wave_idx + (idx * 50));
if (hi2 == 0 && hi == 0 && lo == 0) { if (hi2 == 0 && hi == 0 && lo == 0) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Paradox no value found"); 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 fc = ((hi & 0x3) << 6) | (lo >> 26);
uint32_t cardnum = (lo >> 10) & 0xFFFF; 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 rawLo = bytebits_to_byte(bits + idx + 64, 32);
uint32_t rawHi = bytebits_to_byte(bits + idx + 32, 32); uint32_t rawHi = bytebits_to_byte(bits + idx + 32, 32);
uint32_t rawHi2 = bytebits_to_byte(bits + idx, 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 - ID: " _GREEN_("%x%08x") " FC: " _GREEN_("%d") " Card: " _GREEN_("%d") ", Checksum: %02x, Raw: %08x%08x%08x",
hi >> 10, hi >> 10,
(hi & 0x3) << 26 | (lo >> 10), (hi & 0x3) << 26 | (lo >> 10),
fc, cardnum, fc,
(lo >> 2) & 0xFF, cardnum,
chksum,
rawHi2, rawHi2,
rawHi, rawHi,
rawLo rawLo
@ -244,43 +322,25 @@ int CmdLFParadox(const char *Cmd) {
} }
// loop to get raw paradox waveform then FSK demodulate the TAG ID from it // 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 //make sure buffer has data
if (*size < 96 * 50) return -1; if (*size < 96 * 50) return -1;
if (getSignalProperties()->isnoise) return -2; if (getSignalProperties()->isnoise) return -2;
// FSK demodulator // 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? //did we get a good demod?
if (*size < 96) return -3; if (*size < 96) return -3;
// 00001111 bit pattern represent start of frame, 01 pattern represents a 0 and 10 represents a 1 // 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}; 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 return -4; //preamble not found
size_t numStart = startIdx + sizeof(preamble); return (int)idx;
// 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;
} }
int demodParadox(void) {
return CmdParadoxDemod("");
}

View file

@ -14,5 +14,5 @@
int CmdLFParadox(const char *Cmd); int CmdLFParadox(const char *Cmd);
int demodParadox(void); 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 #endif

View file

@ -36,7 +36,7 @@ static int usage_lf_presco_clone(void) {
PrintAndLogEx(NORMAL, " <Q5> : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, " <Q5> : specify write to Q5 (t5555 instead of t55x7)");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf presco clone d 123456789"); PrintAndLogEx(NORMAL, _YELLOW_(" lf presco clone d 123456789"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -52,7 +52,7 @@ static int usage_lf_presco_sim(void) {
PrintAndLogEx(NORMAL, " c <hex-ID> : 8 digit hex card number"); PrintAndLogEx(NORMAL, " c <hex-ID> : 8 digit hex card number");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf presco sim d 123456789"); PrintAndLogEx(NORMAL, _YELLOW_(" lf presco sim d 123456789"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -86,14 +86,14 @@ static int CmdPrescoDemod(const char *Cmd) {
uint32_t raw3 = bytebits_to_byte(DemodBuffer + 64, 32); uint32_t raw3 = bytebits_to_byte(DemodBuffer + 64, 32);
uint32_t raw4 = bytebits_to_byte(DemodBuffer + 96, 32); uint32_t raw4 = bytebits_to_byte(DemodBuffer + 96, 32);
uint32_t cardid = raw4; 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; uint32_t sitecode = 0, usercode = 0, fullcode = 0;
bool Q5 = false; bool Q5 = false;
char cmd[12] = {0}; char cmd[12] = {0};
sprintf(cmd, "H %08X", cardid); sprintf(cmd, "H %08X", cardid);
getWiegandFromPresco(cmd, &sitecode, &usercode, &fullcode, &Q5); 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; return PM3_SUCCESS;
} }

View file

@ -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, " Q5 : optional - clone to Q5 (T5555) instead of T55x7 chip");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf pyramid clone 123 11223"); PrintAndLogEx(NORMAL, _YELLOW_(" lf pyramid clone 123 11223"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -60,7 +60,7 @@ static int usage_lf_pyramid_sim(void) {
PrintAndLogEx(NORMAL, " <Card Number> : 16-bit value card number"); PrintAndLogEx(NORMAL, " <Card Number> : 16-bit value card number");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf pyramid sim 123 11223"); PrintAndLogEx(NORMAL, _YELLOW_(" lf pyramid sim 123 11223"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -181,12 +181,12 @@ int demodPyramid(void) {
uint32_t fc = bytebits_to_byte(bits + 73, 8); uint32_t fc = bytebits_to_byte(bits + 73, 8);
uint32_t cardnum = bytebits_to_byte(bits + 81, 16); uint32_t cardnum = bytebits_to_byte(bits + 81, 16);
uint32_t code1 = bytebits_to_byte(bits + 72, fmtLen); 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 - 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) { } else if (fmtLen == 45) {
fmtLen = 42; //end = 10 bits not 7 like 26 bit fmt fmtLen = 42; //end = 10 bits not 7 like 26 bit fmt
uint32_t fc = bytebits_to_byte(bits + 53, 10); uint32_t fc = bytebits_to_byte(bits + 53, 10);
uint32_t cardnum = bytebits_to_byte(bits + 63, 32); 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 - 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) { } else if (fmtLen > 32) {
uint32_t cardnum = bytebits_to_byte(bits + 81, 16); uint32_t cardnum = bytebits_to_byte(bits + 81, 16);
@ -197,13 +197,13 @@ int demodPyramid(void) {
} else { } else {
uint32_t cardnum = bytebits_to_byte(bits + 81, 16); uint32_t cardnum = bytebits_to_byte(bits + 81, 16);
//uint32_t code1 = bytebits_to_byte(bits+(size-fmtLen),fmtLen); //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 - 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" PrintAndLogEx(DEBUG, "DEBUG: Pyramid: checksum : 0x%02X - %02X - %s"
, checksum , checksum
, checkCS , 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); PrintAndLogEx(DEBUG, "DEBUG: Pyramid: idx: %d, Len: %d, Printing Demod Buffer:", idx, 128);

View file

@ -118,9 +118,9 @@ int demodSecurakey(void) {
// test parities - evenparity32 looks to add an even parity returns 0 if already even... // test parities - evenparity32 looks to add an even parity returns 0 if already even...
bool parity = !evenparity32(lWiegand) && !oddparity32(rWiegand); 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 - len: " _GREEN_("%u") " FC: " _GREEN_("0x%X")" Card: " _GREEN_("%u") ", Raw: %08X%08X%08X", bitLen, fc, cardid, raw1, raw2, raw3);
if (bitLen <= 32) 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, "\nHow the FC translates to printed FC is unknown");
PrintAndLogEx(INFO, "How the checksum is calculated is unknown"); PrintAndLogEx(INFO, "How the checksum is calculated is unknown");

View file

@ -33,7 +33,7 @@ static int usage_lf_verichip_clone(void) {
PrintAndLogEx(NORMAL, " b <raw hex> : raw hex data. 12 bytes max"); PrintAndLogEx(NORMAL, " b <raw hex> : raw hex data. 12 bytes max");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf verichip clone b FF2049906D8511C593155B56D5B2649F "); PrintAndLogEx(NORMAL, _YELLOW_(" lf verichip clone b FF2049906D8511C593155B56D5B2649F "));
return PM3_SUCCESS; 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 // 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 // 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"); PrintAndLogEx(INFO, "How the Raw ID is translated by the reader is unknown. Share your trace file on forum");
return PM3_SUCCESS; return PM3_SUCCESS;
} }

View file

@ -34,7 +34,8 @@ static int usage_lf_viking_clone(void) {
PrintAndLogEx(NORMAL, " <Q5> : specify write to Q5 (t5555 instead of t55x7)"); PrintAndLogEx(NORMAL, " <Q5> : specify write to Q5 (t5555 instead of t55x7)");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf viking clone 1A337 Q5"); PrintAndLogEx(NORMAL, _YELLOW_(" lf viking clone 1A337"));
PrintAndLogEx(NORMAL, _YELLOW_(" lf viking clone 1A337 Q5"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -48,7 +49,7 @@ static int usage_lf_viking_sim(void) {
PrintAndLogEx(NORMAL, " <Card Number> : 8 digit hex viking card number"); PrintAndLogEx(NORMAL, " <Card Number> : 8 digit hex viking card number");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " lf viking sim 1A337"); PrintAndLogEx(NORMAL, _YELLOW_(" lf viking sim 1A337"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -76,8 +77,8 @@ int demodViking(void) {
uint32_t raw2 = bytebits_to_byte(DemodBuffer + ans + 32, 32); uint32_t raw2 = bytebits_to_byte(DemodBuffer + ans + 32, 32);
uint32_t cardid = bytebits_to_byte(DemodBuffer + ans + 24, 32); uint32_t cardid = bytebits_to_byte(DemodBuffer + ans + 24, 32);
uint8_t checksum = bytebits_to_byte(DemodBuffer + ans + 32 + 24, 8); 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, "Viking - Card " _GREEN_("%08X") ", Raw: %08X%08X", cardid, raw1, raw2);
PrintAndLogEx(SUCCESS, "Raw hex: %08X%08X", raw1, raw2); PrintAndLogEx(DEBUG, "Checksum: %02X", checksum);
setDemodBuff(DemodBuffer, 64, ans); setDemodBuff(DemodBuffer, 64, ans);
setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock)); setClockGrid(g_DemodClock, g_DemodStartIdx + (ans * g_DemodClock));
return PM3_SUCCESS; return PM3_SUCCESS;
@ -139,7 +140,7 @@ static int CmdVikingSim(const char *Cmd) {
rawID = getVikingBits(id); 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]; uint8_t bs[64];
num_to_bytebits(rawID, sizeof(bs), bs); num_to_bytebits(rawID, sizeof(bs), bs);

View file

@ -143,7 +143,7 @@ int demodVisa2k(void) {
// test checksums // test checksums
if (chk != calc) { 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); save_restoreGB(GRAPH_RESTORE);
return PM3_ESOFT; return PM3_ESOFT;
} }
@ -151,11 +151,11 @@ int demodVisa2k(void) {
uint8_t calc_par = visa_parity(raw2); uint8_t calc_par = visa_parity(raw2);
uint8_t chk_par = (raw3 & 0xFF0) >> 4; uint8_t chk_par = (raw3 & 0xFF0) >> 4;
if (calc_par != chk_par) { 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); save_restoreGB(GRAPH_RESTORE);
return PM3_ESOFT; 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; return PM3_SUCCESS;
} }

View file

@ -50,7 +50,7 @@ static int usage_hints(void) {
PrintAndLogEx(NORMAL, " <0|1> off or on"); PrintAndLogEx(NORMAL, " <0|1> off or on");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " hints 1"); PrintAndLogEx(NORMAL, _YELLOW_(" hints 1"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -63,7 +63,7 @@ static int usage_msleep(void) {
PrintAndLogEx(NORMAL, " <ms> time in milliseconds"); PrintAndLogEx(NORMAL, " <ms> time in milliseconds");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " msleep 100"); PrintAndLogEx(NORMAL, _YELLOW_(" msleep 100"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -75,7 +75,7 @@ static int usage_auto(void) {
PrintAndLogEx(NORMAL, " h This help"); PrintAndLogEx(NORMAL, " h This help");
PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " auto"); PrintAndLogEx(NORMAL, _YELLOW_(" auto"));
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -249,7 +249,7 @@ static int CmdPref(const char *Cmd) {
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"--------",CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("sub") " -----------------------"}, {"--------",CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Technology") " -----------------------"},
{"analyse", CmdAnalyse, AlwaysAvailable, "{ Analyse utils... }"}, {"analyse", CmdAnalyse, AlwaysAvailable, "{ Analyse utils... }"},
{"data", CmdData, AlwaysAvailable, "{ Plot window / data buffer manipulation... }"}, {"data", CmdData, AlwaysAvailable, "{ Plot window / data buffer manipulation... }"},
@ -264,7 +264,7 @@ static command_t CommandTable[] = {
{"trace", CmdTrace, AlwaysAvailable, "{ Trace manipulation... }"}, {"trace", CmdTrace, AlwaysAvailable, "{ Trace manipulation... }"},
{"usart", CmdUsart, IfPm3FpcUsartFromUsb, "{ USART commands... }"}, {"usart", CmdUsart, IfPm3FpcUsartFromUsb, "{ USART commands... }"},
{"wiegand", CmdWiegand, AlwaysAvailable, "{ Wiegand format manipulation... }"}, {"wiegand", CmdWiegand, AlwaysAvailable, "{ Wiegand format manipulation... }"},
{"--------",CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("sub") " -----------------------"}, {"--------",CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("General") " -----------------------"},
{"auto", CmdAuto, IfPm3Present, "Automated detection process for unknown tags"}, {"auto", CmdAuto, IfPm3Present, "Automated detection process for unknown tags"},
{"help", CmdHelp, AlwaysAvailable, "This help. Use " _YELLOW_("'<command> help'") " for details of a particular command."}, {"help", CmdHelp, AlwaysAvailable, "This help. Use " _YELLOW_("'<command> help'") " for details of a particular command."},
{"hints", CmdHints, AlwaysAvailable, "Turn hints on / off"}, {"hints", CmdHints, AlwaysAvailable, "Turn hints on / off"},

View file

@ -495,7 +495,7 @@ static int CmdTraceLoad(const char *Cmd) {
g_traceLen = (long)len; 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; return PM3_SUCCESS;
} }

View file

@ -641,7 +641,6 @@ finish2:
#if defined(_WIN32) #if defined(_WIN32)
static bool DetectWindowsAnsiSupport(void) { static bool DetectWindowsAnsiSupport(void) {
bool ret = false;
HKEY hKey = NULL; HKEY hKey = NULL;
bool virtualTerminalLevelSet = false; bool virtualTerminalLevelSet = false;
bool forceV2Set = false; bool forceV2Set = false;
@ -681,9 +680,15 @@ static bool DetectWindowsAnsiSupport(void) {
} }
RegCloseKey(hKey); 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 // If both VirtualTerminalLevel and ForceV2 is set, AnsiColor should work
ret = virtualTerminalLevelSet && forceV2Set; return virtualTerminalLevelSet && forceV2Set;
return ret;
} }
#endif #endif

View file

@ -301,7 +301,7 @@ char *sprint_hex_ascii(const uint8_t *data, const size_t len) {
memset(buf, 0x00, UTIL_BUFFER_SIZE_SPRINT); memset(buf, 0x00, UTIL_BUFFER_SIZE_SPRINT);
size_t max_len = (len > 1010) ? 1010 : len; 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 i = 0;
size_t pos = (max_len * 3) + 2; size_t pos = (max_len * 3) + 2;

View file

@ -205,7 +205,7 @@ k <name> : key filename, if no <name> given, UID will be used as filename"
f <name> : data filename, if no <name> given, UID will be used as filename f <name> : data filename, if no <name> given, UID will be used as filename
pm3 --> hf mf dump 1 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 Convert .bin to .eml
@ -275,7 +275,7 @@ Clone Mifare 1K Sequence
``` ```
pm3 --> hf mf chk *1 ? d mfc_default_keys pm3 --> hf mf chk *1 ? d mfc_default_keys
pm3 --> hf mf dump 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 Read Mifare Ultralight EV1

View file

@ -79,7 +79,7 @@
import subprocess import subprocess
# EML data var te get keys of # 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 # Change your device name here if it differs from the default Proxmark3 RDV4.0
PROXMARK_BIN_EXEC_STRING = 'proxmark3 -c "%s" /dev/tty.usbmodemiceman1' PROXMARK_BIN_EXEC_STRING = 'proxmark3 -c "%s" /dev/tty.usbmodemiceman1'
# Constants # Constants