This commit is contained in:
iceman1001 2020-10-06 18:00:00 +02:00
commit 64f9bb5e01
20 changed files with 135 additions and 135 deletions

View file

@ -2231,9 +2231,9 @@ struct arg_int *arg_intn(
#include <limits.h> #include <limits.h>
#include <inttypes.h> #include <inttypes.h>
static uint64_t strtollu0X(const char *str, static uint64_t strtollu0X(const char *str,
const char * *endptr, const char * *endptr,
char X, char X,
int base) { int base) {
uint64_t val; /* stores result */ uint64_t val; /* stores result */
int s = 1; /* sign is +1 or -1 */ int s = 1; /* sign is +1 or -1 */
const char *ptr = str; /* ptr to current position in str */ const char *ptr = str; /* ptr to current position in str */
@ -4529,11 +4529,11 @@ static void arg_cat_optionv(char *dest,
} }
if (datatype) { if (datatype) {
/* if (longopts) /* if (longopts)
arg_cat(&dest, "=", &ndest); arg_cat(&dest, "=", &ndest);
else if (shortopts) else if (shortopts)
arg_cat(&dest, " ", &ndest); arg_cat(&dest, " ", &ndest);
*/ */
if (longopts) if (longopts)
arg_cat(&dest, " ", &ndest); arg_cat(&dest, " ", &ndest);
else if (shortopts) else if (shortopts)

View file

@ -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_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, struct arg_u64 *arg_u64_0(const char *shortopts,
const char *longopts, const char *longopts,
const char *datatype, const char *datatype,
const char *glossary); const char *glossary);
struct arg_u64 *arg_u64_1(const char *shortopts, struct arg_u64 *arg_u64_1(const char *shortopts,
const char *longopts, const char *longopts,
const char *datatype, const char *datatype,
const char *glossary); const char *glossary);
struct arg_u64 *arg_u64_n(const char *shortopts, struct arg_u64 *arg_u64_n(const char *shortopts,
const char *longopts, const char *longopts,
const char *datatype, const char *datatype,
int mincount, int mincount,
int maxcount, int maxcount,
const char *glossary); const char *glossary);
struct arg_dbl *arg_dbl0(const char *shortopts, struct arg_dbl *arg_dbl0(const char *shortopts,

View file

@ -745,7 +745,7 @@ static int unpack(scanner_t *s, json_t *root, va_list *ap) {
json_error_wrong_type, json_error_wrong_type,
"Expected true or false, got %s", "Expected true or false, got %s",
type_name(root) type_name(root)
); );
return -1; return -1;
} }

View file

@ -333,7 +333,7 @@ ipqx:
mbynum(&model, --args); mbynum(&model, --args);
ufound(&model); ufound(&model);
} while (args); } while (args);
mfree(&model); mfree(&model);
break; break;
case 'd': /* d dump CRC model */ case 'd': /* d dump CRC model */
/* maybe we don't want to do this: /* maybe we don't want to do this:

View file

@ -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 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 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" "data timescale --sr 16 -u ETU -> for HF with 16 samples per ETU (fc/128). Reading will be in ETUs"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
arg_dbl1(NULL, "sr", "<float>", "sets timescale factor according to sampling rate"), 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; int len = 0;
CursorScaleFactorUnit[0] = '\x00'; 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); CLIParserFree(ctx);
RepaintGraphWindow(); RepaintGraphWindow();
return PM3_SUCCESS; return PM3_SUCCESS;

View file

@ -35,7 +35,7 @@ static int CmdFlashmemSpiBaudrate(const char *Cmd) {
"Unless you know what you are doing, please stay at 24MHz.\n" "Unless you know what you are doing, please stay at 24MHz.\n"
"If >= 24MHz, FASTREADS instead of READS instruction will be used.", "If >= 24MHz, FASTREADS instead of READS instruction will be used.",
"mem baudrate --mhz 48" "mem baudrate --mhz 48"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -72,7 +72,7 @@ static int CmdFlashMemLoad(const char *Cmd) {
"mem load -f mfc_default_keys -m -> upload MFC keys\n" "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 t55xx_default_pwds -t -> upload T55XX passwords\n"
"mem load -f iclass_default_keys -i -> upload iCLASS keys\n" "mem load -f iclass_default_keys -i -> upload iCLASS keys\n"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -91,7 +91,7 @@ static int CmdFlashMemLoad(const char *Cmd) {
bool is_t55xx = arg_get_lit(ctx, 4); bool is_t55xx = arg_get_lit(ctx, 4);
int fnlen = 0; int fnlen = 0;
char filename[FILE_PATH_SIZE] = {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); CLIParserFree(ctx);
Dictionary_t d = DICTIONARY_NONE; 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 -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 -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" "mem dump --view -f myfile -o 241664 --len 58 -> display 58 bytes from offset 241664 and save to file"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -244,7 +244,7 @@ static int CmdFlashMemDump(const char *Cmd) {
bool view = arg_get_lit(ctx, 3); bool view = arg_get_lit(ctx, 3);
int fnlen = 0; int fnlen = 0;
char filename[FILE_PATH_SIZE] = {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); CLIParserFree(ctx);
uint8_t *dump = calloc(len, sizeof(uint8_t)); uint8_t *dump = calloc(len, sizeof(uint8_t));
@ -282,7 +282,7 @@ static int CmdFlashMemWipe(const char *Cmd) {
_WHITE_("[ ") _RED_("!!! OBS") " ] use with caution", _WHITE_("[ ") _RED_("!!! OBS") " ] use with caution",
"mem wipe -p 0 -> wipes first page" "mem wipe -p 0 -> wipes first page"
// "mem wipe -i -> inital total wipe" // "mem wipe -i -> inital total wipe"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,
@ -297,7 +297,7 @@ static int CmdFlashMemWipe(const char *Cmd) {
// initalwipe = arg_get_lit(ctx, 2); // initalwipe = arg_get_lit(ctx, 2);
CLIParserFree(ctx); CLIParserFree(ctx);
if (page < 0 || page > 2 ) { if (page < 0 || page > 2) {
PrintAndLogEx(WARNING, "page must be 0, 1 or 2"); PrintAndLogEx(WARNING, "page must be 0, 1 or 2");
return PM3_EINVARG; return PM3_EINVARG;
} }
@ -310,7 +310,7 @@ static int CmdFlashMemWipe(const char *Cmd) {
return PM3_ETIMEOUT; return PM3_ETIMEOUT;
} }
const char* msg = "Flash WIPE "; const char *msg = "Flash WIPE ";
uint8_t isok = resp.oldarg[0] & 0xFF; uint8_t isok = resp.oldarg[0] & 0xFF;
if (isok) if (isok)
PrintAndLogEx(SUCCESS, "%s ( " _GREEN_("ok")" )", msg); PrintAndLogEx(SUCCESS, "%s ( " _GREEN_("ok")" )", msg);
@ -329,7 +329,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
"Collect signature and verify it from flash memory", "Collect signature and verify it from flash memory",
"mem info" "mem info"
// "mem info -s" // "mem info -s"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,

View file

@ -1366,7 +1366,7 @@ static int waitCmd(uint8_t iSelect, uint32_t timeout) {
data[len - 2], data[len - 2],
data[len - 1], data[len - 1],
(crc) ? _GREEN_("ok") : _RED_("fail") (crc) ? _GREEN_("ok") : _RED_("fail")
); );
} else { } else {
PrintAndLogEx(SUCCESS, "%s", sprint_hex(data, len)); PrintAndLogEx(SUCCESS, "%s", sprint_hex(data, len));
} }

View file

@ -2671,7 +2671,7 @@ static int CmdHFiClassView(const char *Cmd) {
int fnlen = 0; int fnlen = 0;
char filename[FILE_PATH_SIZE]; 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 startblock = arg_get_int_def(ctx, 2, 0);
int endblock = arg_get_int_def(ctx, 3, 0); int endblock = arg_get_int_def(ctx, 3, 0);

View file

@ -299,7 +299,7 @@ static int cmd_hf_st_info(const char *Cmd) {
CLIParserInit(&ctx, "hf st info", CLIParserInit(&ctx, "hf st info",
"Get info about ST25TA tag", "Get info about ST25TA tag",
"hf st info" "hf st info"
); );
void *argtable[] = { void *argtable[] = {
arg_param_begin, arg_param_begin,

View file

@ -962,20 +962,20 @@ static int CmdHF14AWSLoadBmp(const char *Cmd) {
char desc[800] = {0}; char desc[800] = {0};
for (uint8_t i = 0; i < MEND; i++) { for (uint8_t i = 0; i < MEND; i++) {
snprintf(desc + strlen(desc), snprintf(desc + strlen(desc),
sizeof(desc) - strlen(desc), sizeof(desc) - strlen(desc),
"hf waveshare loadbmp -f myfile -m %2u -> %s ( %u, %u )\n", "hf waveshare loadbmp -f myfile -m %2u -> %s ( %u, %u )\n",
i, i,
models[i].desc, models[i].desc,
models[i].width, models[i].width,
models[i].height models[i].height
); );
} }
CLIParserContext *ctx; CLIParserContext *ctx;
CLIParserInit(&ctx, "hf waveshare loadbmp", CLIParserInit(&ctx, "hf waveshare loadbmp",
"Load BMP file to Waveshare NFC ePaper.", "Load BMP file to Waveshare NFC ePaper.",
desc desc
); );
char modeldesc[40]; char modeldesc[40];
snprintf(modeldesc, sizeof(modeldesc), "model number [0 - %u] of your tag", MEND - 1); snprintf(modeldesc, sizeof(modeldesc), "model number [0 - %u] of your tag", MEND - 1);
@ -995,7 +995,7 @@ static int CmdHF14AWSLoadBmp(const char *Cmd) {
int fnlen = 0; int fnlen = 0;
char filename[FILE_PATH_SIZE] = {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); CLIParserFree(ctx);
//Validations //Validations

View file

@ -957,7 +957,7 @@ static command_t setCommandTable[] = {
{"color", setCmdColor, AlwaysAvailable, "Set color support"}, {"color", setCmdColor, AlwaysAvailable, "Set color support"},
// {"defaultsavepaths", setCmdSavePaths, AlwaysAvailable, "... to be adjusted next ... "}, // {"defaultsavepaths", setCmdSavePaths, AlwaysAvailable, "... to be adjusted next ... "},
{"clientdebug", setCmdDebug, AlwaysAvailable, "Set client debug level"}, {"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"}, // {"devicedebug", setCmdDeviceDebug, AlwaysAvailable, "Set device debug level"},
{NULL, NULL, NULL, NULL} {NULL, NULL, NULL, NULL}
}; };

View file

@ -820,13 +820,13 @@ void Plot::keyPressEvent(QKeyEvent *event) {
case Qt::Key_Up: case Qt::Key_Up:
if (event->modifiers() & Qt::ShiftModifier) { if (event->modifiers() & Qt::ShiftModifier) {
if (event->modifiers() & Qt::ControlModifier) { if (event->modifiers() & Qt::ControlModifier) {
Zoom(1.0/zoom_offset, CursorBPos); Zoom(1.0 / zoom_offset, CursorBPos);
} else { } else {
Zoom(0.5, CursorBPos); Zoom(0.5, CursorBPos);
} }
} else { } else {
if (event->modifiers() & Qt::ControlModifier) { if (event->modifiers() & Qt::ControlModifier) {
Zoom(1.0/zoom_offset, CursorAPos); Zoom(1.0 / zoom_offset, CursorAPos);
} else { } else {
Zoom(0.5, CursorAPos); Zoom(0.5, CursorAPos);
} }
@ -868,29 +868,29 @@ void Plot::keyPressEvent(QKeyEvent *event) {
g_printAndLog = PRINTANDLOG_PRINT; g_printAndLog = PRINTANDLOG_PRINT;
PrintAndLogEx(NORMAL, "\n\n" _CYAN_("PLOT window keystrokes and mouse events")); PrintAndLogEx(NORMAL, "\n\n" _CYAN_("PLOT window keystrokes and mouse events"));
PrintAndLogEx(NORMAL, "\n" _GREEN_("Move:")); 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 + 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, _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 + 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_("Ctrl"), "... by 1 sample");
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, " + " _RED_("Shift"), "... by 1 window"); 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_("PgUp") "/" _RED_("PgDown"), "Move left/right by 1 window");
PrintAndLogEx(NORMAL, "\n" _GREEN_("Zoom:")); 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_("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 + 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_("Ctrl"), "... with smaller increment");
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, " + " _RED_("Shift"), "... around purple cursor"); 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, _RED_("h"), "Show this help");
PrintAndLogEx(NORMAL, "\n" _GREEN_("Trim:")); 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, "\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_("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, _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 + 9, _RED_("<") "/" _RED_(">"), "Move demodulation left/right relative to samples");
PrintAndLogEx(NORMAL, "\n" _GREEN_("Misc:")); 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_("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, _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_("h"), "Show this help");
PrintAndLogEx(NORMAL, " %-*s%s", 25+9, _RED_("q"), "Close plot window"); PrintAndLogEx(NORMAL, " %-*s%s", 25 + 9, _RED_("q"), "Close plot window");
g_printAndLog = PRINTANDLOG_PRINT | PRINTANDLOG_LOG; g_printAndLog = PRINTANDLOG_PRINT | PRINTANDLOG_LOG;
break; break;

View file

@ -27,18 +27,18 @@ typedef struct {
} PACKED iso14b_cts_card_select_t; } PACKED iso14b_cts_card_select_t;
typedef enum ISO14B_COMMAND { typedef enum ISO14B_COMMAND {
ISO14B_CONNECT = (1 << 0), ISO14B_CONNECT = (1 << 0),
ISO14B_DISCONNECT = (1 << 1), ISO14B_DISCONNECT = (1 << 1),
ISO14B_APDU = (1 << 2), ISO14B_APDU = (1 << 2),
ISO14B_RAW = (1 << 3), ISO14B_RAW = (1 << 3),
ISO14B_REQUEST_TRIGGER = (1 << 4), ISO14B_REQUEST_TRIGGER = (1 << 4),
ISO14B_APPEND_CRC = (1 << 5), ISO14B_APPEND_CRC = (1 << 5),
ISO14B_SELECT_STD = (1 << 6), ISO14B_SELECT_STD = (1 << 6),
ISO14B_SELECT_SR = (1 << 7), ISO14B_SELECT_SR = (1 << 7),
ISO14B_SET_TIMEOUT = (1 << 8), ISO14B_SET_TIMEOUT = (1 << 8),
ISO14B_SEND_CHAINING = (1 << 9), ISO14B_SEND_CHAINING = (1 << 9),
ISO14B_SELECT_CTS = (1 << 10), ISO14B_SELECT_CTS = (1 << 10),
ISO14B_CLEARTRACE = (1 << 11), ISO14B_CLEARTRACE = (1 << 11),
} iso14b_command_t; } iso14b_command_t;
#endif // _ISO14B_H_ #endif // _ISO14B_H_

View file

@ -21,12 +21,12 @@ typedef struct {
} PACKED iso14b_card_select_t; } PACKED iso14b_card_select_t;
typedef enum ISO15_COMMAND { typedef enum ISO15_COMMAND {
ISO15_CONNECT = (1 << 0), ISO15_CONNECT = (1 << 0),
ISO15_NO_DISCONNECT = (1 << 1), ISO15_NO_DISCONNECT = (1 << 1),
ISO15_RAW = (1 << 2), ISO15_RAW = (1 << 2),
ISO15_APPEND_CRC = (1 << 3), ISO15_APPEND_CRC = (1 << 3),
ISO15_HIGH_SPEED = (1 << 4), ISO15_HIGH_SPEED = (1 << 4),
ISO15_READ_RESPONSE = (1 << 5) ISO15_READ_RESPONSE = (1 << 5)
} iso15_command_t; } iso15_command_t;

View file

@ -13,11 +13,11 @@
#include "common.h" #include "common.h"
typedef enum FELICA_COMMAND { typedef enum FELICA_COMMAND {
FELICA_CONNECT = (1 << 0), FELICA_CONNECT = (1 << 0),
FELICA_NO_DISCONNECT = (1 << 1), FELICA_NO_DISCONNECT = (1 << 1),
FELICA_RAW = (1 << 3), FELICA_RAW = (1 << 3),
FELICA_APPEND_CRC = (1 << 5), FELICA_APPEND_CRC = (1 << 5),
FELICA_NO_SELECT = (1 << 6), FELICA_NO_SELECT = (1 << 6),
} felica_command_t; } felica_command_t;
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -124,13 +124,13 @@ typedef struct {
} PACKED smart_card_atr_t; } PACKED smart_card_atr_t;
typedef enum SMARTCARD_COMMAND { typedef enum SMARTCARD_COMMAND {
SC_CONNECT = (1 << 0), SC_CONNECT = (1 << 0),
SC_NO_DISCONNECT = (1 << 1), SC_NO_DISCONNECT = (1 << 1),
SC_RAW = (1 << 2), SC_RAW = (1 << 2),
SC_SELECT = (1 << 3), SC_SELECT = (1 << 3),
SC_RAW_T0 = (1 << 4), SC_RAW_T0 = (1 << 4),
SC_CLEARLOG = (1 << 5), SC_CLEARLOG = (1 << 5),
SC_LOG = (1 << 6), SC_LOG = (1 << 6),
} smartcard_command_t; } smartcard_command_t;

View file

@ -268,15 +268,13 @@ static void *brute_thread(void *arguments) {
printf("CMD enc(%08x)\n", cmd_enc); printf("CMD enc(%08x)\n", cmd_enc);
printf(" dec(%08x)\t", decrypted); printf(" dec(%08x)\t", decrypted);
uint8_t isOK = 0;
// check if cmd exists // check if cmd exists
isOK = checkValidCmd(decrypted); uint8_t isOK = checkValidCmd(decrypted);
(void)isOK; (void)isOK;
// Add a crc-check. // Add a crc-check.
isOK = checkCRC(decrypted); isOK = checkCRC(decrypted);
if (isOK == false) {
if (!isOK) {
printf("<-- not a valid cmd\n"); printf("<-- not a valid cmd\n");
pthread_mutex_unlock(&print_lock); pthread_mutex_unlock(&print_lock);
free(revstate); free(revstate);
@ -305,6 +303,8 @@ static void *brute_thread(void *arguments) {
pthread_mutex_unlock(&print_lock); pthread_mutex_unlock(&print_lock);
} }
} }
if (revstate)
free(revstate);
free(args); free(args);
return NULL; return NULL;