mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 15:26:13 +08:00
style
This commit is contained in:
parent
c55b4d5aac
commit
64f9bb5e01
|
@ -2231,9 +2231,9 @@ struct arg_int *arg_intn(
|
|||
#include <limits.h>
|
||||
#include <inttypes.h>
|
||||
static uint64_t strtollu0X(const char *str,
|
||||
const char * *endptr,
|
||||
char X,
|
||||
int base) {
|
||||
const char * *endptr,
|
||||
char X,
|
||||
int base) {
|
||||
uint64_t val; /* stores result */
|
||||
int s = 1; /* sign is +1 or -1 */
|
||||
const char *ptr = str; /* ptr to current position in str */
|
||||
|
@ -4529,11 +4529,11 @@ static void arg_cat_optionv(char *dest,
|
|||
}
|
||||
|
||||
if (datatype) {
|
||||
/* if (longopts)
|
||||
arg_cat(&dest, "=", &ndest);
|
||||
else if (shortopts)
|
||||
arg_cat(&dest, " ", &ndest);
|
||||
*/
|
||||
/* if (longopts)
|
||||
arg_cat(&dest, "=", &ndest);
|
||||
else if (shortopts)
|
||||
arg_cat(&dest, " ", &ndest);
|
||||
*/
|
||||
if (longopts)
|
||||
arg_cat(&dest, " ", &ndest);
|
||||
else if (shortopts)
|
||||
|
|
|
@ -192,19 +192,19 @@ struct arg_int *arg_int1(const char *shortopts, const char *longopts, const char
|
|||
struct arg_int *arg_intn(const char *shortopts, const char *longopts, const char *datatype, int mincount, int maxcount, const char *glossary);
|
||||
|
||||
struct arg_u64 *arg_u64_0(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
struct arg_u64 *arg_u64_1(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
const char *glossary);
|
||||
struct arg_u64 *arg_u64_n(const char *shortopts,
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
const char *longopts,
|
||||
const char *datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
|
||||
struct arg_dbl *arg_dbl0(const char *shortopts,
|
||||
|
|
|
@ -70,7 +70,7 @@ int CLIParserParseArg(CLIParserContext *ctx, int argc, char **argv, void *vargta
|
|||
PrintAndLogEx(NORMAL, "\n"_SectionTagColor_("usage:"));
|
||||
PrintAndLogEx(NORMAL, " "_CommandColor_("%s")NOLF, ctx->programName);
|
||||
arg_print_syntax(stdout, ctx->argtable, "\n\n");
|
||||
|
||||
|
||||
PrintAndLogEx(NORMAL, _SectionTagColor_("options:"));
|
||||
|
||||
arg_print_glossary(stdout, ctx->argtable, " "_ArgColor_("%-30s")" "_ArgHelpColor_("%s")"\n");
|
||||
|
|
|
@ -745,7 +745,7 @@ static int unpack(scanner_t *s, json_t *root, va_list *ap) {
|
|||
json_error_wrong_type,
|
||||
"Expected true or false, got %s",
|
||||
type_name(root)
|
||||
);
|
||||
);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ ipqx:
|
|||
mbynum(&model, --args);
|
||||
ufound(&model);
|
||||
} while (args);
|
||||
mfree(&model);
|
||||
mfree(&model);
|
||||
break;
|
||||
case 'd': /* d dump CRC model */
|
||||
/* maybe we don't want to do this:
|
||||
|
|
|
@ -447,7 +447,7 @@ static int CmdrevengSearch(const char *Cmd) {
|
|||
);
|
||||
|
||||
if (crcChars == 0) {
|
||||
free(Models[i]);
|
||||
free(Models[i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1812,7 +1812,7 @@ static int CmdMtrim(const char *Cmd) {
|
|||
uint32_t start = 0, stop = 0;
|
||||
sscanf(Cmd, "%u %u", &start, &stop);
|
||||
|
||||
if (start > GraphTraceLen || stop > GraphTraceLen || start >= stop)
|
||||
if (start > GraphTraceLen || stop > GraphTraceLen || start >= stop)
|
||||
return PM3_ESOFT;
|
||||
|
||||
// leave start position sample
|
||||
|
@ -1909,7 +1909,7 @@ static int CmdTimeScale(const char *Cmd) {
|
|||
"data timescale --sr 125 -u ms -> for LF sampled at 125 kHz. Reading will be in milliseconds\n"
|
||||
"data timescale --sr 1.695 -u us -> for HF sampled at 16 * fc/128. Reading will be in microseconds\n"
|
||||
"data timescale --sr 16 -u ETU -> for HF with 16 samples per ETU (fc/128). Reading will be in ETUs"
|
||||
);
|
||||
);
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_dbl1(NULL, "sr", "<float>", "sets timescale factor according to sampling rate"),
|
||||
|
@ -1924,7 +1924,7 @@ static int CmdTimeScale(const char *Cmd) {
|
|||
}
|
||||
int len = 0;
|
||||
CursorScaleFactorUnit[0] = '\x00';
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t*)CursorScaleFactorUnit, sizeof(CursorScaleFactorUnit), &len);
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 2), (uint8_t *)CursorScaleFactorUnit, sizeof(CursorScaleFactorUnit), &len);
|
||||
CLIParserFree(ctx);
|
||||
RepaintGraphWindow();
|
||||
return PM3_SUCCESS;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
static int CmdFlashmemSpiBaudrate(const char *Cmd) {
|
||||
|
||||
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "mem baudrate",
|
||||
"Set the baudrate for the SPI flash memory communications.\n"
|
||||
|
@ -35,8 +35,8 @@ static int CmdFlashmemSpiBaudrate(const char *Cmd) {
|
|||
"Unless you know what you are doing, please stay at 24MHz.\n"
|
||||
"If >= 24MHz, FASTREADS instead of READS instruction will be used.",
|
||||
"mem baudrate --mhz 48"
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_int1(NULL, "mhz", "<24|48>", "SPI baudrate in MHz"),
|
||||
|
@ -72,7 +72,7 @@ static int CmdFlashMemLoad(const char *Cmd) {
|
|||
"mem load -f mfc_default_keys -m -> upload MFC keys\n"
|
||||
"mem load -f t55xx_default_pwds -t -> upload T55XX passwords\n"
|
||||
"mem load -f iclass_default_keys -i -> upload iCLASS keys\n"
|
||||
);
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
|
@ -88,10 +88,10 @@ static int CmdFlashMemLoad(const char *Cmd) {
|
|||
int offset = arg_get_int_def(ctx, 1, 0);
|
||||
bool is_mfc = arg_get_lit(ctx, 2);
|
||||
bool is_iclass = arg_get_lit(ctx, 3);
|
||||
bool is_t55xx = arg_get_lit(ctx, 4);
|
||||
bool is_t55xx = arg_get_lit(ctx, 4);
|
||||
int fnlen = 0;
|
||||
char filename[FILE_PATH_SIZE] = {0};
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 5), (uint8_t*)filename, FILE_PATH_SIZE, &fnlen);
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 5), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
Dictionary_t d = DICTIONARY_NONE;
|
||||
|
@ -227,7 +227,7 @@ static int CmdFlashMemDump(const char *Cmd) {
|
|||
"mem dump -f myfile -> download all flashmem to file\n"
|
||||
"mem dump --view -o 262015 --len 128 -> display 128 bytes from offset 262015 (RSA sig)\n"
|
||||
"mem dump --view -f myfile -o 241664 --len 58 -> display 58 bytes from offset 241664 and save to file"
|
||||
);
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
|
@ -244,7 +244,7 @@ static int CmdFlashMemDump(const char *Cmd) {
|
|||
bool view = arg_get_lit(ctx, 3);
|
||||
int fnlen = 0;
|
||||
char filename[FILE_PATH_SIZE] = {0};
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 4), (uint8_t*)filename, FILE_PATH_SIZE, &fnlen);
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 4), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
uint8_t *dump = calloc(len, sizeof(uint8_t));
|
||||
|
@ -282,7 +282,7 @@ static int CmdFlashMemWipe(const char *Cmd) {
|
|||
_WHITE_("[ ") _RED_("!!! OBS") " ] use with caution",
|
||||
"mem wipe -p 0 -> wipes first page"
|
||||
// "mem wipe -i -> inital total wipe"
|
||||
);
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
|
@ -297,7 +297,7 @@ static int CmdFlashMemWipe(const char *Cmd) {
|
|||
// initalwipe = arg_get_lit(ctx, 2);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
if (page < 0 || page > 2 ) {
|
||||
if (page < 0 || page > 2) {
|
||||
PrintAndLogEx(WARNING, "page must be 0, 1 or 2");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
@ -309,8 +309,8 @@ static int CmdFlashMemWipe(const char *Cmd) {
|
|||
PrintAndLogEx(WARNING, "timeout while waiting for reply.");
|
||||
return PM3_ETIMEOUT;
|
||||
}
|
||||
|
||||
const char* msg = "Flash WIPE ";
|
||||
|
||||
const char *msg = "Flash WIPE ";
|
||||
uint8_t isok = resp.oldarg[0] & 0xFF;
|
||||
if (isok)
|
||||
PrintAndLogEx(SUCCESS, "%s ( " _GREEN_("ok")" )", msg);
|
||||
|
@ -329,7 +329,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
|||
"Collect signature and verify it from flash memory",
|
||||
"mem info"
|
||||
// "mem info -s"
|
||||
);
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
|
@ -375,7 +375,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("RDV4 RSA signature") " ---------------");
|
||||
for (int i = 0; i < (sizeof(mem.signature) / 32); i++) {
|
||||
PrintAndLogEx(INFO, " %s", sprint_hex_inrow(mem.signature + (i * 32), 32));
|
||||
PrintAndLogEx(INFO, " %s", sprint_hex_inrow(mem.signature + (i * 32), 32));
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------------
|
||||
|
@ -453,7 +453,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
|||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("RDV4 RSA Public key") " --------------");
|
||||
|
||||
char str_exp[10];
|
||||
char str_exp[10];
|
||||
char str_pk[261];
|
||||
size_t exlen = 0, pklen = 0;
|
||||
mbedtls_mpi_write_string(&rsa.E, 16, str_exp, sizeof(str_exp), &exlen);
|
||||
|
@ -468,7 +468,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
|||
PrintAndLogEx(INFO, " %.64s", str_pk + 192);
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
const char *msgkey = "RSA key validation... ";
|
||||
const char *msgkey = "RSA key validation... ";
|
||||
if (is_keyok)
|
||||
PrintAndLogEx(SUCCESS, "%s( " _GREEN_("ok") " )", msgkey);
|
||||
else
|
||||
|
@ -511,7 +511,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
|||
}
|
||||
PrintAndLogEx(INFO, "Signed");
|
||||
for (int i = 0; i < (sizeof(sign) / 32); i++) {
|
||||
PrintAndLogEx(INFO, " %s", sprint_hex_inrow(sign + (i * 32), 32));
|
||||
PrintAndLogEx(INFO, " %s", sprint_hex_inrow(sign + (i * 32), 32));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1366,7 +1366,7 @@ static int waitCmd(uint8_t iSelect, uint32_t timeout) {
|
|||
data[len - 2],
|
||||
data[len - 1],
|
||||
(crc) ? _GREEN_("ok") : _RED_("fail")
|
||||
);
|
||||
);
|
||||
} else {
|
||||
PrintAndLogEx(SUCCESS, "%s", sprint_hex(data, len));
|
||||
}
|
||||
|
|
|
@ -2662,7 +2662,7 @@ static int CmdHFiClassView(const char *Cmd) {
|
|||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_str1("f", "file", "<filename>", "filename of dump"),
|
||||
arg_int0("s", "startblock", "<dec>", "print from this block (default block6)"),
|
||||
arg_int0("s", "startblock", "<dec>", "print from this block (default block6)"),
|
||||
arg_int0("e", "endblock", "<dec>", "end printing at this block (default 0, ALL)"),
|
||||
arg_lit0("v", "verbose", "verbose output"),
|
||||
arg_param_end
|
||||
|
@ -2671,13 +2671,13 @@ static int CmdHFiClassView(const char *Cmd) {
|
|||
|
||||
int fnlen = 0;
|
||||
char filename[FILE_PATH_SIZE];
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t*)filename, FILE_PATH_SIZE, &fnlen);
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen);
|
||||
|
||||
int startblock = arg_get_int_def(ctx, 2, 0);
|
||||
int endblock = arg_get_int_def(ctx, 3, 0);
|
||||
bool verbose = arg_get_lit(ctx, 4);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
uint8_t *dump = NULL;
|
||||
size_t bytes_read = 0;
|
||||
|
@ -3492,17 +3492,17 @@ static int CmdHFiClassPermuteKey(const char *Cmd) {
|
|||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_lit0("r", "reverse", "reverse permuted key"),
|
||||
arg_lit0("r", "reverse", "reverse permuted key"),
|
||||
arg_str1(NULL, "key", "<bytes>", "input key"),
|
||||
arg_param_end
|
||||
};
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
isReverse = arg_get_lit(ctx, 1);
|
||||
|
||||
|
||||
CLIGetHexWithReturn(ctx, 2, data, &len);
|
||||
|
||||
CLIParserFree(ctx);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
memcpy(key, data, 8);
|
||||
|
||||
|
|
|
@ -299,8 +299,8 @@ static int cmd_hf_st_info(const char *Cmd) {
|
|||
CLIParserInit(&ctx, "hf st info",
|
||||
"Get info about ST25TA tag",
|
||||
"hf st info"
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_param_end
|
||||
|
@ -471,7 +471,7 @@ static int cmd_hf_st_protect(const char *Cmd) {
|
|||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_lit0("e", "enable", "enable protection"),
|
||||
arg_lit0("d", "disable", "disable protection (default)"),
|
||||
arg_lit0("d", "disable", "disable protection (default)"),
|
||||
arg_lit0("r", "read", "change read protection"),
|
||||
arg_lit0("w", "write", "change write protection (default)"),
|
||||
arg_str1("p", "password", "<hex>", "16 byte write password"),
|
||||
|
@ -484,7 +484,7 @@ static int cmd_hf_st_protect(const char *Cmd) {
|
|||
read_protection = arg_get_lit(ctx, 3);
|
||||
write_protection = arg_get_lit(ctx, 4);
|
||||
CLIGetHexWithReturn(ctx, 5, pwd, &pwdlen);
|
||||
CLIParserFree(ctx);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
//Validations
|
||||
if (enable_protection && disable_protection) {
|
||||
|
@ -625,7 +625,7 @@ static int cmd_hf_st_pwd(const char *Cmd) {
|
|||
CLIGetHexWithReturn(ctx, 3, pwd, &pwdlen);
|
||||
CLIGetHexWithReturn(ctx, 4, newpwd, &newpwdlen);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
|
||||
if (change_read_password && change_write_password) {
|
||||
PrintAndLogEx(ERR, "Must specify either read or write, not both");
|
||||
return PM3_EINVARG;
|
||||
|
@ -646,7 +646,7 @@ static int cmd_hf_st_pwd(const char *Cmd) {
|
|||
PrintAndLogEx(ERR, "New password must be 16 hex bytes");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
|
||||
bool activate_field = true;
|
||||
bool keep_field_on = true;
|
||||
uint8_t response[PM3_CMD_DATA_SIZE];
|
||||
|
|
|
@ -962,31 +962,31 @@ static int CmdHF14AWSLoadBmp(const char *Cmd) {
|
|||
char desc[800] = {0};
|
||||
for (uint8_t i = 0; i < MEND; i++) {
|
||||
snprintf(desc + strlen(desc),
|
||||
sizeof(desc) - strlen(desc),
|
||||
"hf waveshare loadbmp -f myfile -m %2u -> %s ( %u, %u )\n",
|
||||
i,
|
||||
models[i].desc,
|
||||
models[i].width,
|
||||
models[i].height
|
||||
);
|
||||
sizeof(desc) - strlen(desc),
|
||||
"hf waveshare loadbmp -f myfile -m %2u -> %s ( %u, %u )\n",
|
||||
i,
|
||||
models[i].desc,
|
||||
models[i].width,
|
||||
models[i].height
|
||||
);
|
||||
}
|
||||
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "hf waveshare loadbmp",
|
||||
"Load BMP file to Waveshare NFC ePaper.",
|
||||
desc
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
char modeldesc[40];
|
||||
snprintf(modeldesc, sizeof(modeldesc), "model number [0 - %u] of your tag", MEND - 1);
|
||||
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_int1("m", NULL, "<nr>", modeldesc),
|
||||
arg_lit0("s", "save", "save dithered version in filename-[n].bmp, only for RGB BMP"),
|
||||
arg_str1("f", "file", "<filename>", "filename[.bmp] to upload to tag"),
|
||||
arg_param_end
|
||||
};
|
||||
};
|
||||
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
|
@ -995,7 +995,7 @@ static int CmdHF14AWSLoadBmp(const char *Cmd) {
|
|||
|
||||
int fnlen = 0;
|
||||
char filename[FILE_PATH_SIZE] = {0};
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 3), (uint8_t*)filename, FILE_PATH_SIZE, &fnlen);
|
||||
CLIParamStrToBuf(arg_get_str(ctx, 3), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
//Validations
|
||||
|
@ -1006,7 +1006,7 @@ static int CmdHF14AWSLoadBmp(const char *Cmd) {
|
|||
if (model_nr == -1) {
|
||||
PrintAndLogEx(WARNING, "Missing model");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
}
|
||||
if (model_nr >= MEND) {
|
||||
PrintAndLogEx(WARNING, "Unknown model");
|
||||
return PM3_EINVARG;
|
||||
|
|
|
@ -121,12 +121,12 @@ bool emv_rocacheck(const unsigned char *buf, size_t buflen, bool verbose) {
|
|||
|
||||
mbedtls_mpi_free(&t_temp);
|
||||
mbedtls_mpi_free(&t_prime);
|
||||
|
||||
|
||||
if (bitand_is_zero(&g_one, &prints[i])) {
|
||||
if (verbose) {
|
||||
PrintAndLogEx(FAILED, "No fingerprint found.\n");
|
||||
}
|
||||
mbedtls_mpi_free(&g_one);
|
||||
mbedtls_mpi_free(&g_one);
|
||||
goto cleanup;
|
||||
}
|
||||
mbedtls_mpi_free(&g_one);
|
||||
|
|
|
@ -957,7 +957,7 @@ static command_t setCommandTable[] = {
|
|||
{"color", setCmdColor, AlwaysAvailable, "Set color support"},
|
||||
// {"defaultsavepaths", setCmdSavePaths, AlwaysAvailable, "... to be adjusted next ... "},
|
||||
{"clientdebug", setCmdDebug, AlwaysAvailable, "Set client debug level"},
|
||||
{"plotsliders",setCmdPlotSliders, AlwaysAvailable, "Set plot slider display"},
|
||||
{"plotsliders", setCmdPlotSliders, AlwaysAvailable, "Set plot slider display"},
|
||||
// {"devicedebug", setCmdDeviceDebug, AlwaysAvailable, "Set device debug level"},
|
||||
{NULL, NULL, NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// GUI (QT)
|
||||
//-----------------------------------------------------------------------------
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include "proxguiqt.h"
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
@ -820,13 +820,13 @@ void Plot::keyPressEvent(QKeyEvent *event) {
|
|||
case Qt::Key_Up:
|
||||
if (event->modifiers() & Qt::ShiftModifier) {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
Zoom(1.0/zoom_offset, CursorBPos);
|
||||
Zoom(1.0 / zoom_offset, CursorBPos);
|
||||
} else {
|
||||
Zoom(0.5, CursorBPos);
|
||||
}
|
||||
} else {
|
||||
if (event->modifiers() & Qt::ControlModifier) {
|
||||
Zoom(1.0/zoom_offset, CursorAPos);
|
||||
Zoom(1.0 / zoom_offset, CursorAPos);
|
||||
} else {
|
||||
Zoom(0.5, CursorAPos);
|
||||
}
|
||||
|
@ -868,29 +868,29 @@ void Plot::keyPressEvent(QKeyEvent *event) {
|
|||
g_printAndLog = PRINTANDLOG_PRINT;
|
||||
PrintAndLogEx(NORMAL, "\n\n" _CYAN_("PLOT window keystrokes and mouse events"));
|
||||
PrintAndLogEx(NORMAL, "\n" _GREEN_("Move:"));
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9+9, _RED_("Home") "/" _RED_("End"), "Move to the start/end of the graph");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, _YELLOW_("Mouse wheel"), "Move left/right");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9+9, _RED_("Left") "/" _RED_("Right"), "Move left/right");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, " + " _RED_("Ctrl"), "... by 1 sample");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, " + " _RED_("Shift"), "... by 1 window");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9+9, _RED_("PgUp") "/" _RED_("PgDown"), "Move left/right by 1 window");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 + 9, _RED_("Home") "/" _RED_("End"), "Move to the start/end of the graph");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _YELLOW_("Mouse wheel"), "Move left/right");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 + 9, _RED_("Left") "/" _RED_("Right"), "Move left/right");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, " + " _RED_("Ctrl"), "... by 1 sample");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, " + " _RED_("Shift"), "... by 1 window");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 + 9, _RED_("PgUp") "/" _RED_("PgDown"), "Move left/right by 1 window");
|
||||
PrintAndLogEx(NORMAL, "\n" _GREEN_("Zoom:"));
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9+9, _RED_("Shift") " + " _YELLOW_("Mouse wheel"), "Zoom in/out around mouse cursor");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9+9, _RED_("Down") "/" _RED_("Up"), "Zoom in/out around yellow cursor");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, " + " _RED_("Ctrl"), "... with smaller increment");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, " + " _RED_("Shift"), "... around purple cursor");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, _RED_("h"), "Show this help");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 + 9, _RED_("Shift") " + " _YELLOW_("Mouse wheel"), "Zoom in/out around mouse cursor");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 + 9, _RED_("Down") "/" _RED_("Up"), "Zoom in/out around yellow cursor");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, " + " _RED_("Ctrl"), "... with smaller increment");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, " + " _RED_("Shift"), "... around purple cursor");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _RED_("h"), "Show this help");
|
||||
PrintAndLogEx(NORMAL, "\n" _GREEN_("Trim:"));
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, _RED_("t"), "Trim data on window or on cursors if defined");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _RED_("t"), "Trim data on window or on cursors if defined");
|
||||
PrintAndLogEx(NORMAL, "\n" _GREEN_("Grid and demod:"));
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, _RED_("g"), "Toggle grid and demodulation plot display");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, _RED_("l"), "Toggle lock grid relative to samples");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9+9, _RED_("<") "/" _RED_(">"), "Move demodulation left/right relative to samples");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _RED_("g"), "Toggle grid and demodulation plot display");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _RED_("l"), "Toggle lock grid relative to samples");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9 + 9, _RED_("<") "/" _RED_(">"), "Move demodulation left/right relative to samples");
|
||||
PrintAndLogEx(NORMAL, "\n" _GREEN_("Misc:"));
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, _YELLOW_("Left mouse click"), "Set yellow cursor");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, _YELLOW_("Right mouse click"), "Set purple cursor");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, _RED_("h"), "Show this help");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, _RED_("q"), "Close plot window");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _YELLOW_("Left mouse click"), "Set yellow cursor");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _YELLOW_("Right mouse click"), "Set purple cursor");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _RED_("h"), "Show this help");
|
||||
PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _RED_("q"), "Close plot window");
|
||||
g_printAndLog = PRINTANDLOG_PRINT | PRINTANDLOG_LOG;
|
||||
break;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define _ISO14B_H_
|
||||
|
||||
#include "common.h"
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
uint8_t uid[10];
|
||||
uint8_t uidlen;
|
||||
uint8_t atqb[7];
|
||||
|
@ -20,25 +20,25 @@ typedef struct {
|
|||
uint8_t cid;
|
||||
} PACKED iso14b_card_select_t;
|
||||
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
uint8_t uid[4];
|
||||
uint8_t pc;
|
||||
uint8_t fc;
|
||||
} PACKED iso14b_cts_card_select_t;
|
||||
|
||||
typedef enum ISO14B_COMMAND {
|
||||
ISO14B_CONNECT = (1 << 0),
|
||||
ISO14B_DISCONNECT = (1 << 1),
|
||||
ISO14B_APDU = (1 << 2),
|
||||
ISO14B_RAW = (1 << 3),
|
||||
ISO14B_REQUEST_TRIGGER = (1 << 4),
|
||||
ISO14B_APPEND_CRC = (1 << 5),
|
||||
ISO14B_SELECT_STD = (1 << 6),
|
||||
ISO14B_SELECT_SR = (1 << 7),
|
||||
ISO14B_SET_TIMEOUT = (1 << 8),
|
||||
ISO14B_SEND_CHAINING = (1 << 9),
|
||||
ISO14B_SELECT_CTS = (1 << 10),
|
||||
ISO14B_CLEARTRACE = (1 << 11),
|
||||
ISO14B_CONNECT = (1 << 0),
|
||||
ISO14B_DISCONNECT = (1 << 1),
|
||||
ISO14B_APDU = (1 << 2),
|
||||
ISO14B_RAW = (1 << 3),
|
||||
ISO14B_REQUEST_TRIGGER = (1 << 4),
|
||||
ISO14B_APPEND_CRC = (1 << 5),
|
||||
ISO14B_SELECT_STD = (1 << 6),
|
||||
ISO14B_SELECT_SR = (1 << 7),
|
||||
ISO14B_SET_TIMEOUT = (1 << 8),
|
||||
ISO14B_SEND_CHAINING = (1 << 9),
|
||||
ISO14B_SELECT_CTS = (1 << 10),
|
||||
ISO14B_CLEARTRACE = (1 << 11),
|
||||
} iso14b_command_t;
|
||||
|
||||
#endif // _ISO14B_H_
|
||||
#endif // _ISO14B_H_
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define _ISO15_H_
|
||||
|
||||
#include "common.h"
|
||||
typedef struct {
|
||||
typedef struct {
|
||||
uint8_t uid[10];
|
||||
uint8_t uidlen;
|
||||
uint8_t atqb[7];
|
||||
|
@ -21,13 +21,13 @@ typedef struct {
|
|||
} PACKED iso14b_card_select_t;
|
||||
|
||||
typedef enum ISO15_COMMAND {
|
||||
ISO15_CONNECT = (1 << 0),
|
||||
ISO15_NO_DISCONNECT = (1 << 1),
|
||||
ISO15_RAW = (1 << 2),
|
||||
ISO15_APPEND_CRC = (1 << 3),
|
||||
ISO15_HIGH_SPEED = (1 << 4),
|
||||
ISO15_READ_RESPONSE = (1 << 5)
|
||||
ISO15_CONNECT = (1 << 0),
|
||||
ISO15_NO_DISCONNECT = (1 << 1),
|
||||
ISO15_RAW = (1 << 2),
|
||||
ISO15_APPEND_CRC = (1 << 3),
|
||||
ISO15_HIGH_SPEED = (1 << 4),
|
||||
ISO15_READ_RESPONSE = (1 << 5)
|
||||
} iso15_command_t;
|
||||
|
||||
|
||||
#endif // _ISO15_H_
|
||||
#endif // _ISO15_H_
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
#include "common.h"
|
||||
|
||||
typedef enum FELICA_COMMAND {
|
||||
FELICA_CONNECT = (1 << 0),
|
||||
FELICA_NO_DISCONNECT = (1 << 1),
|
||||
FELICA_RAW = (1 << 3),
|
||||
FELICA_APPEND_CRC = (1 << 5),
|
||||
FELICA_NO_SELECT = (1 << 6),
|
||||
FELICA_CONNECT = (1 << 0),
|
||||
FELICA_NO_DISCONNECT = (1 << 1),
|
||||
FELICA_RAW = (1 << 3),
|
||||
FELICA_APPEND_CRC = (1 << 5),
|
||||
FELICA_NO_SELECT = (1 << 6),
|
||||
} felica_command_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -116,4 +116,4 @@ typedef struct {
|
|||
uint8_t PMi[8];
|
||||
} PACKED felica_auth2_response_t;
|
||||
|
||||
#endif // _ISO18_H_
|
||||
#endif // _ISO18_H_
|
||||
|
|
|
@ -124,13 +124,13 @@ typedef struct {
|
|||
} PACKED smart_card_atr_t;
|
||||
|
||||
typedef enum SMARTCARD_COMMAND {
|
||||
SC_CONNECT = (1 << 0),
|
||||
SC_NO_DISCONNECT = (1 << 1),
|
||||
SC_RAW = (1 << 2),
|
||||
SC_SELECT = (1 << 3),
|
||||
SC_RAW_T0 = (1 << 4),
|
||||
SC_CLEARLOG = (1 << 5),
|
||||
SC_LOG = (1 << 6),
|
||||
SC_CONNECT = (1 << 0),
|
||||
SC_NO_DISCONNECT = (1 << 1),
|
||||
SC_RAW = (1 << 2),
|
||||
SC_SELECT = (1 << 3),
|
||||
SC_RAW_T0 = (1 << 4),
|
||||
SC_CLEARLOG = (1 << 5),
|
||||
SC_LOG = (1 << 6),
|
||||
} smartcard_command_t;
|
||||
|
||||
|
||||
|
|
|
@ -268,15 +268,13 @@ static void *brute_thread(void *arguments) {
|
|||
printf("CMD enc(%08x)\n", cmd_enc);
|
||||
printf(" dec(%08x)\t", decrypted);
|
||||
|
||||
uint8_t isOK = 0;
|
||||
// check if cmd exists
|
||||
isOK = checkValidCmd(decrypted);
|
||||
uint8_t isOK = checkValidCmd(decrypted);
|
||||
(void)isOK;
|
||||
|
||||
// Add a crc-check.
|
||||
isOK = checkCRC(decrypted);
|
||||
|
||||
if (!isOK) {
|
||||
if (isOK == false) {
|
||||
printf("<-- not a valid cmd\n");
|
||||
pthread_mutex_unlock(&print_lock);
|
||||
free(revstate);
|
||||
|
@ -305,8 +303,10 @@ static void *brute_thread(void *arguments) {
|
|||
pthread_mutex_unlock(&print_lock);
|
||||
}
|
||||
}
|
||||
if (revstate)
|
||||
free(revstate);
|
||||
|
||||
free(args);
|
||||
free(args);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue