make style
This commit is contained in:
@@ -241,7 +241,7 @@ int CmdHFTune(const char *Cmd) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// Collects pars of u8,
|
||||
// Collects pars of u8,
|
||||
// uses 16bit transfers from FPGA for speed
|
||||
// Takes all available bigbuff memory
|
||||
// data sample to download? Not sure what we can do with the data.
|
||||
@@ -258,7 +258,7 @@ int CmdHFSniff(const char *Cmd) {
|
||||
params.triggersToSkip = param_get32ex(Cmd, 1, 0, 10);
|
||||
|
||||
clearCommandBuffer();
|
||||
SendCommandNG(CMD_HF_SNIFF, (uint8_t*)¶ms, sizeof(params));
|
||||
SendCommandNG(CMD_HF_SNIFF, (uint8_t *)¶ms, sizeof(params));
|
||||
|
||||
for (;;) {
|
||||
|
||||
@@ -279,10 +279,10 @@ int CmdHFSniff(const char *Cmd) {
|
||||
PrintAndLogEx(INFO, "HF sniff len %u bytes", len);
|
||||
PrintAndLogEx(HINT, "Use `" _YELLOW_("data plot") "` to view");
|
||||
PrintAndLogEx(HINT, "Use `" _YELLOW_("data save") "` to save");
|
||||
|
||||
// download bigbuf_malloced..
|
||||
// it reservs mem from the higher range. ie we can't start from beginning idx 0.
|
||||
// but from
|
||||
|
||||
// download bigbuf_malloced..
|
||||
// it reservs mem from the higher range. ie we can't start from beginning idx 0.
|
||||
// but from
|
||||
uint32_t start = pm3_capabilities.bigbuf_size - len;
|
||||
int res = getSamplesEx(start, start + len, false);
|
||||
if (res != PM3_SUCCESS) {
|
||||
|
||||
@@ -4545,7 +4545,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
|
||||
// copy default NDEF key
|
||||
uint8_t akey[6] = {0};
|
||||
memcpy(akey, g_mifare_ndef_key, 6);
|
||||
|
||||
|
||||
// user specified key
|
||||
if (keylen == 6) {
|
||||
memcpy(akey, key, 6);
|
||||
@@ -4584,7 +4584,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
|
||||
|
||||
for (int i = 0; i < madlen; i++) {
|
||||
if (aaid == mad[i]) {
|
||||
|
||||
|
||||
uint8_t vsector[16 * 4] = {0};
|
||||
if (mfReadSector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, akey, vsector)) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
@@ -4611,7 +4611,7 @@ static int CmdHF14AMfMAD(const char *Cmd) {
|
||||
for (int i = 0; i < 4; i ++)
|
||||
PrintAndLogEx(INFO, "[%d] %s", i, sprint_hex(§or0[i * 16], 16));
|
||||
}
|
||||
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -4669,7 +4669,7 @@ static int CmdHFMFNDEF(const char *Cmd) {
|
||||
PrintAndLogEx(HINT, "Try " _YELLOW_("`hf mf ndef -k `") " with your custom key");
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
|
||||
|
||||
bool haveMAD2 = false;
|
||||
int res = MADCheck(sector0, NULL, verbose, &haveMAD2);
|
||||
if (res != PM3_SUCCESS) {
|
||||
|
||||
@@ -1400,7 +1400,7 @@ static int CmdHFMFPMAD(const char *Cmd) {
|
||||
|
||||
for (int i = 0; i < madlen; i++) {
|
||||
if (aaid == mad[i]) {
|
||||
|
||||
|
||||
uint8_t vsector[16 * 4] = {0};
|
||||
if (mfReadSector(i + 1, keyB ? MF_KEY_B : MF_KEY_A, akey, vsector)) {
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
@@ -1472,7 +1472,7 @@ static int CmdHFMFPNDEF(const char *Cmd) {
|
||||
|
||||
if (verbose)
|
||||
PrintAndLogEx(INFO, "reading MAD v1 sector");
|
||||
|
||||
|
||||
if (mfpReadSector(MF_MAD1_SECTOR, MF_KEY_A, (uint8_t *)g_mifarep_mad_key, sector0, verbose)) {
|
||||
PrintAndLogEx(ERR, "error, read sector 0. card don't have MAD or don't have MAD on default keys");
|
||||
PrintAndLogEx(HINT, "Try " _YELLOW_("`hf mfp ndef -k `") " with your custom key");
|
||||
@@ -1487,7 +1487,7 @@ static int CmdHFMFPNDEF(const char *Cmd) {
|
||||
}
|
||||
|
||||
if (haveMAD2) {
|
||||
|
||||
|
||||
if (verbose)
|
||||
PrintAndLogEx(INFO, "reading MAD v2 sector");
|
||||
|
||||
|
||||
@@ -1014,7 +1014,7 @@ int EM4x50Read(const char *Cmd, bool verbose) {
|
||||
PrintAndLogEx(INFO, "%03d | %08x", block, Code[block]);
|
||||
}
|
||||
PrintAndLogEx(INFO, "----+--------------");
|
||||
PrintAndLogEx( (AllPTest) ? SUCCESS : WARNING, "Parities checks | %s", (AllPTest) ? _GREEN_("Passed") : _RED_("Fail"));
|
||||
PrintAndLogEx((AllPTest) ? SUCCESS : WARNING, "Parities checks | %s", (AllPTest) ? _GREEN_("Passed") : _RED_("Fail"));
|
||||
|
||||
if (AllPTest == false) {
|
||||
PrintAndLogEx(HINT, "Try cleaning the read samples with " _YELLOW_("'data askedge'"));
|
||||
|
||||
@@ -36,8 +36,7 @@
|
||||
// Partly ripped from PyRun_SimpleFileExFlags
|
||||
// but does not terminate client on sys.exit
|
||||
// and print exit code only if != 0
|
||||
static int Pm3PyRun_SimpleFileNoExit(FILE *fp, const char *filename)
|
||||
{
|
||||
static int Pm3PyRun_SimpleFileNoExit(FILE *fp, const char *filename) {
|
||||
PyObject *m, *d, *v;
|
||||
int set_file_name = 0, ret = -1;
|
||||
m = PyImport_AddModule("__main__");
|
||||
@@ -86,7 +85,7 @@ static int Pm3PyRun_SimpleFileNoExit(FILE *fp, const char *filename)
|
||||
}
|
||||
Py_DECREF(v);
|
||||
ret = 0;
|
||||
done:
|
||||
done:
|
||||
if (set_file_name && PyDict_DelItemString(d, "__file__"))
|
||||
PyErr_Clear();
|
||||
Py_XDECREF(m);
|
||||
|
||||
@@ -1455,7 +1455,7 @@ static int CmdEMVScan(const char *Cmd) {
|
||||
// current path + file name
|
||||
if (MergeJSON) {
|
||||
|
||||
root = json_load_file( (char*)filename, 0, &error);
|
||||
root = json_load_file((char *)filename, 0, &error);
|
||||
if (!root) {
|
||||
PrintAndLogEx(ERR, "Json error on line %d: %s", error.line, error.text);
|
||||
return PM3_EFILE;
|
||||
@@ -1750,15 +1750,15 @@ static int CmdEMVScan(const char *Cmd) {
|
||||
|
||||
if (MergeJSON == false) {
|
||||
// create unique new name
|
||||
char *fname = newfilenamemcopy((char*)filename, ".json");
|
||||
char *fname = newfilenamemcopy((char *)filename, ".json");
|
||||
if (fname == NULL) {
|
||||
return PM3_EMALLOC;
|
||||
}
|
||||
strcpy((char*)filename, fname);
|
||||
strcpy((char *)filename, fname);
|
||||
free(fname);
|
||||
}
|
||||
|
||||
res = json_dump_file(root, (char*)filename, JSON_INDENT(2));
|
||||
res = json_dump_file(root, (char *)filename, JSON_INDENT(2));
|
||||
if (res) {
|
||||
PrintAndLogEx(ERR, "Can't save the file: %s", filename);
|
||||
return PM3_EFILE;
|
||||
|
||||
@@ -504,19 +504,19 @@ struct emv_pk *emv_pk_get_ca_pk(const unsigned char *rid, unsigned char idx) {
|
||||
bool isok = emv_pk_verify(pk);
|
||||
|
||||
PrintAndLogEx(INFO, "Verifying CA PK for %02hhx:%02hhx:%02hhx:%02hhx:%02hhx IDX %02hhx %zu bits. ( %s )",
|
||||
pk->rid[0],
|
||||
pk->rid[1],
|
||||
pk->rid[2],
|
||||
pk->rid[3],
|
||||
pk->rid[4],
|
||||
pk->index,
|
||||
pk->mlen * 8,
|
||||
(isok) ? _GREEN_("ok") : _RED_("failed")
|
||||
);
|
||||
pk->rid[0],
|
||||
pk->rid[1],
|
||||
pk->rid[2],
|
||||
pk->rid[3],
|
||||
pk->rid[4],
|
||||
pk->index,
|
||||
pk->mlen * 8,
|
||||
(isok) ? _GREEN_("ok") : _RED_("failed")
|
||||
);
|
||||
|
||||
if (isok) {
|
||||
return pk;
|
||||
}
|
||||
}
|
||||
|
||||
emv_pk_free(pk);
|
||||
return NULL;
|
||||
|
||||
@@ -1369,17 +1369,17 @@ static int convert_plain_mfu_dump(uint8_t **dump, size_t *dumplen, bool verbose)
|
||||
}
|
||||
|
||||
static int convert_old_mfu_dump(uint8_t **dump, size_t *dumplen, bool verbose) {
|
||||
/* For reference
|
||||
typedef struct {
|
||||
uint8_t version[8];
|
||||
uint8_t tbo[2];
|
||||
uint8_t tearing[3];
|
||||
uint8_t pack[2];
|
||||
uint8_t tbo1[1];
|
||||
uint8_t signature[32];
|
||||
uint8_t data[1024];
|
||||
} PACKED old_mfu_dump_t;
|
||||
*/
|
||||
/* For reference
|
||||
typedef struct {
|
||||
uint8_t version[8];
|
||||
uint8_t tbo[2];
|
||||
uint8_t tearing[3];
|
||||
uint8_t pack[2];
|
||||
uint8_t tbo1[1];
|
||||
uint8_t signature[32];
|
||||
uint8_t data[1024];
|
||||
} PACKED old_mfu_dump_t;
|
||||
*/
|
||||
|
||||
// convert old format
|
||||
old_mfu_dump_t *old_mfu_dump = (old_mfu_dump_t *)*dump;
|
||||
@@ -1404,8 +1404,8 @@ typedef struct {
|
||||
|
||||
memcpy(mfu_dump->data, old_mfu_dump->data, sizeof(mfu_dump->data));
|
||||
mfu_dump->pages = old_data_len / 4 - 1;
|
||||
|
||||
// Add PACK to last block of memory.
|
||||
|
||||
// Add PACK to last block of memory.
|
||||
memcpy(mfu_dump->data + (mfu_dump->pages * 4 + MFU_DUMP_PREFIX_LENGTH), old_mfu_dump->pack, 2);
|
||||
|
||||
if (verbose) {
|
||||
|
||||
@@ -882,7 +882,7 @@ void mifare_cypher_blocks_chained(desfiretag_t tag, desfirekey_t key, uint8_t *i
|
||||
}
|
||||
|
||||
void desfire_crc32(const uint8_t *data, const size_t len, uint8_t *crc) {
|
||||
crc32_ex(data,len,crc);
|
||||
crc32_ex(data, len, crc);
|
||||
}
|
||||
|
||||
void desfire_crc32_append(uint8_t *data, const size_t len) {
|
||||
|
||||
@@ -173,7 +173,7 @@ int MADCheck(uint8_t *sector0, uint8_t *sector10, bool verbose, bool *haveMAD2)
|
||||
if (sector0 == NULL)
|
||||
return PM3_EINVARG;
|
||||
|
||||
uint8_t GPB = sector0[3 * 16 + 9];
|
||||
uint8_t GPB = sector0[3 * 16 + 9];
|
||||
if (verbose)
|
||||
PrintAndLogEx(SUCCESS, "%14s " _GREEN_("0x%02x"), "GPB", GPB);
|
||||
|
||||
@@ -304,7 +304,7 @@ int MAD1DecodeAndPrint(uint8_t *sector, bool swapmad, bool verbose, bool *haveMA
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "---------------- " _CYAN_("Listing") " ----------------");
|
||||
|
||||
|
||||
PrintAndLogEx(INFO, " 00 MAD v1");
|
||||
uint32_t prev_aid = 0xFFFFFFFF;
|
||||
for (int i = 1; i < 16; i++) {
|
||||
@@ -326,10 +326,10 @@ int MAD1DecodeAndPrint(uint8_t *sector, bool swapmad, bool verbose, bool *haveMA
|
||||
|
||||
int MAD2DecodeAndPrint(uint8_t *sector, bool swapmad, bool verbose) {
|
||||
open_mad_file(&mad_known_aids, verbose);
|
||||
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "------------ " _CYAN_("MAD v2 details") " -------------");
|
||||
|
||||
|
||||
int res = madCRCCheck(sector, true, 2);
|
||||
if (verbose) {
|
||||
if (res == PM3_SUCCESS)
|
||||
@@ -347,7 +347,7 @@ int MAD2DecodeAndPrint(uint8_t *sector, bool swapmad, bool verbose) {
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "---------------- " _CYAN_("Listing") " ----------------");
|
||||
|
||||
|
||||
PrintAndLogEx(INFO, " 16 MAD v2");
|
||||
|
||||
uint32_t prev_aid = 0xFFFFFFFF;
|
||||
|
||||
Reference in New Issue
Block a user