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