This commit is contained in:
iceman1001 committed 2026-07-30 17:06:36 +02:00
1 parent 92969c5173
commit 6411ba1ee4
15 files changed
+103 -99

No files matched your search

+2 -2
View File
@@ -4874,7 +4874,7 @@ static int CmdSpectrum(const char *Cmd) {
return PM3_EMALLOC;
}
// anchor the ridge tracker on the symbol rate the full length analysis found,
// anchor the ridge tracker on the symbol rate the full length analysis found,
// so drift is measured against the clock we care about rather than against whichever bin peaked in each frame
const double anchor = an.have_symbol_clk ? (1.0 / an.symbol_clk) : 0.0;
@@ -5153,7 +5153,7 @@ static int CmdFitScore(const char *Cmd) {
return PM3_SUCCESS;
}
// Developer helper.
// Developer helper.
// Fills the GraphBuffer with a synthetic waveform whose modulation, encoding and clock are known
static int CmdGenSignal(const char *Cmd) {
+1 -1
View File
@@ -467,7 +467,7 @@ static int CmdFlashMemSpiFFSWipe(const char *Cmd) {
CLIParserInit(&ctx, "mem spiffs wipe",
_RED_("* * * Warning * * *") " \n"
_CYAN_("This command wipes all files on the device SPIFFS file system"),
"mem spiffs wipe");
"mem spiffs wipe");
void *argtable[] = {
arg_param_begin,
+1 -1
View File
@@ -3132,7 +3132,7 @@ static int CmdHF14BAPDU(const char *Cmd) {
arg_lit0("t", "tlv", "executes TLV decoder if it possible"),
arg_lit0(NULL, "decode", "decode apdu request if it possible"),
arg_str0("m", "make", "<hex>", "make apdu with head from this field and data from data field.\n"
" must be 4 bytes: <CLA INS P1 P2>"),
" must be 4 bytes: <CLA INS P1 P2>"),
arg_lit0("e", "extended", "make extended length apdu if `m` parameter included"),
arg_int0("l", "le", "<int>", "Le apdu parameter if `m` parameter included"),
arg_str1("d", "data", "<hex>", "<APDU | data> if `m` parameter included"),
+18 -18
View File
@@ -1383,22 +1383,22 @@ static void iso15_render_presence_table(const iso15_seen_tag_t *seen, int n,
for (int i = 0; i < n; i++) {
if (seen[i].present) {
PrintAndLogEx(INFO, "%3d %-25s %02X %spresent%s"
, i + 1
, iso15693_sprintUID(NULL, (uint8_t *)seen[i].uid)
, seen[i].dsfid
, c_grn
, c_off
);
, i + 1
, iso15693_sprintUID(NULL, (uint8_t *)seen[i].uid)
, seen[i].dsfid
, c_grn
, c_off
);
} else {
uint32_t secs = (uint32_t)((now - seen[i].last_seen_ms) / 1000);
PrintAndLogEx(INFO, "%3d %-25s %02X %sgone%s (%us ago)"
, i + 1
, iso15693_sprintUID(NULL, (uint8_t *)seen[i].uid)
, seen[i].dsfid
, c_yel
, c_off
, secs
);
, i + 1
, iso15693_sprintUID(NULL, (uint8_t *)seen[i].uid)
, seen[i].dsfid
, c_yel
, c_off
, secs
);
}
lines++;
}
@@ -3791,12 +3791,12 @@ static int CmdHF15SlixProtectPage(const char *Cmd) {
PrintAndLogEx(INFO, "Trying to set page protection pointer to " _YELLOW_("%d"), payload.divide_ptr);
PrintAndLogEx(INFO, _YELLOW_("LO") " page access %s%s"
, (payload.prot_status & 0x01) ? _RED_("r") : _GREEN_("r")
, (payload.prot_status & 0x02) ? _RED_("w") : _GREEN_("w")
);
, (payload.prot_status & 0x01) ? _RED_("r") : _GREEN_("r")
, (payload.prot_status & 0x02) ? _RED_("w") : _GREEN_("w")
);
PrintAndLogEx(INFO, _YELLOW_("HI") " page access %s%s"
, (payload.prot_status & 0x10) ? _RED_("r") : _GREEN_("r")
, (payload.prot_status & 0x20) ? _RED_("w") : _GREEN_("w"));
, (payload.prot_status & 0x10) ? _RED_("r") : _GREEN_("r")
, (payload.prot_status & 0x20) ? _RED_("w") : _GREEN_("w"));
PacketResponseNG resp;
clearCommandBuffer();
+12 -12
View File
@@ -201,11 +201,11 @@ static int legic_write_dump_to_tag(uint8_t *dump, size_t bytes_read) {
static int CmdLegicMigrate(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "hf legic migrate",
"Clone a LEGIC Prime dump to the currently attached tag.\n"
"Optionally apply a DCF update after cloning, but only when explicitly requested.",
"hf legic migrate -f src.bin\n"
"hf legic migrate -f src.bin --kgh\n"
"hf legic migrate -f src.bin --dcf 60EA --danger");
"Clone a LEGIC Prime dump to the currently attached tag.\n"
"Optionally apply a DCF update after cloning, but only when explicitly requested.",
"hf legic migrate -f src.bin\n"
"hf legic migrate -f src.bin --kgh\n"
"hf legic migrate -f src.bin --dcf 60EA --danger");
void *argtable[] = {
arg_param_begin,
@@ -1352,13 +1352,13 @@ static int CmdLegicRestore(const char *Cmd) {
static int CmdLegicClone(const char *Cmd) {
CLIParserContext *ctx;
CLIParserInit(&ctx, "hf legic clone",
"Rewrite a LEGIC dump for a new target tag or MCC.\n"
"Use --mcc to rewrite only the dump obfuscation, or --write to clone to the current tag.\n"
"Use --kgh with --write to recalculate UID-bound KGH payload CRCs.",
"hf legic clone -f src.bin -c 39 -o clone.bin\n"
"hf legic clone -f src.bin --write\n"
"hf legic clone -f src.bin --write --kgh\n"
"hf legic clone -f src.bin --write --kgh -o clone.bin");
"Rewrite a LEGIC dump for a new target tag or MCC.\n"
"Use --mcc to rewrite only the dump obfuscation, or --write to clone to the current tag.\n"
"Use --kgh with --write to recalculate UID-bound KGH payload CRCs.",
"hf legic clone -f src.bin -c 39 -o clone.bin\n"
"hf legic clone -f src.bin --write\n"
"hf legic clone -f src.bin --write --kgh\n"
"hf legic clone -f src.bin --write --kgh -o clone.bin");
void *argtable[] = {
arg_param_begin,
+4 -4
View File
@@ -1836,11 +1836,11 @@ int CmdLFRelay(const char *Cmd) {
" --rdr : Reading device, act as IP client and reads LF tag and sends data\n"
" --tag : Simulation device, act as IP server and simulates relayed data\n",
_WHITE_("Device A, reading LF tag, client") "\n"
"lf relay --rdr --ip 192.168.1.141 -> Client, connect to IP 192.168.1.141:8000\n"
"lf relay --rdr --ip 192.168.1.141 -p 18111 -> Client, connect to IP 192.168.1.141:18111 \n\n"
"lf relay --rdr --ip 192.168.1.141 -> Client, connect to IP 192.168.1.141:8000\n"
"lf relay --rdr --ip 192.168.1.141 -p 18111 -> Client, connect to IP 192.168.1.141:18111 \n\n"
_WHITE_("Device B, simulate LF tag, server") "\n"
"lf relay --tag -p 8111 -> Server listening port 8111, recv 40000 samples\n"
"lf relay --tag -s 10000 -> Server listening port 8000, recv 10000 samples\n"
"lf relay --tag -p 8111 -> Server listening port 8111, recv 40000 samples\n"
"lf relay --tag -s 10000 -> Server listening port 8000, recv 10000 samples\n"
);
void *argtable[] = {
+6 -6
View File
@@ -192,7 +192,7 @@ static int demod_cotag(int32_t *samples, int num_samples, int clock, int clock_s
, i
, (int32_t)(clock_start + i * clock_half)
, (unsigned)half1, (unsigned)half2
);
);
}
// re-align by one half-clock forward
@@ -284,7 +284,7 @@ static int demod_cotag(int32_t *samples, int num_samples, int clock, int clock_s
for (int i = 0; i < manchester_count && preamble_index < 0; i++) {
for (int p = 0; preamble_patterns[p].pat != NULL; p++) {
if ( ((i + preamble_patterns[p].len) <= manchester_count)
if (((i + preamble_patterns[p].len) <= manchester_count)
&& (memcmp(&manchester_demod_reversed[i], preamble_patterns[p].pat, preamble_patterns[p].len) == 0)) {
preamble_index = i;
preamble_type = preamble_patterns[p].name;
@@ -348,9 +348,9 @@ static int demod_cotag(int32_t *samples, int num_samples, int clock, int clock_s
for (int i = 0; i < LF_COTAG_DATA_LEN; i += 4) {
int nibble = (data_bits[i] << 3)
| (data_bits[i + 1] << 2)
| (data_bits[i + 2] << 1)
| data_bits[i + 3];
| (data_bits[i + 1] << 2)
| (data_bits[i + 2] << 1)
| data_bits[i + 3];
str[p++] = ' ';
str[p++] = ' ';
@@ -573,7 +573,7 @@ static int cmp_int32_asc(const void *a, const void *b) {
* resolution for very low amplitude captures.
*/
static double trimmed_mean_abs(const int32_t *samples, int start, int count) {
/// The values are sorted and the top 1/TRIM_DROP_DEN are discarded before averaging
/// The values are sorted and the top 1/TRIM_DROP_DEN are discarded before averaging
const int TRIM_DROP_DEN = 4; // trimmed mean denominator
int32_t buf[count];
+10 -10
View File
@@ -1280,9 +1280,9 @@ static bool t55xx_fallback_try(pm3_mod_t mod, pm3_enc_t enc, int fc_hi, int fc_l
if (mod == PM3_MOD_FSK) {
static const uint8_t rates[] = { 32, 40, 50, 64, 100, 128 };
static const uint8_t rates[] = { 32, 40, 50, 64, 100, 128 };
const uint8_t pairs[3][2] = {
const uint8_t pairs[3][2] = {
{ (uint8_t)fc_hi, (uint8_t)fc_lo }, { 8, 5 }, { 10, 8 }
};
@@ -1549,14 +1549,14 @@ static void t55xx_detect_fallback(t55xx_conf_block_t *tests, uint8_t *hits, uint
nseen++;
if (t55xx_fallback_try(fit.items[i].mod
, fit.items[i].enc
, fit.items[i].fc_hi
, fit.items[i].fc_lo
, fitclk
, tests
, hits
, downlink_mode
, (round == 2))) {
, fit.items[i].enc
, fit.items[i].fc_hi
, fit.items[i].fc_lo
, fitclk
, tests
, hits
, downlink_mode
, (round == 2))) {
done = true;
break;
}
+3 -3
View File
@@ -17,7 +17,7 @@
//
// Trovan is not ISO 11784/11785
//
// Differential biphase phase shift keying on an Fc/2 subcarrier, 16 carrier cycles to the bit.
// Differential biphase phase shift keying on an Fc/2 subcarrier, 16 carrier cycles to the bit.
// A telegram is 64 bits:
//
// 8 bits sync, 01111111. Cannot occur anywhere in the body without
@@ -103,7 +103,7 @@ static bool trovan_check(const uint8_t *bits, uint64_t *id) {
return true;
}
// Hunt for a sync word and validate the telegram that follows it.
// Hunt for a sync word and validate the telegram that follows it.
// Returns the bit offset the telegram started at, or -1.
static int trovan_find(const uint8_t *bits, size_t size, uint64_t *id) {
@@ -135,7 +135,7 @@ static void trovan_print(uint64_t id) {
);
}
int demodTrovan(bool verbose) {
int demodTrovan(bool verbose) {
if (PSKDemod(TROVAN_CLOCK, 0, 100, false) != PM3_SUCCESS) {
PrintAndLogEx(DEBUG, "DEBUG: Error - Trovan: PSK demod failed");
+2 -2
View File
@@ -680,7 +680,7 @@ int flash_write(flash_file_t *ctx) {
int pct = 0;
if (blocks > 50) {
signal(SIGINT, hadouken_on_sigint);
#ifndef _WIN32
signal(SIGWINCH, hadouken_on_sigwinch);
@@ -690,7 +690,7 @@ int flash_write(flash_file_t *ctx) {
}
while (length) {
uint32_t block_size = length;
if (block_size > BLOCK_SIZE) {
block_size = BLOCK_SIZE;
+24 -24
View File
@@ -36,10 +36,10 @@ static int terminal_width(void) {
return csbi.srWindow.Right - csbi.srWindow.Left + 1;
}
const char *c = getenv("COLUMNS");
if (c) {
int w = atoi(c);
if (c) {
int w = atoi(c);
if (w > 0) {
return w;
return w;
}
}
return 80;
@@ -53,7 +53,7 @@ static int terminal_width(void) {
return (int)ws.ws_col;
}
const char *c = getenv("COLUMNS");
if (c) {
if (c) {
int w = atoi(c);
if (w > 0) {
return w;
@@ -63,7 +63,7 @@ static int terminal_width(void) {
}
#endif
// --- wave parameters (unchanged from hadouken_wave.c) -------------------
// --- wave parameters (unchanged from hadouken_wave.c) -------------------
#define ORIGIN_X 64.0
#define ORIGIN_Y 8.0
#define ASPECT 2.0
@@ -91,7 +91,7 @@ static const char *GLYPHS = " .:;+xX#";
// --- shared state --------------------------------------------------------
static volatile sig_atomic_t g_resize = 0; // set by SIGWINCH
static volatile int g_running = 0;
static volatile int g_progress = 0; // 0..100
static volatile int g_progress = 0; // 0..100
static pthread_t g_thread;
// animation config – written once before hadouken_start()
@@ -99,9 +99,9 @@ static double g_fps = 30.0;
static int g_glyph_mode = 0;
static int g_wave_mode = 0; // 0 = radial, 1 = beam
void hadouken_on_sigint(int s) {
(void)s;
g_running = 0;
void hadouken_on_sigint(int s) {
(void)s;
g_running = 0;
}
#ifndef _WIN32
@@ -111,9 +111,9 @@ void hadouken_on_sigwinch(int s) {
}
#endif
/*
/*
* Compute the inner fill width for the progress bar from the current terminal
* width, clamped to [BAR_MIN, BAR_MAX].
* width, clamped to [BAR_MIN, BAR_MAX].
*/
static int bar_inner_width(void) {
int w = terminal_width() - BAR_OVERHEAD;
@@ -126,7 +126,7 @@ static int bar_inner_width(void) {
return w;
}
// --- colour helpers ------------------------------------------------------
// --- colour helpers ------------------------------------------------------
static inline int clamp8(double v) {
if (v < 0) {
return 0;
@@ -175,11 +175,11 @@ static int render_anim_line(char *dst, int y, double t, int glyph_mode, int mode
int ch = c->ch;
int has = c->has;
int r = 0;
int g = 0;
int g = 0;
int b = 0;
if (ch == ' ' && !has) {
pending_blanks++;
if (ch == ' ' && !has) {
pending_blanks++;
continue;
}
@@ -192,7 +192,7 @@ static int render_anim_line(char *dst, int y, double t, int glyph_mode, int mode
double lum = (r + g + b) / 765.0;
int idx = (int)(lum * 8);
int idx = (int)(lum * 8);
if (idx > 7) {
idx = 7;
}
@@ -203,8 +203,8 @@ static int render_anim_line(char *dst, int y, double t, int glyph_mode, int mode
}
}
} else if (has) {
r = c->r;
g = c->g;
r = c->r;
g = c->g;
b = c->b;
}
@@ -219,10 +219,10 @@ static int render_anim_line(char *dst, int y, double t, int glyph_mode, int mode
len += sprintf(dst + len, ANSI_FG_RGB, r, g, b);
} else {
len += sprintf(dst + len, AEND);
}
last_has = has;
last_r = r;
last_g = g;
}
last_has = has;
last_r = r;
last_g = g;
last_b = b;
}
dst[len++] = (char)ch;
@@ -285,7 +285,7 @@ static void *anim_thread(void *arg) {
static char prev[FH][FW * 24 + 16];
static char out [FH * (FW * 24 + 32) + 512];
// bar buf: BAR_MAX fill chars + ANSI escapes per char + fixed overhead
// bar buf: BAR_MAX fill chars + ANSI escapes per char + fixed overhead
static char bar [BAR_MAX + 256];
int have_prev = 0;
@@ -303,7 +303,7 @@ static void *anim_thread(void *arg) {
have_prev = 0;
}
// dynamic: re-queried every frame
// dynamic: re-queried every frame
int bw = bar_inner_width();
int n = 0;
+7 -7
View File
@@ -244,7 +244,7 @@ void pm3_apply_window(double *data, size_t len, pm3_window_t win) {
w = 0.54 - 0.46 * cos(phase);
break;
}
case PM3_WIN_BLACKMAN:{
case PM3_WIN_BLACKMAN: {
w = 0.42 - 0.5 * cos(phase) + 0.08 * cos(2.0 * phase);
break;
}
@@ -765,8 +765,8 @@ static bool find_fsk_pair(const pm3_peak_t *peaks, size_t n, double *lo, double
// Find the spacing of the harmonic comb that best explains a set of peaks.
//
// Squaring a symbol stream produces energy at every integer multiple of the symbol rate.
// Picking the tallest line therefore lands on a harmonic as often as not.
// Try each peak and each peak divided by a small integer as a candidate spacing
// Picking the tallest line therefore lands on a harmonic as often as not.
// Try each peak and each peak divided by a small integer as a candidate spacing
// and keep whichever one places the most peaks on a multiple of itself
static double comb_fundamental(const pm3_peak_t *peaks, size_t npeaks, size_t n, double min_clk) {
@@ -1101,7 +1101,7 @@ bool pm3_is_switched_carrier(const double *sig, size_t len) {
mean += sig[i];
}
mean /= (double)len;
size_t flips = 0, pairs = 0;
int prev = 0;
@@ -1189,7 +1189,7 @@ static int analyse_once(const double *sig, size_t len, size_t n, pm3_window_t wi
}
free(work);
// low frequency energy relative to the strongest line.
// low frequency energy relative to the strongest line.
// NRZ piles up at DC,
// Manchester and biphase have null.
double dc_sum = 0.0;
@@ -1247,8 +1247,8 @@ static int analyse_once(const double *sig, size_t len, size_t n, pm3_window_t wi
out->family = PM3_FAM_FSK;
out->confidence = confidence_from_db(
0.5 * (prominence_at(&plain, 1.0 / out->fsk_clk_lo) + prominence_at(&plain, 1.0 / out->fsk_clk_hi))
);
0.5 * (prominence_at(&plain, 1.0 / out->fsk_clk_lo) + prominence_at(&plain, 1.0 / out->fsk_clk_hi))
);
} else if (out->have_carrier) {
+1 -1
View File
@@ -891,7 +891,7 @@ static int dumpmem_pm3(char *serial_port_name, const char *filename, uint32_t ad
PrintAndLogEx(INFO, "Device is running the bootloader.");
} else {
PrintAndLogEx(ERR, "Device is running the bootloader, but the bootloader"
" doesn't understand the READ MEM command.");
" doesn't understand the READ MEM command.");
goto finish2;
}
}