This commit is contained in:
iceman1001 2021-04-16 17:10:08 +02:00
parent 5775a283e9
commit d2646122e7
16 changed files with 404 additions and 404 deletions

View file

@ -326,7 +326,7 @@ static int CmdSetDebugMode(const char *Cmd) {
bool dg_2 = arg_get_lit(ctx, 3);
CLIParserFree(ctx);
if (dg_0 + dg_1 + dg_2 > 1 ) {
if (dg_0 + dg_1 + dg_2 > 1) {
PrintAndLogEx(INFO, "Select only one option");
return PM3_EINVARG;
}
@ -339,7 +339,7 @@ static int CmdSetDebugMode(const char *Cmd) {
if (dg_2)
g_debugMode = 2;
switch(g_debugMode) {
switch (g_debugMode) {
case 0:
PrintAndLogEx(INFO, "client debug level... %u ( no debug messages )", g_debugMode);
break;
@ -436,7 +436,7 @@ int CmdPrintDemodBuff(const char *Cmd) {
arg_param_begin,
arg_lit0("i", "inv", "invert Demodbuffer before printing"),
// arg_int0("l","len", "<dec>", "length to print in # of bits or hex characters respectively"),
arg_int0("o","offset", "<dec>", "offset in # of bits"),
arg_int0("o", "offset", "<dec>", "offset in # of bits"),
arg_lit0("s", "strip", "strip leading zeroes, i.e. set offset to first bit equal to one"),
arg_lit0("x", "hex", "output in hex (omit for binary output)"),
arg_param_end
@ -1768,7 +1768,7 @@ static int CmdSamples(const char *Cmd) {
);
void *argtable[] = {
arg_param_begin,
arg_int0("n","", "<dec>", "num of samples (512 - 40000)"),
arg_int0("n", "", "<dec>", "num of samples (512 - 40000)"),
arg_lit0("v", "verbose", "verbose"),
arg_param_end
};
@ -2703,7 +2703,7 @@ typedef struct {
static int print_modulation(lf_modulation_t b) {
PrintAndLogEx(INFO, " Modulation........ " _GREEN_("%s"), GetSelectedModulationStr(b.modulation));
PrintAndLogEx(INFO, " Bit clock......... " _GREEN_("RF/%d"), b.bitrate);
PrintAndLogEx(INFO, " Approx baudrate... " _GREEN_("%.f") "bauds", (125000 / (float)b.bitrate) );
PrintAndLogEx(INFO, " Approx baudrate... " _GREEN_("%.f") "bauds", (125000 / (float)b.bitrate));
switch (b.modulation) {
case DEMOD_PSK1:
case DEMOD_PSK2:

View file

@ -1151,7 +1151,7 @@ static int CmdHF14BWriteSri(const char *Cmd) {
CLIExecWithReturn(ctx, Cmd, argtable, false);
int blockno = arg_get_int_def(ctx, 1, -1);
int dlen = 0;
uint8_t data[4] = {0,0,0,0};
uint8_t data[4] = {0, 0, 0, 0};
int res = CLIParamHexToBuf(arg_get_str(ctx, 2), data, sizeof(data), &dlen);
if (res) {
CLIParserFree(ctx);

View file

@ -470,7 +470,7 @@ static uint8_t arg_add_default(void *at[]) {
at[5] = arg_lit0("o", "opt", "set OPTION Flag (needed for TI)");
return 6;
}
static uint16_t arg_get_raw_flag(uint8_t uidlen, bool unaddressed, bool scan, bool add_option ) {
static uint16_t arg_get_raw_flag(uint8_t uidlen, bool unaddressed, bool scan, bool add_option) {
uint16_t flags = 0;
if (unaddressed) {
// unaddressed mode may not be supported by all vendors
@ -808,7 +808,7 @@ static int CmdHF15Info(const char *Cmd) {
"hf 15 info -u E011223344556677"
);
void *argtable[6+1] = {};
void *argtable[6 + 1] = {};
uint8_t arglen = arg_add_default(argtable);
argtable[arglen++] = arg_param_end;
@ -1081,7 +1081,7 @@ static int CmdHF15WriteAfi(const char *Cmd) {
"hf 15 writeafi -u E011223344556677 --afi 12"
);
void *argtable[6+2] = {};
void *argtable[6 + 2] = {};
uint8_t arglen = arg_add_default(argtable);
argtable[arglen++] = arg_int1(NULL, "afi", "<dec>", "AFI number (0-255)");
argtable[arglen++] = arg_param_end;
@ -1178,7 +1178,7 @@ static int CmdHF15WriteDsfid(const char *Cmd) {
"hf 15 writedsfid -u E011223344556677 --dsfid 12"
);
void *argtable[6+2] = {};
void *argtable[6 + 2] = {};
uint8_t arglen = arg_add_default(argtable);
argtable[arglen++] = arg_int1(NULL, "dsfid", "<dec>", "DSFID number (0-255)");
argtable[arglen++] = arg_param_end;
@ -1239,7 +1239,7 @@ static int CmdHF15WriteDsfid(const char *Cmd) {
// arg2 (recv == 1 == expect a response)
uint8_t read_respone = 1;
PrintAndLogEx(DEBUG, "cmd %s", sprint_hex(req, reqlen) );
PrintAndLogEx(DEBUG, "cmd %s", sprint_hex(req, reqlen));
PacketResponseNG resp;
clearCommandBuffer();
SendCommandMIX(CMD_HF_ISO15693_COMMAND, reqlen, fast, read_respone, req, reqlen);
@ -1279,7 +1279,7 @@ static int CmdHF15Dump(const char *Cmd) {
"hf 15 dump -u E011223344556677 -f hf-15-my-dump.bin"
);
void *argtable[6+2] = {};
void *argtable[6 + 2] = {};
uint8_t arglen = arg_add_default(argtable);
argtable[arglen++] = arg_str0("f", "file", "<fn>", "filename of dump"),
argtable[arglen++] = arg_param_end;
@ -1519,7 +1519,7 @@ static int CmdHF15Readmulti(const char *Cmd) {
"hf 15 rdmulti -u E011223344556677 -b 12 --cnt 3 -> read three blocks"
);
void *argtable[6+3] = {};
void *argtable[6 + 3] = {};
uint8_t arglen = arg_add_default(argtable);
argtable[arglen++] = arg_int1("b", NULL, "<dec>", "first page number (0-255)");
argtable[arglen++] = arg_int1(NULL, "cnt", "<dec>", "number of pages (1-6)");
@ -1655,7 +1655,7 @@ static int CmdHF15Readblock(const char *Cmd) {
"hf 15 rdbl -u E011223344556677 -b 12"
);
void *argtable[6+2] = {};
void *argtable[6 + 2] = {};
uint8_t arglen = arg_add_default(argtable);
argtable[arglen++] = arg_int1("b", "blk", "<dec>", "page number (0-255)");
argtable[arglen++] = arg_param_end;
@ -1821,7 +1821,7 @@ static int CmdHF15Write(const char *Cmd) {
"hf 15 wrbl -u E011223344556677 -b 12 -d AABBCCDD"
);
void *argtable[6+4] = {};
void *argtable[6 + 4] = {};
uint8_t arglen = arg_add_default(argtable);
argtable[arglen++] = arg_int1("b", "blk", "<dec>", "page number (0-255)");
argtable[arglen++] = arg_str1("d", "data", "<hex>", "data, 4 bytes");
@ -1915,7 +1915,7 @@ static int CmdHF15Restore(const char *Cmd) {
"hf 15 restore -u E011223344556677 -f hf-15-my-dump.bin"
);
void *argtable[6+5] = {};
void *argtable[6 + 5] = {};
uint8_t arglen = arg_add_default(argtable);
argtable[arglen++] = arg_str0("f", "file", "<fn>", "filename of dump"),
argtable[arglen++] = arg_int0("r", "retry", "<dec>", "number of retries (def 3)"),

View file

@ -569,7 +569,7 @@ static int CmdHFFelicaAuthentication1(const char *Cmd) {
}
uint8_t data[PM3_CMD_DATA_SIZE];
memset(data, 0 , sizeof(data));
memset(data, 0, sizeof(data));
data[0] = 0x0C; // Static length
data[1] = 0x3E; // Command ID
@ -615,7 +615,7 @@ static int CmdHFFelicaAuthentication1(const char *Cmd) {
}
// READER CHALLENGE - (RANDOM To Encrypt = Rac)
uint8_t nonce[8] = {1,2,3,4,5,6,7,8};
uint8_t nonce[8] = {1, 2, 3, 4, 5, 6, 7, 8};
PrintAndLogEx(INFO, "Reader challenge (unencrypted): %s", sprint_hex(nonce, 8));
// Create M1c Challenge with 3DES (3 Keys = 24, 2 Keys = 16)
@ -758,7 +758,7 @@ static int CmdHFFelicaAuthentication2(const char *Cmd) {
}
uint8_t data[PM3_CMD_DATA_SIZE];
memset(data, 0 , sizeof(data));
memset(data, 0, sizeof(data));
bool custom_IDm = false;
@ -954,7 +954,7 @@ static int CmdHFFelicaWritePlain(const char *Cmd) {
}
uint8_t data[PM3_CMD_DATA_SIZE];
memset(data, 0 , sizeof(data));
memset(data, 0, sizeof(data));
data[0] = 0x20; // Static length
data[1] = 0x08; // Command ID
@ -1115,7 +1115,7 @@ static int CmdHFFelicaReadPlain(const char *Cmd) {
}
uint8_t data[PM3_CMD_DATA_SIZE];
memset(data, 0 , sizeof(data));
memset(data, 0, sizeof(data));
data[0] = 0x10; // Static length
data[1] = 0x06; // Command ID
@ -1217,7 +1217,7 @@ static int CmdHFFelicaRequestResponse(const char *Cmd) {
CLIParserFree(ctx);
uint8_t data[PM3_CMD_DATA_SIZE];
memset(data, 0 , sizeof(data));
memset(data, 0, sizeof(data));
data[0] = 0x0A; // Static length
data[1] = 0x04; // Command ID
@ -1294,7 +1294,7 @@ static int CmdHFFelicaRequestSpecificationVersion(const char *Cmd) {
return PM3_EINVARG;
}
uint8_t reserved[2] = {0,0};
uint8_t reserved[2] = {0, 0};
int rlen = 0;
res = CLIParamHexToBuf(arg_get_str(ctx, 2), reserved, sizeof(reserved), &rlen);
if (res) {
@ -1310,7 +1310,7 @@ static int CmdHFFelicaRequestSpecificationVersion(const char *Cmd) {
CLIParserFree(ctx);
uint8_t data[PM3_CMD_DATA_SIZE];
memset(data, 0 , sizeof(data));
memset(data, 0, sizeof(data));
data[0] = 0x0C; // Static length
data[1] = 0x3C; // Command ID
@ -1323,8 +1323,8 @@ static int CmdHFFelicaRequestSpecificationVersion(const char *Cmd) {
}
// add custom reserved
if (rlen ) {
memcpy(data +10, reserved, sizeof(reserved));
if (rlen) {
memcpy(data + 10, reserved, sizeof(reserved));
} else {
data[10] = 0x00; // Reserved Value
data[11] = 0x00; // Reserved Value
@ -1337,7 +1337,7 @@ static int CmdHFFelicaRequestSpecificationVersion(const char *Cmd) {
AddCrc(data, datalen);
datalen += 2;
uint8_t flags = (FELICA_APPEND_CRC |FELICA_RAW);
uint8_t flags = (FELICA_APPEND_CRC | FELICA_RAW);
clear_and_send_command(flags, datalen, data, 0);
@ -1401,7 +1401,7 @@ static int CmdHFFelicaResetMode(const char *Cmd) {
return PM3_EINVARG;
}
uint8_t reserved[2] = {0,0};
uint8_t reserved[2] = {0, 0};
int rlen = 0;
res = CLIParamHexToBuf(arg_get_str(ctx, 2), reserved, sizeof(reserved), &rlen);
if (res) {
@ -1417,7 +1417,7 @@ static int CmdHFFelicaResetMode(const char *Cmd) {
CLIParserFree(ctx);
uint8_t data[PM3_CMD_DATA_SIZE];
memset(data, 0 , sizeof(data));
memset(data, 0, sizeof(data));
data[0] = 0x0C; // Static length
data[1] = 0x3E; // Command ID
@ -1495,7 +1495,7 @@ static int CmdHFFelicaRequestSystemCode(const char *Cmd) {
uint8_t data[PM3_CMD_DATA_SIZE];
memset(data, 0 , sizeof(data));
memset(data, 0, sizeof(data));
data[0] = 0x0A; // Static length
data[1] = 0x0C; // Command ID
@ -1578,7 +1578,7 @@ static int CmdHFFelicaRequestService(const char *Cmd) {
return PM3_EINVARG;
}
uint8_t code[2] = {0,0};
uint8_t code[2] = {0, 0};
int clen = 0;
res = CLIParamHexToBuf(arg_get_str(ctx, 3), code, sizeof(code), &clen);
if (res) {
@ -1596,7 +1596,7 @@ static int CmdHFFelicaRequestService(const char *Cmd) {
CLIParserFree(ctx);
uint8_t data[PM3_CMD_DATA_SIZE];
memset(data, 0 , sizeof(data));
memset(data, 0, sizeof(data));
bool custom_IDm = false;
@ -2055,7 +2055,7 @@ static int CmdHFFelicaCmdRaw(const char *Cmd) {
int datalen = 0;
uint8_t data[PM3_CMD_DATA_SIZE];
memset(data, 0 , sizeof(data));
memset(data, 0, sizeof(data));
CLIGetHexWithReturn(ctx, 7, data, &datalen);
CLIParserFree(ctx);

View file

@ -386,7 +386,7 @@ static int CmdHF14AMfWrBl(const char *Cmd) {
} else {
PrintAndLogEx(FAILED, "Write ( " _RED_("fail") " )");
// suggest the opposite keytype than what was used.
PrintAndLogEx(HINT, "Maybe access rights? Try specify keytype " _YELLOW_("%c") " instead", (keytype == MF_KEY_A) ? 'B' : 'A' );
PrintAndLogEx(HINT, "Maybe access rights? Try specify keytype " _YELLOW_("%c") " instead", (keytype == MF_KEY_A) ? 'B' : 'A');
}
return PM3_SUCCESS;
}
@ -1774,7 +1774,7 @@ static int CmdHF14AMfNestedHard(const char *Cmd) {
PrintAndLogEx(INFO, "Target block no " _YELLOW_("%3d") ", target key type: " _YELLOW_("%c") ", known target key: " _YELLOW_("%02x%02x%02x%02x%02x%02x%s"),
trg_blockno,
(trg_keytype == MF_KEY_B)? 'B' : 'A',
(trg_keytype == MF_KEY_B) ? 'B' : 'A',
trg_key[0], trg_key[1], trg_key[2], trg_key[3], trg_key[4], trg_key[5],
know_target_key ? "" : " (not set)"
);
@ -2197,7 +2197,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) {
} else {
PrintAndLogEx(SUCCESS, "target sector %3u key type %c -- found valid key [ " _GREEN_("%s") " ]",
i,
(j == MF_KEY_B)? 'B' : 'A',
(j == MF_KEY_B) ? 'B' : 'A',
sprint_hex_inrow(tmp_key, sizeof(tmp_key))
);
}
@ -4331,7 +4331,7 @@ static int CmdHF14AMfCSetBlk(const char *Cmd) {
uint8_t wipe_card = arg_get_lit(ctx, 3);
CLIParserFree(ctx);
if (b < 0 || b >= MIFARE_1K_MAXBLOCK ) {
if (b < 0 || b >= MIFARE_1K_MAXBLOCK) {
PrintAndLogEx(FAILED, "target block number out-of-range, got %i", b);
return PM3_EINVARG;
}
@ -5520,7 +5520,7 @@ static int CmdHFMFPersonalize(const char *cmd) {
return PM3_ETIMEOUT;
}
if ( resp.status == PM3_SUCCESS) {
if (resp.status == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "Personalization ( %s )", _GREEN_("ok"));
} else {
PrintAndLogEx(FAILED, "Personalization ( %s )", _RED_("fail"));

View file

@ -2203,7 +2203,7 @@ static void init_it_all(void) {
known_target_key = 0;
test_state[0] = 0;
test_state[1] = 0;
brute_force_per_second=0;
brute_force_per_second = 0;
init_book_of_work();
real_sum_a8 = 0;

View file

@ -677,7 +677,7 @@ static int CmdHFMFPRdbl(const char *Cmd) {
void *argtable[] = {
arg_param_begin,
arg_lit0("v", "verbose", "show internal data"),
arg_int0("n", "count", "<dec>","blocks count (by default 1)"),
arg_int0("n", "count", "<dec>", "blocks count (by default 1)"),
arg_lit0("b", "keyb", "use key B (by default keyA)"),
arg_lit0("p", "plain", "plain communication mode between reader and card"),
arg_int1(NULL, "blk", "<dec>", "block number (0..255)"),

View file

@ -531,8 +531,8 @@ static int CmdLFHitagReader(const char *Cmd) {
arg_lit0(NULL, "23", "Hitag2, read all pages, crypto mode. Key ISK high + ISK low. def 4F4E4D494B52 (ONMIKR)"),
arg_lit0(NULL, "25", "Hitag2, test recorded authentications (replay?)"),
arg_lit0(NULL, "26", "Hitag2, read UID"),
arg_str0("k","key", "<hex>", "key, 4 or 6 hex bytes"),
arg_str0(NULL,"nrar", "<hex>", "nonce / answer reader, 8 hex bytes"),
arg_str0("k", "key", "<hex>", "key, 4 or 6 hex bytes"),
arg_str0(NULL, "nrar", "<hex>", "nonce / answer reader, 8 hex bytes"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, false);
@ -592,7 +592,7 @@ static int CmdLFHitagReader(const char *Cmd) {
htf = RHTSF_CHALLENGE;
memcpy(htd.auth.NrAr, nrar, sizeof(nrar));
}
if (s02){
if (s02) {
cmd = CMD_LF_HITAGS_READ;
htf = RHTSF_KEY;
memcpy(htd.crypto.key, key, sizeof(key));
@ -708,8 +708,8 @@ static int CmdLFHitagWriter(const char *Cmd) {
arg_lit0(NULL, "27", "Hitag2, write page, password mode"),
arg_int1("p", "page", "<dec>", "page address to write to"),
arg_str0("d", "data", "<hex>", "data, 4 hex bytes"),
arg_str0("k","key", "<hex>", "key, 4 or 6 hex bytes"),
arg_str0(NULL,"nrar", "<hex>", "nonce / answer writer, 8 hex bytes"),
arg_str0("k", "key", "<hex>", "key, 4 or 6 hex bytes"),
arg_str0(NULL, "nrar", "<hex>", "nonce / answer writer, 8 hex bytes"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, false);
@ -782,7 +782,7 @@ static int CmdLFHitagWriter(const char *Cmd) {
memcpy(htd.auth.NrAr, nrar, sizeof(nrar));
memcpy(htd.auth.data, data, sizeof(data));
}
if (s04){
if (s04) {
htf = WHTSF_KEY;
memcpy(htd.crypto.key, key, sizeof(key));
memcpy(htd.crypto.data, data, sizeof(data));
@ -827,8 +827,8 @@ static int CmdLFHitag2Dump(const char *Cmd) {
void *argtable[] = {
arg_param_begin,
arg_str0("f", "file", "<fn>", "file name"),
arg_str0("k","key", "<hex>", "key, 4 or 6 hex bytes"),
arg_str0(NULL,"nrar", "<hex>", "nonce / answer reader, 8 hex bytes"),
arg_str0("k", "key", "<hex>", "key, 4 or 6 hex bytes"),
arg_str0(NULL, "nrar", "<hex>", "nonce / answer reader, 8 hex bytes"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, false);
@ -858,7 +858,7 @@ static int CmdLFHitag2Dump(const char *Cmd) {
PrintAndLogEx(WARNING, "to be implememted...");
/*
/*
PrintAndLogEx(SUCCESS, "Dumping tag memory...");
clearCommandBuffer();
@ -874,7 +874,7 @@ static int CmdLFHitag2Dump(const char *Cmd) {
saveFile(filename, ".bin", data, 48);
saveFileEML(filename, data, 48, 4);
saveFileJSON(filename, jsfHitag, data, 48, NULL);
*/
*/
return PM3_SUCCESS;
}

View file

@ -2387,7 +2387,7 @@ static int CmdT55xxRestore(const char *Cmd) {
if (usepwd)
snprintf(pwdopt, sizeof(pwdopt), "-p %08X", password);
uint32_t *data = (uint32_t*) dump;
uint32_t *data = (uint32_t *) dump;
uint8_t idx;
// Restore endien for writing to card
for (idx = 0; idx < 12; idx++) {

View file

@ -444,7 +444,7 @@ static void *brute_thread(void *arguments) {
if (args->ev1) {
// if it was EV1, we know for sure xxxAAAAAAAA recovery
printf("\nKey candidate [ " _YELLOW_("....%08" PRIx64 )" ]\n\n", key & 0xFFFFFFFF);
printf("\nKey candidate [ " _YELLOW_("....%08" PRIx64)" ]\n\n", key & 0xFFFFFFFF);
__sync_fetch_and_add(&global_found_candidate, 1);
} else {
printf("\nKey candidate [ " _GREEN_("....%08" PRIx64) " ]\n\n", key & 0xFFFFFFFF);
@ -565,7 +565,7 @@ int main(int argc, char *argv[]) {
printf("at parity err........ %04x\n", at_par_err);
if (argc > 9) {
printf("next encrypted cmd... %s\n", sprint_hex_inrow_ex(enc, enc_len ,0));
printf("next encrypted cmd... %s\n", sprint_hex_inrow_ex(enc, enc_len, 0));
}
clock_t t1 = clock();
@ -635,7 +635,7 @@ int main(int argc, char *argv[]) {
printf("partial key.. %08x\n", (uint32_t)(global_candiate_key & 0xFFFFFFFF));
printf("nt enc....... %08x\n", nt_enc);
printf("nr enc....... %08x\n", nr_enc);
printf("next encrypted cmd: %s\n", sprint_hex_inrow_ex(enc, enc_len ,0));
printf("next encrypted cmd: %s\n", sprint_hex_inrow_ex(enc, enc_len, 0));
printf("\nlooking for the upper 16 bits of key\n");
fflush(stdout);