Merge branch 'master' into fix/psk-fc2-bandpass
Signed-off-by: Iceman <iceman@iuse.se>
This commit is contained in:
60 files changed
+2357
-382
No files matched your search
@@ -2933,6 +2933,7 @@ static int try_detect_modulation(void) {
|
||||
}
|
||||
//undo trim samples
|
||||
restore_graphbuffer(saveState);
|
||||
free_buffer_savestate(saveState);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1733,6 +1733,8 @@ out:
|
||||
|
||||
restore_graphbuffer(saveState_gb);
|
||||
|
||||
free_buffer_savestate(saveState_db);
|
||||
free_buffer_savestate(saveState_gb);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
+26
-10
@@ -124,6 +124,7 @@ static buffer_savestate_t t55xx_psk_trim_head(void) {
|
||||
static void t55xx_psk_untrim_head(buffer_savestate_t st) {
|
||||
s_sample_bias = 0;
|
||||
restore_graphbuffer(st);
|
||||
free_buffer_savestate(st);
|
||||
}
|
||||
|
||||
// the bit offset to read a block at in the demod buffer loaded right now
|
||||
@@ -1090,19 +1091,24 @@ static int CmdT55xxWakeUp(const char *Cmd) {
|
||||
static int CmdT55xxDetect(const char *Cmd) {
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "lf t55xx detect",
|
||||
"Try detecting the tag modulation from reading the configuration block",
|
||||
"Try detecting the tag modulation from reading the configuration block.\n\n"
|
||||
_RED_(" * * * WARNING * * *") "\n"
|
||||
_CYAN_("Use of detect with password on a tag not configured") "\n"
|
||||
_CYAN_("for a password can damage the tag") "\n"
|
||||
_RED_(" * * * * * * * * * *"),
|
||||
"lf t55xx detect\n"
|
||||
"lf t55xx detect -1\n"
|
||||
"lf t55xx detect -p 11223344\n"
|
||||
"lf t55xx detect -p 11223344 -o\n"
|
||||
);
|
||||
|
||||
// 1 (help) + 2 (two user specified params) + (6 T55XX_DLMODE_ALL)
|
||||
void *argtable[3 + 6] = {
|
||||
// 1 (help) + 3 (three user specified params) + (6 T55XX_DLMODE_ALL)
|
||||
void *argtable[4 + 6] = {
|
||||
arg_param_begin,
|
||||
arg_lit0("1", NULL, "extract using data from graphbuffer"),
|
||||
arg_str0("p", "pwd", "<hex>", "password (4 hex bytes)"),
|
||||
arg_lit0("o", "override", "override safety check"),
|
||||
};
|
||||
uint8_t idx = 3;
|
||||
uint8_t idx = 4;
|
||||
arg_add_t55xx_downloadlink(argtable, &idx, T55XX_DLMODE_ALL, config.downlink_mode);
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||
|
||||
@@ -1122,11 +1128,13 @@ static int CmdT55xxDetect(const char *Cmd) {
|
||||
password = tmp_pwd;
|
||||
}
|
||||
|
||||
bool r0 = arg_get_lit(ctx, 3);
|
||||
bool r1 = arg_get_lit(ctx, 4);
|
||||
bool r2 = arg_get_lit(ctx, 5);
|
||||
bool r3 = arg_get_lit(ctx, 6);
|
||||
bool ra = arg_get_lit(ctx, 7);
|
||||
bool override = arg_get_lit(ctx, 3);
|
||||
|
||||
bool r0 = arg_get_lit(ctx, 4);
|
||||
bool r1 = arg_get_lit(ctx, 5);
|
||||
bool r2 = arg_get_lit(ctx, 6);
|
||||
bool r3 = arg_get_lit(ctx, 7);
|
||||
bool ra = arg_get_lit(ctx, 8);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if ((r0 + r1 + r2 + r3 + ra) > 1) {
|
||||
@@ -1134,6 +1142,14 @@ static int CmdT55xxDetect(const char *Cmd) {
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
// A password frame on an unprotected tag can land as a write, and detect cannot
|
||||
// check the PWD bit first the way read does -- finding the config is its job.
|
||||
if (usepwd && (override == false)) {
|
||||
PrintAndLogEx(WARNING, "Safety check: Could not confirm PWD bit is set. Detecting without password...");
|
||||
PrintAndLogEx(HINT, "Hint: Consider using the override parameter to force detect with password.");
|
||||
usepwd = false;
|
||||
}
|
||||
|
||||
bool try_all_dl_modes = false;
|
||||
uint8_t downlink_mode = config.downlink_mode;
|
||||
if (r0)
|
||||
|
||||
@@ -100,6 +100,7 @@ int demodTI(bool verbose) {
|
||||
int retval = PM3_ESOFT;
|
||||
|
||||
if (g_GraphTraceLen < convLen) {
|
||||
free_buffer_savestate(saveState);
|
||||
return retval;
|
||||
}
|
||||
for (i = 0; i < g_GraphTraceLen - convLen; i++) {
|
||||
@@ -280,6 +281,7 @@ out:
|
||||
restore_graphbuffer(saveState);
|
||||
}
|
||||
|
||||
free_buffer_savestate(saveState);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ int demodVisa2k(bool verbose) {
|
||||
if (ASKDemod_ext(64, 0, 0, 0, false, false, false, 1, &st) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Visa2k: ASK/Manchester Demod failed");
|
||||
restore_graphbuffer(saveState);
|
||||
free_buffer_savestate(saveState);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
size_t size = g_DemodBufferLen;
|
||||
@@ -108,6 +109,7 @@ int demodVisa2k(bool verbose) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - Visa2k: ans: %d", ans);
|
||||
|
||||
restore_graphbuffer(saveState);
|
||||
free_buffer_savestate(saveState);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
setDemodBuff(g_DemodBuffer, 96, ans);
|
||||
@@ -126,6 +128,7 @@ int demodVisa2k(bool verbose) {
|
||||
if (chk != calc) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: error: Visa2000 checksum (%s) %x - %x\n", _RED_("fail"), chk, calc);
|
||||
restore_graphbuffer(saveState);
|
||||
free_buffer_savestate(saveState);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
// parity
|
||||
@@ -134,9 +137,11 @@ int demodVisa2k(bool verbose) {
|
||||
if (calc_par != chk_par) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: error: Visa2000 parity (%s) %x - %x\n", _RED_("fail"), chk_par, calc_par);
|
||||
restore_graphbuffer(saveState);
|
||||
free_buffer_savestate(saveState);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
PrintAndLogEx(SUCCESS, "Visa2000 - Card " _GREEN_("%u") ", Raw: %08X%08X%08X", raw2, raw1, raw2, raw3);
|
||||
free_buffer_savestate(saveState);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ int demodzx(bool verbose) {
|
||||
if (ASKDemod_ext(64, 0, 0, 0, false, false, false, 1, &st) != PM3_SUCCESS) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - ZX: ASK/Manchester Demod failed");
|
||||
restore_graphbuffer(saveState);
|
||||
free_buffer_savestate(saveState);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
size_t size = g_DemodBufferLen;
|
||||
@@ -65,6 +66,7 @@ int demodzx(bool verbose) {
|
||||
PrintAndLogEx(DEBUG, "DEBUG: Error - ZX: ans: %d", ans);
|
||||
|
||||
restore_graphbuffer(saveState);
|
||||
free_buffer_savestate(saveState);
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
setDemodBuff(g_DemodBuffer, 96, ans);
|
||||
@@ -78,6 +80,7 @@ int demodzx(bool verbose) {
|
||||
// test checksums
|
||||
|
||||
PrintAndLogEx(SUCCESS, "ZX8211 - Card " _GREEN_("%u"), raw1);
|
||||
free_buffer_savestate(saveState);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -666,3 +666,8 @@ void restore_graphbuffer(buffer_savestate_t saveState) {
|
||||
g_GraphTraceLen = len;
|
||||
g_GridOffset = saveState.offset;
|
||||
}
|
||||
|
||||
// restore_*() copy out of the save state, the owner frees it after its last restore
|
||||
void free_buffer_savestate(buffer_savestate_t saveState) {
|
||||
free((void *)saveState.buffer);
|
||||
}
|
||||
@@ -69,6 +69,7 @@ size_t restore_buffer8(buffer_savestate_t saveState, uint8_t *dest);
|
||||
|
||||
buffer_savestate_t save_graphbuffer(void);
|
||||
void restore_graphbuffer(buffer_savestate_t saveState);
|
||||
void free_buffer_savestate(buffer_savestate_t saveState);
|
||||
|
||||
#define MAX_GRAPH_TRACE_LEN (40000 * 32)
|
||||
#define GRAPH_SAVE 1
|
||||
|
||||
Reference in new issue
Block a user