make style
This commit is contained in:
1 parent
232843477c
commit
dbec6edfa7
14 files changed
+164
-131
No files matched your search
+1
-1
@@ -32,7 +32,7 @@ const char *getAtrInfo(const char *atr_str) {
|
||||
}
|
||||
|
||||
for (int j = 0; j < slen; j++) {
|
||||
tmp_atr[j] = AtrTable[i].bytes[j]=='.' ? '.' : atr_str[j];
|
||||
tmp_atr[j] = AtrTable[i].bytes[j] == '.' ? '.' : atr_str[j];
|
||||
}
|
||||
|
||||
if (strncmp(tmp_atr, AtrTable[i].bytes, slen) == 0) {
|
||||
|
||||
@@ -1012,7 +1012,7 @@ static int CmdAnalyseFreq(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, " 13.56 mHz has %f m, rf range %f m", len_1356, rf_range_1356);
|
||||
|
||||
|
||||
if (F == 0 && C == 0 && L == 0)
|
||||
if (F == 0 && C == 0 && L == 0)
|
||||
return PM3_SUCCESS;
|
||||
|
||||
|
||||
@@ -1021,22 +1021,22 @@ static int CmdAnalyseFreq(const char *Cmd) {
|
||||
|
||||
// From https://goodcalculators.com/resonant-frequency-calculator/
|
||||
// Calc Resonant Frequency [Hz]
|
||||
// f = 1 / (2π √L C)
|
||||
// f = 1 / (2π √L C)
|
||||
if (F == 0) {
|
||||
double calc_freq = 1 / (2 * M_PI * sqrtf((L * C)) );
|
||||
double calc_freq = 1 / (2 * M_PI * sqrtf((L * C)));
|
||||
PrintAndLogEx(INFO, "Resonating Frequency %lf Hz", calc_freq);
|
||||
}
|
||||
// Calc Inductance [H]
|
||||
// L = 1 / (4π2 f2 C)
|
||||
// L = 1 / (4π2 f2 C)
|
||||
if (L == 0) {
|
||||
double calc_inductance = 1 / (4 * (M_PI * M_PI) * (F * F) * C );
|
||||
double calc_inductance = 1 / (4 * (M_PI * M_PI) * (F * F) * C);
|
||||
PrintAndLogEx(INFO, "Inductance %lf Henries", calc_inductance);
|
||||
}
|
||||
|
||||
// Capacitance [F]
|
||||
// C = 1 / (4π2 f2 L)
|
||||
if (C == 0) {
|
||||
double calc_capacitance = 1 / (4 * (M_PI * M_PI) * (F * F) * L);
|
||||
double calc_capacitance = 1 / (4 * (M_PI * M_PI) * (F * F) * L);
|
||||
PrintAndLogEx(INFO, "Capacitance %lf Farads", calc_capacitance);
|
||||
}
|
||||
return PM3_SUCCESS;
|
||||
|
||||
+1
-1
@@ -454,7 +454,7 @@ static int CmdrevengSearch(const char *Cmd) {
|
||||
memset(result, 0, 30);
|
||||
char *inCRC = calloc(crcChars + 1, sizeof(char));
|
||||
if (inCRC == NULL) {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
memcpy(inCRC, inHexStr + (dataLen - crcChars), crcChars);
|
||||
|
||||
+16
-16
@@ -2479,9 +2479,9 @@ void printIclassDumpContents(uint8_t *iclass_dump, uint8_t startblock, uint8_t e
|
||||
PrintAndLogEx(INFO, " block# | data | ascii |lck| info");
|
||||
PrintAndLogEx(INFO, "---------+-------------------------+----------+---+--------------");
|
||||
PrintAndLogEx(INFO, " 0/0x00 | " _GREEN_("%s") "| " _GREEN_("%s") " | | CSN "
|
||||
, sprint_hex(iclass_dump, 8)
|
||||
, sprint_ascii(iclass_dump, 8)
|
||||
);
|
||||
, sprint_hex(iclass_dump, 8)
|
||||
, sprint_ascii(iclass_dump, 8)
|
||||
);
|
||||
|
||||
if (i != 1)
|
||||
PrintAndLogEx(INFO, "....");
|
||||
@@ -2535,12 +2535,12 @@ void printIclassDumpContents(uint8_t *iclass_dump, uint8_t startblock, uint8_t e
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, "%3d/0x%02X | %s | %s | %s "
|
||||
, i
|
||||
, i
|
||||
, sprint_hex_ascii(blk, 8)
|
||||
, lockstr
|
||||
, s
|
||||
);
|
||||
, i
|
||||
, i
|
||||
, sprint_hex_ascii(blk, 8)
|
||||
, lockstr
|
||||
, s
|
||||
);
|
||||
|
||||
} else {
|
||||
const char *info_ks[] = {"CSN", "Config", "E-purse", "Debit", "Credit", "AIA", "User"};
|
||||
@@ -2550,13 +2550,13 @@ void printIclassDumpContents(uint8_t *iclass_dump, uint8_t startblock, uint8_t e
|
||||
}
|
||||
if (i >= 6 && i <= 9) {
|
||||
PrintAndLogEx(INFO, "%3d/0x%02X | " _YELLOW_("%s") "| " _YELLOW_("%s") " | %s | %s "
|
||||
, i
|
||||
, i
|
||||
, sprint_hex(blk, 8)
|
||||
, sprint_ascii(blk, 8)
|
||||
, lockstr
|
||||
, s
|
||||
);
|
||||
, i
|
||||
, i
|
||||
, sprint_hex(blk, 8)
|
||||
, sprint_ascii(blk, 8)
|
||||
, lockstr
|
||||
, s
|
||||
);
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "%3d/0x%02X | %s | %s | %s ", i, i, sprint_hex_ascii(blk, 8), lockstr, s);
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool i
|
||||
snprintf(exp, size, "AUTH-1 ");
|
||||
break;
|
||||
case MIFARE_ULC_AUTH_2:
|
||||
if ((gs_mfuc_state == 2) && (cmdsize==19)){
|
||||
if ((gs_mfuc_state == 2) && (cmdsize == 19)) {
|
||||
memcpy(gs_mfuc_authdata[1], &cmd[1], 16);
|
||||
if (trace_mfuc_try_default_3des_keys(&gs_mfuc_key, gs_mfuc_state, gs_mfuc_authdata) == PM3_SUCCESS) {
|
||||
// buffer too small to print the full key,
|
||||
@@ -371,26 +371,26 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool i
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (gs_mfuc_state==1) {
|
||||
if ((cmd[0]==0xAF) && (cmdsize==11)) {
|
||||
if (gs_mfuc_state == 1) {
|
||||
if ((cmd[0] == 0xAF) && (cmdsize == 11)) {
|
||||
// register RndB
|
||||
memcpy(gs_mfuc_authdata[0], &cmd[1], 8);
|
||||
gs_mfuc_state=2;
|
||||
gs_mfuc_state = 2;
|
||||
} else {
|
||||
gs_mfuc_state=0;
|
||||
gs_mfuc_state = 0;
|
||||
}
|
||||
}
|
||||
if (gs_mfuc_state==3) {
|
||||
if ((cmd[0]==0x00) && (cmdsize==11)) {
|
||||
if (gs_mfuc_state == 3) {
|
||||
if ((cmd[0] == 0x00) && (cmdsize == 11)) {
|
||||
// register RndA'
|
||||
memcpy(gs_mfuc_authdata[2], &cmd[1], 8);
|
||||
if (trace_mfuc_try_default_3des_keys(&gs_mfuc_key, gs_mfuc_state, gs_mfuc_authdata) == PM3_SUCCESS) {
|
||||
snprintf(exp, size, "AUTH-2 ANSW OK");
|
||||
gs_mfuc_state=0;
|
||||
gs_mfuc_state = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
gs_mfuc_state=0;
|
||||
gs_mfuc_state = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -822,7 +822,7 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
||||
xdump.card_info = card;
|
||||
xdump.dump = (uint8_t *)carddata;
|
||||
xdump.dumplen = bytes;
|
||||
saveFileJSON(dataFilename, jsfCardMemory, (uint8_t*)&xdump, sizeof(xdump), NULL);
|
||||
saveFileJSON(dataFilename, jsfCardMemory, (uint8_t *)&xdump, sizeof(xdump), NULL);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -2603,7 +2603,7 @@ all_found:
|
||||
xdump.card_info = card;
|
||||
xdump.dump = dump;
|
||||
xdump.dumplen = bytes;
|
||||
saveFileJSON(filename, jsfCardMemory, (uint8_t*)&xdump, sizeof(xdump), NULL);
|
||||
saveFileJSON(filename, jsfCardMemory, (uint8_t *)&xdump, sizeof(xdump), NULL);
|
||||
|
||||
// Generate and show statistics
|
||||
t1 = msclock() - t1;
|
||||
@@ -4008,7 +4008,7 @@ static int CmdHF14AMfESave(const char *Cmd) {
|
||||
}
|
||||
xdump.dump = dump;
|
||||
xdump.dumplen = bytes;
|
||||
saveFileJSON(filename, jsfCardMemory, (uint8_t*)&xdump, sizeof(xdump), NULL);
|
||||
saveFileJSON(filename, jsfCardMemory, (uint8_t *)&xdump, sizeof(xdump), NULL);
|
||||
free(dump);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
@@ -4845,7 +4845,7 @@ static int CmdHF14AMfCSave(const char *Cmd) {
|
||||
xdump.card_info = card;
|
||||
xdump.dump = dump;
|
||||
xdump.dumplen = bytes;
|
||||
saveFileJSON(filename, jsfCardMemory, (uint8_t*)&xdump, sizeof(xdump), NULL);
|
||||
saveFileJSON(filename, jsfCardMemory, (uint8_t *)&xdump, sizeof(xdump), NULL);
|
||||
free(dump);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -269,8 +269,8 @@ static int trace_mfuc_try_key(uint8_t *key, int state, uint8_t (*authdata)[16])
|
||||
mbedtls_des3_crypt_cbc(&ctx_des3, MBEDTLS_DES_DECRYPT,
|
||||
16, iv, authdata[1], RndARndB);
|
||||
if ((memcmp(&RndB[1], &RndARndB[8], 7) == 0) &&
|
||||
(RndB[0] == RndARndB[15])) {
|
||||
return PM3_SUCCESS;
|
||||
(RndB[0] == RndARndB[15])) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
@@ -284,8 +284,8 @@ static int trace_mfuc_try_key(uint8_t *key, int state, uint8_t (*authdata)[16])
|
||||
mbedtls_des3_crypt_cbc(&ctx_des3, MBEDTLS_DES_DECRYPT,
|
||||
8, iv, authdata[2], RndA);
|
||||
if ((memcmp(&RndARndB[1], RndA, 7) == 0) &&
|
||||
(RndARndB[0] == RndA[7])) {
|
||||
return PM3_SUCCESS;
|
||||
(RndARndB[0] == RndA[7])) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ static int CmdNfcDecode(const char *Cmd) {
|
||||
|
||||
bool verbose = arg_get_lit(ctx, 3);
|
||||
CLIParserFree(ctx);
|
||||
if (((datalen != 0) && (fnlen != 0)) || ((datalen == 0) && (fnlen == 0))){
|
||||
if (((datalen != 0) && (fnlen != 0)) || ((datalen == 0) && (fnlen == 0))) {
|
||||
PrintAndLogEx(ERR, "You must provide either data in hex or a filename");
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
|
||||
break;
|
||||
}
|
||||
case jsfCardMemory: {
|
||||
iso14a_mf_extdump_t* xdump = (iso14a_mf_extdump_t*) data;
|
||||
iso14a_mf_extdump_t *xdump = (iso14a_mf_extdump_t *) data;
|
||||
JsonSaveStr(root, "FileType", "mfcard");
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.UID", xdump->card_info.uid, xdump->card_info.uidlen);
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.ATQA", xdump->card_info.atqa, 2);
|
||||
|
||||
@@ -662,9 +662,9 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl
|
||||
uint32_t max_keys_chunk = keycnt > maxkeysinblock ? maxkeysinblock : keycnt;
|
||||
|
||||
uint8_t *mem = NULL;
|
||||
uint8_t *p_keyblock = NULL;
|
||||
uint8_t *p_keyblock = NULL;
|
||||
|
||||
if (IfPm3Flash()) {
|
||||
if (IfPm3Flash()) {
|
||||
|
||||
// used for mfCheckKeys_file, which needs a header
|
||||
mem = calloc((maxkeysinblock * 6) + 5, sizeof(uint8_t));
|
||||
|
||||
Reference in new issue
Block a user