mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-07-16 10:03:04 -07:00
style
This commit is contained in:
parent
27184d7f5b
commit
007b916643
21 changed files with 226 additions and 226 deletions
|
@ -43,7 +43,7 @@ static int CmdHelp(const char *Cmd);
|
||||||
//-------------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------------
|
||||||
|
|
||||||
int rdv4_get_signature(rdv40_validation_t *out) {
|
int rdv4_get_signature(rdv40_validation_t *out) {
|
||||||
if (out == NULL) {
|
if (out == NULL) {
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ int rdv4_validate(rdv40_validation_t *mem) {
|
||||||
return PM3_EFAILED;
|
return PM3_EFAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int rdv4_sign_write(uint8_t *signature, uint8_t slen){
|
static int rdv4_sign_write(uint8_t *signature, uint8_t slen) {
|
||||||
// save to mem
|
// save to mem
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
|
@ -439,14 +439,14 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
||||||
// shall_write = arg_get_lit(ctx, 5);
|
// shall_write = arg_get_lit(ctx, 5);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
if (res || (dlen > 0 && dlen < sizeof(id)) ) {
|
if (res || (dlen > 0 && dlen < sizeof(id))) {
|
||||||
PrintAndLogEx(FAILED, "Error parsing flash memory id, expect 8, got %d", dlen);
|
PrintAndLogEx(FAILED, "Error parsing flash memory id, expect 8, got %d", dlen);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
// set up PK key context now.
|
// set up PK key context now.
|
||||||
mbedtls_pk_context pkctx;
|
mbedtls_pk_context pkctx;
|
||||||
mbedtls_pk_init( &pkctx );
|
mbedtls_pk_init(&pkctx);
|
||||||
bool got_private = false;
|
bool got_private = false;
|
||||||
// PEM
|
// PEM
|
||||||
if (pemlen) {
|
if (pemlen) {
|
||||||
|
@ -472,7 +472,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
mbedtls_rsa_context *rsa = (mbedtls_rsa_context*)pkctx.pk_ctx;
|
mbedtls_rsa_context *rsa = (mbedtls_rsa_context *)pkctx.pk_ctx;
|
||||||
if (rsa == NULL) {
|
if (rsa == NULL) {
|
||||||
PrintAndLogEx(FAILED, "failed to allocate rsa context memory");
|
PrintAndLogEx(FAILED, "failed to allocate rsa context memory");
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
|
@ -482,7 +482,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// it not loaded, we need to setup the context manually
|
// it not loaded, we need to setup the context manually
|
||||||
if (mbedtls_pk_setup( &pkctx, mbedtls_pk_info_from_type( (mbedtls_pk_type_t) MBEDTLS_PK_RSA ) ) != 0 ) {
|
if (mbedtls_pk_setup(&pkctx, mbedtls_pk_info_from_type((mbedtls_pk_type_t) MBEDTLS_PK_RSA)) != 0) {
|
||||||
PrintAndLogEx(FAILED, "failed, mbedtls_pk_setup returned ");
|
PrintAndLogEx(FAILED, "failed, mbedtls_pk_setup returned ");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
@ -491,7 +491,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
||||||
// validate devicesignature data
|
// validate devicesignature data
|
||||||
rdv40_validation_t mem;
|
rdv40_validation_t mem;
|
||||||
res = rdv4_get_signature(&mem);
|
res = rdv4_get_signature(&mem);
|
||||||
if (res != PM3_SUCCESS) {
|
if (res != PM3_SUCCESS) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
||||||
mbedtls_rsa_context *rsa = NULL;
|
mbedtls_rsa_context *rsa = NULL;
|
||||||
|
|
||||||
if (got_private) {
|
if (got_private) {
|
||||||
rsa = mbedtls_pk_rsa( pkctx );
|
rsa = mbedtls_pk_rsa(pkctx);
|
||||||
rsa->padding = MBEDTLS_RSA_PKCS_V15;
|
rsa->padding = MBEDTLS_RSA_PKCS_V15;
|
||||||
rsa->hash_id = 0;
|
rsa->hash_id = 0;
|
||||||
rsa->len = RRG_RSA_KEY_LEN;
|
rsa->len = RRG_RSA_KEY_LEN;
|
||||||
|
@ -531,7 +531,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
||||||
mbedtls_rsa_init(rsa, MBEDTLS_RSA_PKCS_V15, 0);
|
mbedtls_rsa_init(rsa, MBEDTLS_RSA_PKCS_V15, 0);
|
||||||
rsa->len = RRG_RSA_KEY_LEN;
|
rsa->len = RRG_RSA_KEY_LEN;
|
||||||
|
|
||||||
// add public key
|
// add public key
|
||||||
mbedtls_mpi_read_string(&rsa->N, 16, RRG_RSA_N);
|
mbedtls_mpi_read_string(&rsa->N, 16, RRG_RSA_N);
|
||||||
mbedtls_mpi_read_string(&rsa->E, 16, RRG_RSA_E);
|
mbedtls_mpi_read_string(&rsa->E, 16, RRG_RSA_E);
|
||||||
}
|
}
|
||||||
|
@ -587,7 +587,7 @@ static int CmdFlashMemInfo(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "--- " _CYAN_("Enter signing") " --------------------");
|
PrintAndLogEx(INFO, "--- " _CYAN_("Enter signing") " --------------------");
|
||||||
|
|
||||||
if (dlen == 8) {
|
if (dlen == 8) {
|
||||||
mbedtls_sha1(id, sizeof(id), sha_hash);
|
mbedtls_sha1(id, sizeof(id), sha_hash);
|
||||||
}
|
}
|
||||||
PrintAndLogEx(INFO, "Signing....... %s", sprint_hex_inrow(sha_hash, sizeof(sha_hash)));
|
PrintAndLogEx(INFO, "Signing....... %s", sprint_hex_inrow(sha_hash, sizeof(sha_hash)));
|
||||||
|
|
||||||
|
|
|
@ -334,7 +334,7 @@ static int CmdFlashMemSpiFFSDump(const char *Cmd) {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_str1("s", "src", "<fn>", "SPIFFS file to save"),
|
arg_str1("s", "src", "<fn>", "SPIFFS file to save"),
|
||||||
arg_str0("d", "dest", "<fn>", "file name to save to <w/o .bin>"),
|
arg_str0("d", "dest", "<fn>", "file name to save to <w/o .bin>"),
|
||||||
arg_lit0("e", "eml", "also save in EML format"),
|
arg_lit0("e", "eml", "also save in EML format"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||||
|
@ -351,7 +351,7 @@ static int CmdFlashMemSpiFFSDump(const char *Cmd) {
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
// get size from spiffs itself !
|
// get size from spiffs itself !
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SPIFFS_STAT, (uint8_t *)src, slen);
|
SendCommandNG(CMD_SPIFFS_STAT, (uint8_t *)src, slen);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_SPIFFS_STAT, &resp, 2000) == false) {
|
if (WaitForResponseTimeout(CMD_SPIFFS_STAT, &resp, 2000) == false) {
|
||||||
|
@ -495,7 +495,7 @@ static int CmdFlashMemSpiFFSView(const char *Cmd) {
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
// get size from spiffs itself !
|
// get size from spiffs itself !
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SPIFFS_STAT, (uint8_t *)src, slen);
|
SendCommandNG(CMD_SPIFFS_STAT, (uint8_t *)src, slen);
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_SPIFFS_STAT, &resp, 2000) == false) {
|
if (WaitForResponseTimeout(CMD_SPIFFS_STAT, &resp, 2000) == false) {
|
||||||
|
|
|
@ -2104,7 +2104,7 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||||
uint8_t signature[32] = {0};
|
uint8_t signature[32] = {0};
|
||||||
res = detect_mfc_ev1_signature(signature);
|
res = detect_mfc_ev1_signature(signature);
|
||||||
if (res == PM3_SUCCESS) {
|
if (res == PM3_SUCCESS) {
|
||||||
mfc_ev1_print_signature(card.uid, card.uidlen, signature, sizeof(signature));
|
mfc_ev1_print_signature(card.uid, card.uidlen, signature, sizeof(signature));
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf mf`") " commands");
|
PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`hf mf`") " commands");
|
||||||
|
|
|
@ -1171,7 +1171,7 @@ static int CmdHF15FindAfi(const char *Cmd) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WaitForResponseTimeout(CMD_HF_ISO15693_FINDAFI, &resp, 2000)){
|
if (WaitForResponseTimeout(CMD_HF_ISO15693_FINDAFI, &resp, 2000)) {
|
||||||
if (resp.status == PM3_EOPABORTED) {
|
if (resp.status == PM3_EOPABORTED) {
|
||||||
PrintAndLogEx(DEBUG, "Button pressed, user aborted");
|
PrintAndLogEx(DEBUG, "Button pressed, user aborted");
|
||||||
}
|
}
|
||||||
|
@ -1370,7 +1370,7 @@ static int CmdHF15Dump(const char *Cmd) {
|
||||||
|
|
||||||
// copy uid to read command
|
// copy uid to read command
|
||||||
memcpy(req + 2, uid, sizeof(uid));
|
memcpy(req + 2, uid, sizeof(uid));
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "." NOLF);
|
PrintAndLogEx(INFO, "." NOLF);
|
||||||
for (int retry = 0; retry < 5; retry++) {
|
for (int retry = 0; retry < 5; retry++) {
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#ifndef CRYPTORF_MEM_SIZE
|
#ifndef CRYPTORF_MEM_SIZE
|
||||||
# define CRYPTORF_MEM_SIZE 1024
|
# define CRYPTORF_MEM_SIZE 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ static int CmdHFCryptoRFSniff(const char *Cmd) {
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_ISO14443B_SNIFF, NULL, 0);
|
SendCommandNG(CMD_HF_ISO14443B_SNIFF, NULL, 0);
|
||||||
|
|
||||||
PrintAndLogEx(HINT, "Try `" _YELLOW_("hf cryptorf list") "` to view captured tracelog");
|
PrintAndLogEx(HINT, "Try `" _YELLOW_("hf cryptorf list") "` to view captured tracelog");
|
||||||
PrintAndLogEx(HINT, "Try `" _YELLOW_("trace save -f hf_cryptorf_mytrace") "` to save tracelog for later analysing");
|
PrintAndLogEx(HINT, "Try `" _YELLOW_("trace save -f hf_cryptorf_mytrace") "` to save tracelog for later analysing");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
@ -247,9 +247,9 @@ static int CmdHFCryptoRFReader(const char *Cmd) {
|
||||||
static int CmdHFCryptoRFDump(const char *Cmd) {
|
static int CmdHFCryptoRFDump(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf cryptorf dump",
|
CLIParserInit(&ctx, "hf cryptorf dump",
|
||||||
"Dump all memory from a CryptoRF tag (512/4096 bit size)",
|
"Dump all memory from a CryptoRF tag (512/4096 bit size)",
|
||||||
"hf cryptorf dump\n"
|
"hf cryptorf dump\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
@ -393,9 +393,9 @@ static int CmdHFCryptoRFELoad(const char *Cmd) {
|
||||||
|
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf cryptorf eload",
|
CLIParserInit(&ctx, "hf cryptorf eload",
|
||||||
"Loads CryptoRF tag dump into emulator memory on device",
|
"Loads CryptoRF tag dump into emulator memory on device",
|
||||||
"hf cryptorf eload -f hf-cryptorf-0102030405-dump.bin\n"
|
"hf cryptorf eload -f hf-cryptorf-0102030405-dump.bin\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
@ -455,11 +455,11 @@ static int CmdHFCryptoRFESave(const char *Cmd) {
|
||||||
|
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf cryptorf esave",
|
CLIParserInit(&ctx, "hf cryptorf esave",
|
||||||
"Save emulator memory to bin/eml/json file\n"
|
"Save emulator memory to bin/eml/json file\n"
|
||||||
"if filename is not supplied, UID will be used.",
|
"if filename is not supplied, UID will be used.",
|
||||||
"hf cryptorf esave\n"
|
"hf cryptorf esave\n"
|
||||||
"hf cryptorf esave -f filename"
|
"hf cryptorf esave -f filename"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_str0("f", "file", "<filename>", "filename of dumpfile"),
|
arg_str0("f", "file", "<filename>", "filename of dumpfile"),
|
||||||
|
|
|
@ -1217,7 +1217,7 @@ static void emrtd_mrz_replace_pad(char *data, int datalen, char newchar) {
|
||||||
|
|
||||||
static void emrtd_print_optional_elements(char *mrz, int offset, int length, bool verify_check_digit) {
|
static void emrtd_print_optional_elements(char *mrz, int offset, int length, bool verify_check_digit) {
|
||||||
int i = emrtd_mrz_determine_length(mrz, offset, length);
|
int i = emrtd_mrz_determine_length(mrz, offset, length);
|
||||||
if (i == -1){
|
if (i == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1351,24 +1351,24 @@ static int CmdHFFelicaRequestSystemCode(const char *Cmd) {
|
||||||
static int CmdHFFelicaRequestService(const char *Cmd) {
|
static int CmdHFFelicaRequestService(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf felica rqservice",
|
CLIParserInit(&ctx, "hf felica rqservice",
|
||||||
"Use this command to verify the existence of Area and Service, and to acquire Key Version:\n"
|
"Use this command to verify the existence of Area and Service, and to acquire Key Version:\n"
|
||||||
" - When the specified Area or Service exists, the card returns Key Version.\n"
|
" - When the specified Area or Service exists, the card returns Key Version.\n"
|
||||||
" - When the specified Area or Service does not exist, the card returns FFFFh as Key Version.\n"
|
" - When the specified Area or Service does not exist, the card returns FFFFh as Key Version.\n"
|
||||||
"For Node Code List of a command packet, Area Code or Service Code of the target\n"
|
"For Node Code List of a command packet, Area Code or Service Code of the target\n"
|
||||||
"of acquisition of Key Version shall be enumerated in Little Endian format.\n"
|
"of acquisition of Key Version shall be enumerated in Little Endian format.\n"
|
||||||
"If Key Version of System is the target of acquisition, FFFFh shall be specified\n"
|
"If Key Version of System is the target of acquisition, FFFFh shall be specified\n"
|
||||||
"in the command packet.",
|
"in the command packet.",
|
||||||
"hf felcia rqservice --node 01 --code FFFF\n"
|
"hf felcia rqservice --node 01 --code FFFF\n"
|
||||||
"hf felcia rqservice -a --code FFFF\n"
|
"hf felcia rqservice -a --code FFFF\n"
|
||||||
"hf felica rqservice -i 011204126417E405 --node 01 --code FFFF"
|
"hf felica rqservice -i 011204126417E405 --node 01 --code FFFF"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_lit0("a", "all", "auto node number mode, iterates through all possible nodes 1 < n < 32"),
|
arg_lit0("a", "all", "auto node number mode, iterates through all possible nodes 1 < n < 32"),
|
||||||
arg_str0("n", "node", "<hex>", "Number of Node"),
|
arg_str0("n", "node", "<hex>", "Number of Node"),
|
||||||
arg_str0("c", "code", "<hex>", "Node Code List (little endian)"),
|
arg_str0("c", "code", "<hex>", "Node Code List (little endian)"),
|
||||||
arg_str0("i", "idm", "<hex>", "use custom IDm"),
|
arg_str0("i", "idm", "<hex>", "use custom IDm"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
|
@ -1383,41 +1383,41 @@ static int CmdHFFelicaRequestService(const char *Cmd) {
|
||||||
bool custom_IDm = false;
|
bool custom_IDm = false;
|
||||||
uint16_t datalen = 13; // length (1) + CMD (1) + IDm(8) + Node Number (1) + Node Code List (2)
|
uint16_t datalen = 13; // length (1) + CMD (1) + IDm(8) + Node Number (1) + Node Code List (2)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
case 'i':
|
case 'i':
|
||||||
|
|
||||||
custom_IDm = true;
|
custom_IDm = true;
|
||||||
if (!add_param(Cmd, paramCount, data, 2, 16)) {
|
if (!add_param(Cmd, paramCount, data, 2, 16)) {
|
||||||
return PM3_EINVARG;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!all_nodes) {
|
|
||||||
// Node Number
|
|
||||||
if (param_getlength(Cmd, paramCount) == 2) {
|
|
||||||
|
|
||||||
if (param_gethex(Cmd, paramCount++, data + 10, 2) == 1) {
|
|
||||||
PrintAndLogEx(ERR, "Failed param key");
|
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!all_nodes) {
|
||||||
|
// Node Number
|
||||||
|
if (param_getlength(Cmd, paramCount) == 2) {
|
||||||
|
|
||||||
|
if (param_gethex(Cmd, paramCount++, data + 10, 2) == 1) {
|
||||||
|
PrintAndLogEx(ERR, "Failed param key");
|
||||||
|
return PM3_EINVARG;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
PrintAndLogEx(ERR, "Incorrect Node number length!");
|
||||||
|
return PM3_EINVARG;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param_getlength(Cmd, paramCount) == 4) {
|
||||||
|
|
||||||
|
if (param_gethex(Cmd, paramCount++, data + 11, 4) == 1) {
|
||||||
|
PrintAndLogEx(ERR, "Failed param key");
|
||||||
|
return PM3_EINVARG;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(ERR, "Incorrect Node number length!");
|
PrintAndLogEx(ERR, "Incorrect parameter length!");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
}
|
*/
|
||||||
|
|
||||||
if (param_getlength(Cmd, paramCount) == 4) {
|
|
||||||
|
|
||||||
if (param_gethex(Cmd, paramCount++, data + 11, 4) == 1) {
|
|
||||||
PrintAndLogEx(ERR, "Failed param key");
|
|
||||||
return PM3_EINVARG;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
PrintAndLogEx(ERR, "Incorrect parameter length!");
|
|
||||||
return PM3_EINVARG;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
uint8_t flags = FELICA_APPEND_CRC;
|
uint8_t flags = FELICA_APPEND_CRC;
|
||||||
if (custom_IDm) {
|
if (custom_IDm) {
|
||||||
|
@ -1458,11 +1458,11 @@ static int CmdHFFelicaNotImplementedYet(const char *Cmd) {
|
||||||
static int CmdHFFelicaSniff(const char *Cmd) {
|
static int CmdHFFelicaSniff(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf felica sniff",
|
CLIParserInit(&ctx, "hf felica sniff",
|
||||||
"Collect data from the field and save into command buffer.\n"
|
"Collect data from the field and save into command buffer.\n"
|
||||||
"Buffer accessible from `hf felica list`",
|
"Buffer accessible from `hf felica list`",
|
||||||
"hf felica sniff\n"
|
"hf felica sniff\n"
|
||||||
"hf felica sniff -s 10 -t 19"
|
"hf felica sniff -s 10 -t 19"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_u64_0("s", "samples", "<dec>", "samples to skip"),
|
arg_u64_0("s", "samples", "<dec>", "samples to skip"),
|
||||||
|
@ -1480,20 +1480,20 @@ static int CmdHFFelicaSniff(const char *Cmd) {
|
||||||
payload.triggers = arg_get_u32_def(ctx, 2, 5000);
|
payload.triggers = arg_get_u32_def(ctx, 2, 5000);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
if (payload.samples > 9999 ){
|
if (payload.samples > 9999) {
|
||||||
payload.samples = 9999;
|
payload.samples = 9999;
|
||||||
PrintAndLogEx(INFO, "Too large samples to skip value, using max value 9999");
|
PrintAndLogEx(INFO, "Too large samples to skip value, using max value 9999");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payload.triggers > 9999 ){
|
if (payload.triggers > 9999) {
|
||||||
payload.triggers = 9999;
|
payload.triggers = 9999;
|
||||||
PrintAndLogEx(INFO, "Too large trigger to skip value, using max value 9999");
|
PrintAndLogEx(INFO, "Too large trigger to skip value, using max value 9999");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Sniff Felica, getting first %" PRIu32 " frames, skipping after %" PRIu32 " triggers", payload.samples, payload.triggers );
|
PrintAndLogEx(INFO, "Sniff Felica, getting first %" PRIu32 " frames, skipping after %" PRIu32 " triggers", payload.samples, payload.triggers);
|
||||||
PrintAndLogEx(INFO, "Press " _GREEN_("<Enter>") " or pm3-button to abort sniffing");
|
PrintAndLogEx(INFO, "Press " _GREEN_("<Enter>") " or pm3-button to abort sniffing");
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_HF_FELICA_SNIFF, (uint8_t *)&payload, sizeof(payload));
|
SendCommandNG(CMD_HF_FELICA_SNIFF, (uint8_t *)&payload, sizeof(payload));
|
||||||
|
@ -1524,9 +1524,9 @@ static int CmdHFFelicaSniff(const char *Cmd) {
|
||||||
static int CmdHFFelicaSimLite(const char *Cmd) {
|
static int CmdHFFelicaSimLite(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf felica litesim",
|
CLIParserInit(&ctx, "hf felica litesim",
|
||||||
"Emulating ISO/18092 FeliCa Lite tag",
|
"Emulating ISO/18092 FeliCa Lite tag",
|
||||||
"hf felica litesim -u 1122334455667788"
|
"hf felica litesim -u 1122334455667788"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_str1("u", "uid", "<hex>", "UID/NDEF2 8 hex bytes"),
|
arg_str1("u", "uid", "<hex>", "UID/NDEF2 8 hex bytes"),
|
||||||
|
@ -1538,7 +1538,7 @@ static int CmdHFFelicaSimLite(const char *Cmd) {
|
||||||
uint8_t uid[8];
|
uint8_t uid[8];
|
||||||
} PACKED payload;
|
} PACKED payload;
|
||||||
CLIGetHexWithReturn(ctx, 1, payload.uid, &uid_len);
|
CLIGetHexWithReturn(ctx, 1, payload.uid, &uid_len);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(INFO, "Press " _GREEN_("<Enter>") " or pm3-button to abort simulation");
|
PrintAndLogEx(INFO, "Press " _GREEN_("<Enter>") " or pm3-button to abort simulation");
|
||||||
|
@ -1720,26 +1720,26 @@ static uint16_t PrintFliteBlock(uint16_t tracepos, uint8_t *trace, uint16_t trac
|
||||||
|
|
||||||
static int CmdHFFelicaDumpLite(const char *Cmd) {
|
static int CmdHFFelicaDumpLite(const char *Cmd) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
iceman 2021,
|
iceman 2021,
|
||||||
Why does this command say it dumps a FeliCa lite card
|
Why does this command say it dumps a FeliCa lite card
|
||||||
and then tries to print a trace?!?
|
and then tries to print a trace?!?
|
||||||
Is this a trace list or a feclia dump cmd?
|
Is this a trace list or a feclia dump cmd?
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf felica litedump",
|
CLIParserInit(&ctx, "hf felica litedump",
|
||||||
"Dump ISO/18092 FeliCa Lite tag. It will timeout after 200sec",
|
"Dump ISO/18092 FeliCa Lite tag. It will timeout after 200sec",
|
||||||
"hf felica litedump"
|
"hf felica litedump"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
CLIExecWithReturn(ctx, Cmd, argtable, true);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "FeliCa lite - dump started");
|
PrintAndLogEx(SUCCESS, "FeliCa lite - dump started");
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
|
@ -1814,12 +1814,12 @@ Is this a trace list or a feclia dump cmd?
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CmdHFFelicaCmdRaw(const char *Cmd) {
|
static int CmdHFFelicaCmdRaw(const char *Cmd) {
|
||||||
|
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf felica raw ",
|
CLIParserInit(&ctx, "hf felica raw ",
|
||||||
"Send raw hex data to tag",
|
"Send raw hex data to tag",
|
||||||
"hf felica raw -s 20"
|
"hf felica raw -s 20"
|
||||||
);
|
);
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
@ -1837,7 +1837,7 @@ static int CmdHFFelicaCmdRaw(const char *Cmd) {
|
||||||
bool active = arg_get_lit(ctx, 1);
|
bool active = arg_get_lit(ctx, 1);
|
||||||
bool crc = arg_get_lit(ctx, 2);
|
bool crc = arg_get_lit(ctx, 2);
|
||||||
bool keep_field_on = arg_get_lit(ctx, 3);
|
bool keep_field_on = arg_get_lit(ctx, 3);
|
||||||
uint16_t numbits = arg_get_u32_def(ctx, 4, 0) &0xFFFF;
|
uint16_t numbits = arg_get_u32_def(ctx, 4, 0) & 0xFFFF;
|
||||||
bool reply = (arg_get_lit(ctx, 5) == false);
|
bool reply = (arg_get_lit(ctx, 5) == false);
|
||||||
bool active_select = arg_get_lit(ctx, 6);
|
bool active_select = arg_get_lit(ctx, 6);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#define ICLASS_AUTH_RETRY 10
|
#define ICLASS_AUTH_RETRY 10
|
||||||
#define ICLASS_DECRYPTION_BIN "iclass_decryptionkey.bin"
|
#define ICLASS_DECRYPTION_BIN "iclass_decryptionkey.bin"
|
||||||
|
|
||||||
static picopass_hdr_t iclass_last_known_card;
|
static picopass_hdr_t iclass_last_known_card;
|
||||||
static void iclass_set_last_known_card(picopass_hdr_t *card) {
|
static void iclass_set_last_known_card(picopass_hdr_t *card) {
|
||||||
memcpy(&iclass_last_known_card, card, sizeof(picopass_hdr_t));
|
memcpy(&iclass_last_known_card, card, sizeof(picopass_hdr_t));
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ uint8_t card_app2_limit[] = {
|
||||||
0xff,
|
0xff,
|
||||||
};
|
};
|
||||||
|
|
||||||
iclass_config_card_item_t iclass_config_types[14]= {
|
iclass_config_card_item_t iclass_config_types[14] = {
|
||||||
{"", ""},
|
{"", ""},
|
||||||
{"", ""},
|
{"", ""},
|
||||||
{"", ""},
|
{"", ""},
|
||||||
|
@ -148,7 +148,7 @@ iclass_config_card_item_t iclass_config_types[14]= {
|
||||||
{"", ""},
|
{"", ""},
|
||||||
{"", ""},
|
{"", ""},
|
||||||
{"", ""},
|
{"", ""},
|
||||||
// must be the last entry
|
// must be the last entry
|
||||||
{"no config card info available", ""}
|
{"no config card info available", ""}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ static int load_config_cards(void) {
|
||||||
PrintAndLogEx(FAILED, "failed to detect cardhelper");
|
PrintAndLogEx(FAILED, "failed to detect cardhelper");
|
||||||
return PM3_ENODATA;
|
return PM3_ENODATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < ARRAYLEN(iclass_config_types); ++i) {
|
for (int i = 0; i < ARRAYLEN(iclass_config_types); ++i) {
|
||||||
|
|
||||||
PrintAndLogEx(INPLACE, "loading setting %i", i);
|
PrintAndLogEx(INPLACE, "loading setting %i", i);
|
||||||
|
@ -198,7 +198,7 @@ static const iclass_config_card_item_t *get_config_card_item(int idx) {
|
||||||
static void print_config_cards(void) {
|
static void print_config_cards(void) {
|
||||||
if (check_config_card(&iclass_config_types[0])) {
|
if (check_config_card(&iclass_config_types[0])) {
|
||||||
PrintAndLogEx(INFO, "---- " _CYAN_("Config cards available") " ------------");
|
PrintAndLogEx(INFO, "---- " _CYAN_("Config cards available") " ------------");
|
||||||
for (int i = 0; i < ARRAYLEN(iclass_config_types); ++i) {
|
for (int i = 0; i < ARRAYLEN(iclass_config_types); ++i) {
|
||||||
PrintAndLogEx(INFO, "%2d, %s", i, iclass_config_types[i].desc);
|
PrintAndLogEx(INFO, "%2d, %s", i, iclass_config_types[i].desc);
|
||||||
}
|
}
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
@ -225,7 +225,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate dump file
|
// generate dump file
|
||||||
uint8_t app1_limit = iclass_last_known_card.conf.app_limit;
|
uint8_t app1_limit = iclass_last_known_card.conf.app_limit;
|
||||||
uint8_t old_limit = app1_limit;
|
uint8_t old_limit = app1_limit;
|
||||||
uint8_t tot_bytes = (app1_limit + 1) * 8;
|
uint8_t tot_bytes = (app1_limit + 1) * 8;
|
||||||
|
@ -246,16 +246,16 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
|
||||||
free(data);
|
free(data);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app1_limit < 0x16) {
|
if (app1_limit < 0x16) {
|
||||||
// if card wasn't large enough before, adapt to new size
|
// if card wasn't large enough before, adapt to new size
|
||||||
PrintAndLogEx(WARNING, "Adapting applimit1 for KEY rolling..");
|
PrintAndLogEx(WARNING, "Adapting applimit1 for KEY rolling..");
|
||||||
|
|
||||||
app1_limit = 0x16;
|
app1_limit = 0x16;
|
||||||
iclass_last_known_card.conf.app_limit = 0x16;
|
iclass_last_known_card.conf.app_limit = 0x16;
|
||||||
tot_bytes = (app1_limit + 1) * 8;
|
tot_bytes = (app1_limit + 1) * 8;
|
||||||
|
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
p = realloc(data, tot_bytes);
|
p = realloc(data, tot_bytes);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
PrintAndLogEx(FAILED, "failed to allocate memory");
|
PrintAndLogEx(FAILED, "failed to allocate memory");
|
||||||
|
@ -265,8 +265,8 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
|
||||||
data = p;
|
data = p;
|
||||||
memset(data, 0xFF, tot_bytes);
|
memset(data, 0xFF, tot_bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// need to encrypt
|
// need to encrypt
|
||||||
PrintAndLogEx(INFO, "Detecting cardhelper...");
|
PrintAndLogEx(INFO, "Detecting cardhelper...");
|
||||||
if (IsCardHelperPresent(false) == false) {
|
if (IsCardHelperPresent(false) == false) {
|
||||||
PrintAndLogEx(FAILED, "failed to detect cardhelper");
|
PrintAndLogEx(FAILED, "failed to detect cardhelper");
|
||||||
|
@ -274,7 +274,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
|
||||||
return PM3_ENODATA;
|
return PM3_ENODATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ffs[8] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
|
uint8_t ffs[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||||
if (Encrypt(ffs, ffs) == false) {
|
if (Encrypt(ffs, ffs) == false) {
|
||||||
PrintAndLogEx(WARNING, "failed to encrypt FF");
|
PrintAndLogEx(WARNING, "failed to encrypt FF");
|
||||||
}
|
}
|
||||||
|
@ -291,7 +291,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
|
||||||
memcpy(data + (0xD * 8), enckey1, sizeof(enckey1));
|
memcpy(data + (0xD * 8), enckey1, sizeof(enckey1));
|
||||||
// encrypted 0xFF
|
// encrypted 0xFF
|
||||||
for (uint8_t i = 0xe; i < 0x14; i++) {
|
for (uint8_t i = 0xe; i < 0x14; i++) {
|
||||||
memcpy(data + (i*8), ffs, sizeof(ffs));
|
memcpy(data + (i * 8), ffs, sizeof(ffs));
|
||||||
}
|
}
|
||||||
|
|
||||||
// encrypted partial keyroll key 14
|
// encrypted partial keyroll key 14
|
||||||
|
@ -320,10 +320,10 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
|
||||||
// revert potential modified app1_limit
|
// revert potential modified app1_limit
|
||||||
iclass_last_known_card.conf.app_limit = old_limit;
|
iclass_last_known_card.conf.app_limit = old_limit;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
memcpy(data, &iclass_last_known_card, sizeof(picopass_hdr_t));
|
memcpy(data, &iclass_last_known_card, sizeof(picopass_hdr_t));
|
||||||
memcpy(data + (6*8), o->data, sizeof(o->data));
|
memcpy(data + (6 * 8), o->data, sizeof(o->data));
|
||||||
}
|
}
|
||||||
|
|
||||||
// create filename
|
// create filename
|
||||||
char filename[FILE_PATH_SIZE] = {0};
|
char filename[FILE_PATH_SIZE] = {0};
|
||||||
|
@ -1167,7 +1167,7 @@ static int CmdHFiClassDecrypt(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "Couldn't find any decryption methods");
|
PrintAndLogEx(INFO, "Couldn't find any decryption methods");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keylen != 16) {
|
if (keylen != 16) {
|
||||||
PrintAndLogEx(ERR, "Failed to load transport key from file");
|
PrintAndLogEx(ERR, "Failed to load transport key from file");
|
||||||
free(keyptr);
|
free(keyptr);
|
||||||
|
@ -3711,7 +3711,7 @@ static int CmdHFiClassAutopwn(const char *Cmd) {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int CmdHFiClassConfigCard(const char * Cmd) {
|
static int CmdHFiClassConfigCard(const char *Cmd) {
|
||||||
|
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf iclass configcard",
|
CLIParserInit(&ctx, "hf iclass configcard",
|
||||||
|
@ -3756,7 +3756,7 @@ static int CmdHFiClassConfigCard(const char * Cmd) {
|
||||||
|
|
||||||
if (load) {
|
if (load) {
|
||||||
if (load_config_cards() != PM3_SUCCESS) {
|
if (load_config_cards() != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(INFO, "failed to load, check your cardhelper");
|
PrintAndLogEx(INFO, "failed to load, check your cardhelper");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,8 @@ uint8_t iso14443A_CRC_check(bool isResponse, uint8_t *d, uint8_t n) {
|
||||||
if (n < 3) return 2;
|
if (n < 3) return 2;
|
||||||
if (isResponse && (n < 6)) return 2;
|
if (isResponse && (n < 6)) return 2;
|
||||||
if (d[1] == 0x50 &&
|
if (d[1] == 0x50 &&
|
||||||
d[0] >= ISO14443A_CMD_ANTICOLL_OR_SELECT &&
|
d[0] >= ISO14443A_CMD_ANTICOLL_OR_SELECT &&
|
||||||
d[0] <= ISO14443A_CMD_ANTICOLL_OR_SELECT_3) {
|
d[0] <= ISO14443A_CMD_ANTICOLL_OR_SELECT_3) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
return check_crc(CRC_14443_A, d, n);
|
return check_crc(CRC_14443_A, d, n);
|
||||||
|
@ -1337,13 +1337,13 @@ void annotateMifare(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, uint8
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mf_get_paritybinstr(char *s, uint32_t val, uint8_t par) {
|
static void mf_get_paritybinstr(char *s, uint32_t val, uint8_t par) {
|
||||||
uint8_t foo[4] = {0,0,0,0};
|
uint8_t foo[4] = {0, 0, 0, 0};
|
||||||
num_to_bytes(val, sizeof(uint32_t), foo);
|
num_to_bytes(val, sizeof(uint32_t), foo);
|
||||||
for (uint8_t i = 0; i < 4; i++) {
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
if (oddparity8(foo[i]) != ((par >> (7 - (i & 0x0007))) & 0x01))
|
if (oddparity8(foo[i]) != ((par >> (7 - (i & 0x0007))) & 0x01))
|
||||||
sprintf(s++, "1");
|
sprintf(s++, "1");
|
||||||
else
|
else
|
||||||
sprintf(s++, "0");
|
sprintf(s++, "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1444,25 +1444,25 @@ bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, uint8_t *parity, bool isRes
|
||||||
|
|
||||||
//PrintAndLogEx(NORMAL, "hardnested not implemented. uid:%x nt:%x ar_enc:%x at_enc:%x\n", AuthData.uid, AuthData.nt, AuthData.ar_enc, AuthData.at_enc);
|
//PrintAndLogEx(NORMAL, "hardnested not implemented. uid:%x nt:%x ar_enc:%x at_enc:%x\n", AuthData.uid, AuthData.nt, AuthData.ar_enc, AuthData.at_enc);
|
||||||
|
|
||||||
char snt[5] = {0,0,0,0,0};
|
char snt[5] = {0, 0, 0, 0, 0};
|
||||||
mf_get_paritybinstr(snt, AuthData.nt_enc, AuthData.nt_enc_par);
|
mf_get_paritybinstr(snt, AuthData.nt_enc, AuthData.nt_enc_par);
|
||||||
char sar[5] = {0,0,0,0,0};
|
char sar[5] = {0, 0, 0, 0, 0};
|
||||||
mf_get_paritybinstr(sar, AuthData.ar_enc, AuthData.ar_enc_par);
|
mf_get_paritybinstr(sar, AuthData.ar_enc, AuthData.ar_enc_par);
|
||||||
char sat[5] = {0,0,0,0,0};
|
char sat[5] = {0, 0, 0, 0, 0};
|
||||||
mf_get_paritybinstr(sat, AuthData.at_enc, AuthData.at_enc_par);
|
mf_get_paritybinstr(sat, AuthData.at_enc, AuthData.at_enc_par);
|
||||||
|
|
||||||
PrintAndLogEx(NORMAL, "Nested authentication detected. ");
|
PrintAndLogEx(NORMAL, "Nested authentication detected. ");
|
||||||
PrintAndLogEx(NORMAL, "tools/mf_nonce_brute/mf_nonce_brute %x %x %s %x %x %s %x %s %s\n"
|
PrintAndLogEx(NORMAL, "tools/mf_nonce_brute/mf_nonce_brute %x %x %s %x %x %s %x %s %s\n"
|
||||||
, AuthData.uid
|
, AuthData.uid
|
||||||
, AuthData.nt_enc
|
, AuthData.nt_enc
|
||||||
, snt
|
, snt
|
||||||
, AuthData.nr_enc
|
, AuthData.nr_enc
|
||||||
, AuthData.ar_enc
|
, AuthData.ar_enc
|
||||||
, sar
|
, sar
|
||||||
, AuthData.at_enc
|
, AuthData.at_enc
|
||||||
, sat
|
, sat
|
||||||
, sprint_hex_inrow(cmd, cmdsize)
|
, sprint_hex_inrow(cmd, cmdsize)
|
||||||
);
|
);
|
||||||
|
|
||||||
MifareAuthState = masError;
|
MifareAuthState = masError;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ typedef struct {
|
||||||
uint32_t nt_enc; // encrypted tag challenge
|
uint32_t nt_enc; // encrypted tag challenge
|
||||||
uint8_t nt_enc_par; // encrypted tag challenge parity
|
uint8_t nt_enc_par; // encrypted tag challenge parity
|
||||||
uint32_t nr_enc; // encrypted reader challenge
|
uint32_t nr_enc; // encrypted reader challenge
|
||||||
uint8_t nr_enc_par; // encrypted reader challenge parity
|
uint8_t nr_enc_par; // encrypted reader challenge parity
|
||||||
uint32_t ar_enc; // encrypted reader response
|
uint32_t ar_enc; // encrypted reader response
|
||||||
uint8_t ar_enc_par; // encrypted reader response parity
|
uint8_t ar_enc_par; // encrypted reader response parity
|
||||||
uint32_t at_enc; // encrypted tag response
|
uint32_t at_enc; // encrypted tag response
|
||||||
|
|
|
@ -1251,7 +1251,7 @@ static int CmdHF14AMfRestore(const char *Cmd) {
|
||||||
|
|
||||||
|
|
||||||
if (use_keyfile_for_auth) {
|
if (use_keyfile_for_auth) {
|
||||||
for (uint8_t kt=0; kt < 2; kt++) {
|
for (uint8_t kt = 0; kt < 2; kt++) {
|
||||||
|
|
||||||
if (kt == 0)
|
if (kt == 0)
|
||||||
memcpy(data, keyA[sectorNo], 6);
|
memcpy(data, keyA[sectorNo], 6);
|
||||||
|
@ -5589,7 +5589,7 @@ static int CmdHF14AMfWipe(const char *Cmd) {
|
||||||
"New acc FF 07 80\n"
|
"New acc FF 07 80\n"
|
||||||
"New GDB 69",
|
"New GDB 69",
|
||||||
"hf mf wipe"
|
"hf mf wipe"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_str0("f", "file", "<fn>", "key filename"),
|
arg_str0("f", "file", "<fn>", "key filename"),
|
||||||
|
@ -5652,12 +5652,12 @@ static int CmdHF14AMfWipe(const char *Cmd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t zeros[MFBLOCK_SIZE] = {0};
|
uint8_t zeros[MFBLOCK_SIZE] = {0};
|
||||||
memset(zeros, 0x00, sizeof(zeros));
|
memset(zeros, 0x00, sizeof(zeros));
|
||||||
uint8_t st[MFBLOCK_SIZE] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
uint8_t st[MFBLOCK_SIZE] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x80, 0x69, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||||
|
|
||||||
// time to wipe card
|
// time to wipe card
|
||||||
for (uint8_t s = 0; s < num_sectors; s++) {
|
for (uint8_t s = 0; s < num_sectors; s++) {
|
||||||
|
|
||||||
for (uint8_t b = 0; b < NumBlocksPerSector(s); b++) {
|
for (uint8_t b = 0; b < NumBlocksPerSector(s); b++) {
|
||||||
|
|
||||||
|
|
|
@ -949,7 +949,7 @@ static int mfu_decrypt_amiibo(uint8_t *encrypted, uint16_t elen, uint8_t *decryp
|
||||||
|
|
||||||
if (elen < NFC3D_AMIIBO_SIZE / 4) {
|
if (elen < NFC3D_AMIIBO_SIZE / 4) {
|
||||||
PrintAndLogEx(ERR, "ERR, data wrong length, got %zu , expected %zu", elen, (NFC3D_AMIIBO_SIZE / 4));
|
PrintAndLogEx(ERR, "ERR, data wrong length, got %zu , expected %zu", elen, (NFC3D_AMIIBO_SIZE / 4));
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
nfc3d_amiibo_keys amiibo_keys = {0};
|
nfc3d_amiibo_keys amiibo_keys = {0};
|
||||||
|
@ -961,7 +961,7 @@ static int mfu_decrypt_amiibo(uint8_t *encrypted, uint16_t elen, uint8_t *decryp
|
||||||
PrintAndLogEx(ERR, "WARNING, Tag signature was NOT valid");
|
PrintAndLogEx(ERR, "WARNING, Tag signature was NOT valid");
|
||||||
}
|
}
|
||||||
|
|
||||||
*dlen = NFC3D_AMIIBO_SIZE;
|
*dlen = NFC3D_AMIIBO_SIZE;
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
static int mfu_dump_tag(uint16_t pages, void **pdata, uint16_t *len) {
|
static int mfu_dump_tag(uint16_t pages, void **pdata, uint16_t *len) {
|
||||||
|
@ -1016,10 +1016,10 @@ out:
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
Lego Dimensions,
|
Lego Dimensions,
|
||||||
Version: 00 04 04 02 01 00 0F 03
|
Version: 00 04 04 02 01 00 0F 03
|
||||||
|
|
||||||
matching bytes:
|
matching bytes:
|
||||||
index 12 ( 3 * 4 )
|
index 12 ( 3 * 4 )
|
||||||
E1 10 12 00 01 03 A0 0C 34 03 13 D1 01 0F 54 02 65 6E
|
E1 10 12 00 01 03 A0 0C 34 03 13 D1 01 0F 54 02 65 6E
|
||||||
*/
|
*/
|
||||||
|
@ -1075,7 +1075,7 @@ static mfu_identify_t mfu_ident_table[] = {
|
||||||
{NULL, NULL, 0, 0, NULL, NULL, NULL, NULL}
|
{NULL, NULL, 0, 0, NULL, NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
static mfu_identify_t* mfu_match_fingerprint(uint8_t *version, uint8_t *data) {
|
static mfu_identify_t *mfu_match_fingerprint(uint8_t *version, uint8_t *data) {
|
||||||
uint8_t i = 0;
|
uint8_t i = 0;
|
||||||
do {
|
do {
|
||||||
|
|
||||||
|
@ -1140,7 +1140,7 @@ static int mfu_fingerprint(void) {
|
||||||
res = PM3_ESOFT;
|
res = PM3_ESOFT;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
maxbytes = ((maxbytes / 4) + 1) * 4;
|
maxbytes = ((maxbytes / 4) + 1) * 4;
|
||||||
data = calloc(maxbytes, sizeof(uint8_t));
|
data = calloc(maxbytes, sizeof(uint8_t));
|
||||||
if (data == NULL) {
|
if (data == NULL) {
|
||||||
|
@ -1184,7 +1184,7 @@ static int mfu_fingerprint(void) {
|
||||||
uint8_t version[8] = {0};
|
uint8_t version[8] = {0};
|
||||||
uint8_t uid[7] = {0};
|
uint8_t uid[7] = {0};
|
||||||
if (mfu_get_version_uid(version, uid) == PM3_SUCCESS) {
|
if (mfu_get_version_uid(version, uid) == PM3_SUCCESS) {
|
||||||
mfu_identify_t* item = mfu_match_fingerprint(version, data);
|
mfu_identify_t *item = mfu_match_fingerprint(version, data);
|
||||||
if (item) {
|
if (item) {
|
||||||
PrintAndLogEx(SUCCESS, "Found " _GREEN_("%s"), item->desc);
|
PrintAndLogEx(SUCCESS, "Found " _GREEN_("%s"), item->desc);
|
||||||
|
|
||||||
|
@ -3280,30 +3280,30 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||||
if (memcmp(pre, post, sizeof(pre)) == 0) {
|
if (memcmp(pre, post, sizeof(pre)) == 0) {
|
||||||
|
|
||||||
PrintAndLogEx(INFO, "Current : %02d (0x%02X) %s"
|
PrintAndLogEx(INFO, "Current : %02d (0x%02X) %s"
|
||||||
, blockno
|
, blockno
|
||||||
, blockno
|
, blockno
|
||||||
, poststr
|
, poststr
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(INFO, _CYAN_("Tear off occurred") " : %02d (0x%02X) %s => " _RED_("%s")
|
PrintAndLogEx(INFO, _CYAN_("Tear off occurred") " : %02d (0x%02X) %s => " _RED_("%s")
|
||||||
, blockno
|
, blockno
|
||||||
, blockno
|
, blockno
|
||||||
, prestr
|
, prestr
|
||||||
, poststr
|
, poststr
|
||||||
);
|
);
|
||||||
|
|
||||||
lock_on = true;
|
lock_on = true;
|
||||||
|
|
||||||
if ((phase_begin_clear == -1) && (bitcount32(*(uint32_t*)pre) > bitcount32(*(uint32_t*)post)))
|
if ((phase_begin_clear == -1) && (bitcount32(*(uint32_t *)pre) > bitcount32(*(uint32_t *)post)))
|
||||||
phase_begin_clear = current;
|
phase_begin_clear = current;
|
||||||
|
|
||||||
if ((phase_begin_clear > -1) && (phase_end_clear == -1) && (bitcount32(*(uint32_t*)post) == 0))
|
if ((phase_begin_clear > -1) && (phase_end_clear == -1) && (bitcount32(*(uint32_t *)post) == 0))
|
||||||
phase_end_clear = current;
|
phase_end_clear = current;
|
||||||
|
|
||||||
if ((current == start) && (phase_end_clear > -1))
|
if ((current == start) && (phase_end_clear > -1))
|
||||||
skip_phase1 = true;
|
skip_phase1 = true;
|
||||||
// new write phase must be atleast 100us later..
|
// new write phase must be atleast 100us later..
|
||||||
if (((bitcount32(*(uint32_t*)pre) == 0) || (phase_end_clear > -1)) && (phase_begin_newwr == -1) && (bitcount32(*(uint32_t*)post) != 0) && (skip_phase1 || (current > (phase_end_clear + 100))))
|
if (((bitcount32(*(uint32_t *)pre) == 0) || (phase_end_clear > -1)) && (phase_begin_newwr == -1) && (bitcount32(*(uint32_t *)post) != 0) && (skip_phase1 || (current > (phase_end_clear + 100))))
|
||||||
phase_begin_newwr = current;
|
phase_begin_newwr = current;
|
||||||
|
|
||||||
if ((phase_begin_newwr > -1) && (phase_end_newwr == -1) && (memcmp(post, teardata, sizeof(teardata)) == 0))
|
if ((phase_begin_newwr > -1) && (phase_end_newwr == -1) && (memcmp(post, teardata, sizeof(teardata)) == 0))
|
||||||
|
@ -3346,7 +3346,7 @@ static int CmdHF14AMfuOtpTearoff(const char *Cmd) {
|
||||||
if ((phase_begin_clear > - 1) && (phase_begin_clear != start)) {
|
if ((phase_begin_clear > - 1) && (phase_begin_clear != start)) {
|
||||||
PrintAndLogEx(INFO, "Erase phase start boundary around " _YELLOW_("%5d") " us", phase_begin_clear);
|
PrintAndLogEx(INFO, "Erase phase start boundary around " _YELLOW_("%5d") " us", phase_begin_clear);
|
||||||
}
|
}
|
||||||
if ((phase_end_clear > - 1) && (phase_end_clear != start)){
|
if ((phase_end_clear > - 1) && (phase_end_clear != start)) {
|
||||||
PrintAndLogEx(INFO, "Erase phase end boundary around " _YELLOW_("%5d") " us", phase_end_clear);
|
PrintAndLogEx(INFO, "Erase phase end boundary around " _YELLOW_("%5d") " us", phase_end_clear);
|
||||||
}
|
}
|
||||||
if (phase_begin_newwr > - 1) {
|
if (phase_begin_newwr > - 1) {
|
||||||
|
@ -3754,8 +3754,8 @@ static int CmdHF14AMfuEv1CounterTearoff(const char *Cmd) {
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//
|
//
|
||||||
// name, identifying bytes, decode function, hints text
|
// name, identifying bytes, decode function, hints text
|
||||||
// identifying bits
|
// identifying bits
|
||||||
// 1. getversion data must match.
|
// 1. getversion data must match.
|
||||||
// 2. magic bytes in the readable payload
|
// 2. magic bytes in the readable payload
|
||||||
|
@ -3889,7 +3889,7 @@ static int CmdHF14MfuNDEF(const char *Cmd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char *mattel = strstr((char*)records, ".pid.mattel/");
|
char *mattel = strstr((char *)records, ".pid.mattel/");
|
||||||
if (mattel) {
|
if (mattel) {
|
||||||
mattel += 12;
|
mattel += 12;
|
||||||
while (mattel) {
|
while (mattel) {
|
||||||
|
@ -3906,7 +3906,7 @@ static int CmdHF14MfuNDEF(const char *Cmd) {
|
||||||
PrintAndLogEx(INFO, "decoded... %s", sprint_hex(arr, arrlen));
|
PrintAndLogEx(INFO, "decoded... %s", sprint_hex(arr, arrlen));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(records);
|
free(records);
|
||||||
|
|
|
@ -562,7 +562,7 @@ int CmdLFConfig(const char *Cmd) {
|
||||||
config.decimation = 8;
|
config.decimation = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (divisor> -1) {
|
if (divisor > -1) {
|
||||||
config.divisor = divisor;
|
config.divisor = divisor;
|
||||||
if (config.divisor < 19) {
|
if (config.divisor < 19) {
|
||||||
PrintAndLogEx(ERR, "divisor must be between 19 and 255");
|
PrintAndLogEx(ERR, "divisor must be between 19 and 255");
|
||||||
|
@ -1437,7 +1437,7 @@ int CmdLFfind(const char *Cmd) {
|
||||||
if (demodIOProx(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("IO Prox ID") " found!"); goto out;}
|
if (demodIOProx(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("IO Prox ID") " found!"); goto out;}
|
||||||
if (demodPyramid(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Pyramid ID") " found!"); goto out;}
|
if (demodPyramid(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Pyramid ID") " found!"); goto out;}
|
||||||
if (demodParadox(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Paradox ID") " found!"); goto out;}
|
if (demodParadox(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Paradox ID") " found!"); goto out;}
|
||||||
|
|
||||||
// psk
|
// psk
|
||||||
if (demodIdteck(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Idteck ID") " found!"); goto out;}
|
if (demodIdteck(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Idteck ID") " found!"); goto out;}
|
||||||
if (demodKeri(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("KERI ID") " found!"); goto out;}
|
if (demodKeri(true) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("KERI ID") " found!"); goto out;}
|
||||||
|
|
|
@ -470,7 +470,7 @@ int CmdEM4x50Chk(const char *Cmd) {
|
||||||
|
|
||||||
// upload to flash.
|
// upload to flash.
|
||||||
datalen = MIN(bytes_remaining, keyblock);
|
datalen = MIN(bytes_remaining, keyblock);
|
||||||
res = flashmem_spiffs_load((char*)destfn, keys, datalen);
|
res = flashmem_spiffs_load((char *)destfn, keys, datalen);
|
||||||
if (res != PM3_SUCCESS) {
|
if (res != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(WARNING, "SPIFFS upload failed");
|
PrintAndLogEx(WARNING, "SPIFFS upload failed");
|
||||||
return res;
|
return res;
|
||||||
|
|
|
@ -388,7 +388,7 @@ static int CmdHIDClone(const char *Cmd) {
|
||||||
packed.Mid = mid;
|
packed.Mid = mid;
|
||||||
packed.Bot = bot;
|
packed.Bot = bot;
|
||||||
} else if (bin_len) {
|
} else if (bin_len) {
|
||||||
int res = binstring_to_u96(&top, &mid, &bot, (const char*)bin);
|
int res = binstring_to_u96(&top, &mid, &bot, (const char *)bin);
|
||||||
if (res != bin_len) {
|
if (res != bin_len) {
|
||||||
PrintAndLogEx(ERR, "Binary string contains none <0|1> chars");
|
PrintAndLogEx(ERR, "Binary string contains none <0|1> chars");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
|
|
|
@ -292,7 +292,7 @@ static int CmdLFHitagEload(const char *Cmd) {
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
DumpFileType_t dftype = getfiletype(filename);
|
DumpFileType_t dftype = getfiletype(filename);
|
||||||
size_t dumplen = 0;
|
size_t dumplen = 0;
|
||||||
uint8_t *dump = NULL;
|
uint8_t *dump = NULL;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
@ -327,7 +327,7 @@ static int CmdLFHitagEload(const char *Cmd) {
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// check dump len..
|
// check dump len..
|
||||||
if (dumplen == 48 || dumplen == 4 * 64) {
|
if (dumplen == 48 || dumplen == 4 * 64) {
|
||||||
struct {
|
struct {
|
||||||
uint16_t len;
|
uint16_t len;
|
||||||
|
@ -337,7 +337,7 @@ static int CmdLFHitagEload(const char *Cmd) {
|
||||||
memcpy(payload.data, dump, dumplen);
|
memcpy(payload.data, dump, dumplen);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_LF_HITAG_ELOAD, (uint8_t *)&payload, 2 + dumplen);
|
SendCommandNG(CMD_LF_HITAG_ELOAD, (uint8_t *)&payload, 2 + dumplen);
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(ERR, "error, wrong dump file size. got %zu", dumplen);
|
PrintAndLogEx(ERR, "error, wrong dump file size. got %zu", dumplen);
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,7 @@ static int CmdLFHitagSim(const char *Cmd) {
|
||||||
bool use_hts = arg_get_lit(ctx, 3);
|
bool use_hts = arg_get_lit(ctx, 3);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
if ((use_ht1 + use_ht2 + use_hts) > 1 ) {
|
if ((use_ht1 + use_ht2 + use_hts) > 1) {
|
||||||
PrintAndLogEx(ERR, "error, Only specify one Hitag type");
|
PrintAndLogEx(ERR, "error, Only specify one Hitag type");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
@ -659,11 +659,11 @@ static int CmdLFHitagCheckChallenges(const char *Cmd) {
|
||||||
size_t datalen = 0;
|
size_t datalen = 0;
|
||||||
int res = loadFile_safe(filename, ".cc", (void **)&data, &datalen);
|
int res = loadFile_safe(filename, ".cc", (void **)&data, &datalen);
|
||||||
if (res == PM3_SUCCESS) {
|
if (res == PM3_SUCCESS) {
|
||||||
if (datalen == (8 * 60) ) {
|
if (datalen == (8 * 60)) {
|
||||||
SendCommandOLD(CMD_LF_HITAGS_TEST_TRACES, 1, 0, 0, data, datalen);
|
SendCommandOLD(CMD_LF_HITAGS_TEST_TRACES, 1, 0, 0, data, datalen);
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(ERR, "Error, file length mismatch. Expected %d, got %zu", 8*60, datalen);
|
PrintAndLogEx(ERR, "Error, file length mismatch. Expected %d, got %zu", 8 * 60, datalen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (data) {
|
if (data) {
|
||||||
free(data);
|
free(data);
|
||||||
|
|
|
@ -440,8 +440,8 @@ static int CmdT55xxSetConfig(const char *Cmd) {
|
||||||
arg_lit0(NULL, "PSK2", "set demodulation PSK 2"),
|
arg_lit0(NULL, "PSK2", "set demodulation PSK 2"),
|
||||||
arg_lit0(NULL, "PSK3", "set demodulation PSK 3"),
|
arg_lit0(NULL, "PSK3", "set demodulation PSK 3"),
|
||||||
arg_lit0(NULL, "NRZ", "set demodulation NRZ"),
|
arg_lit0(NULL, "NRZ", "set demodulation NRZ"),
|
||||||
arg_lit0(NULL, "BI", "set demodulation Biphase"),
|
arg_lit0(NULL, "BI", "set demodulation Biphase"),
|
||||||
arg_lit0(NULL, "BIA", "set demodulation Diphase (inverted biphase)"),
|
arg_lit0(NULL, "BIA", "set demodulation Diphase (inverted biphase)"),
|
||||||
arg_lit0("i", "inv", "set/reset data signal inversion"),
|
arg_lit0("i", "inv", "set/reset data signal inversion"),
|
||||||
arg_lit0(NULL, "q5", "set/reset as Q5/T5555 chip instead of T55x7"),
|
arg_lit0(NULL, "q5", "set/reset as Q5/T5555 chip instead of T55x7"),
|
||||||
arg_lit0(NULL, "st", "set/reset Sequence Terminator on"),
|
arg_lit0(NULL, "st", "set/reset Sequence Terminator on"),
|
||||||
|
@ -458,9 +458,9 @@ static int CmdT55xxSetConfig(const char *Cmd) {
|
||||||
bool mods[12];
|
bool mods[12];
|
||||||
int verify_mods = 0;
|
int verify_mods = 0;
|
||||||
while (idx - 1 < sizeof(mods)) {
|
while (idx - 1 < sizeof(mods)) {
|
||||||
mods[idx - 1] = arg_get_lit(ctx, idx);
|
mods[idx - 1] = arg_get_lit(ctx, idx);
|
||||||
verify_mods += mods[idx - 1];
|
verify_mods += mods[idx - 1];
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Not these flags are used to Toggle the values.
|
// Not these flags are used to Toggle the values.
|
||||||
|
@ -516,7 +516,7 @@ static int CmdT55xxSetConfig(const char *Cmd) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == 9){
|
if (i == 9) {
|
||||||
PrintAndLogEx(FAILED, "Error select a valid bitrate");
|
PrintAndLogEx(FAILED, "Error select a valid bitrate");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ static int CmdT55xxSetConfig(const char *Cmd) {
|
||||||
|
|
||||||
// validate user specific sequence terminator
|
// validate user specific sequence terminator
|
||||||
// if use_st flag was supplied, then toggle and update the config block0; if not supplied skip the config block0 update.
|
// if use_st flag was supplied, then toggle and update the config block0; if not supplied skip the config block0 update.
|
||||||
if (use_st) {
|
if (use_st) {
|
||||||
config.ST ^= use_st;
|
config.ST ^= use_st;
|
||||||
config.block0 = ((config.block0 & ~(0x8)) | (config.ST << 3));
|
config.block0 = ((config.block0 & ~(0x8)) | (config.ST << 3));
|
||||||
}
|
}
|
||||||
|
@ -557,7 +557,7 @@ static int CmdT55xxSetConfig(const char *Cmd) {
|
||||||
config.downlink_mode = downlink_mode;
|
config.downlink_mode = downlink_mode;
|
||||||
|
|
||||||
// validate user specific modulation
|
// validate user specific modulation
|
||||||
if (mods[0]){
|
if (mods[0]) {
|
||||||
config.modulation = DEMOD_FSK;
|
config.modulation = DEMOD_FSK;
|
||||||
} else if (mods[1]) {
|
} else if (mods[1]) {
|
||||||
config.modulation = DEMOD_FSK1;
|
config.modulation = DEMOD_FSK1;
|
||||||
|
@ -587,7 +587,7 @@ static int CmdT55xxSetConfig(const char *Cmd) {
|
||||||
} else if (mods[11]) {
|
} else if (mods[11]) {
|
||||||
config.modulation = DEMOD_BIa;
|
config.modulation = DEMOD_BIa;
|
||||||
config.inverted = 1;
|
config.inverted = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.block0 = ((config.block0 & ~(0x1f000)) | (config.modulation << 12));
|
config.block0 = ((config.block0 & ~(0x1f000)) | (config.modulation << 12));
|
||||||
|
|
||||||
|
@ -643,10 +643,10 @@ static int CmdT55xxReadBlock(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "lf t55xx read",
|
CLIParserInit(&ctx, "lf t55xx read",
|
||||||
"Read T55xx block data. This commands defaults to page 0.\n\n"
|
"Read T55xx block data. This commands defaults to page 0.\n\n"
|
||||||
_RED_(" * * * WARNING * * *") "\n"
|
_RED_(" * * * WARNING * * *") "\n"
|
||||||
_CYAN_("Use of read with password on a tag not configured") "\n"
|
_CYAN_("Use of read with password on a tag not configured") "\n"
|
||||||
_CYAN_("for a password can damage the tag") "\n"
|
_CYAN_("for a password can damage the tag") "\n"
|
||||||
_RED_(" * * * * * * * * * *"),
|
_RED_(" * * * * * * * * * *"),
|
||||||
"lf t55xx read -b 0 --> read data from block 0\n"
|
"lf t55xx read -b 0 --> read data from block 0\n"
|
||||||
"lf t55xx read -b 0 --pwd 01020304 --> read data from block 0, pwd 01020304\n"
|
"lf t55xx read -b 0 --pwd 01020304 --> read data from block 0, pwd 01020304\n"
|
||||||
"lf t55xx read -b 0 --pwd 01020304 -o --> read data from block 0, pwd 01020304, override\n"
|
"lf t55xx read -b 0 --pwd 01020304 -o --> read data from block 0, pwd 01020304, override\n"
|
||||||
|
@ -657,7 +657,7 @@ static int CmdT55xxReadBlock(const char *Cmd) {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_int1("b", "blk", "<0-7>", "block number to read"),
|
arg_int1("b", "blk", "<0-7>", "block number to read"),
|
||||||
arg_str0("p", "pwd", "<hex>", "password (4 hex bytes)"),
|
arg_str0("p", "pwd", "<hex>", "password (4 hex bytes)"),
|
||||||
arg_lit0("o", "override", "override safety check"),
|
arg_lit0("o", "override", "override safety check"),
|
||||||
arg_lit0(NULL, "pg1", "read page 1"),
|
arg_lit0(NULL, "pg1", "read page 1"),
|
||||||
};
|
};
|
||||||
uint8_t idx = 5;
|
uint8_t idx = 5;
|
||||||
|
@ -1680,7 +1680,7 @@ static int CmdT55xxReadTrace(const char *Cmd) {
|
||||||
// 1 (help) + 1 (one user specified params) + (5 T55XX_DLMODE_SINGLE)
|
// 1 (help) + 1 (one user specified params) + (5 T55XX_DLMODE_SINGLE)
|
||||||
void *argtable[2 + 5] = {
|
void *argtable[2 + 5] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_lit0("1", NULL, "extract using data from graphbuffer"),
|
arg_lit0("1", NULL, "extract using data from graphbuffer"),
|
||||||
};
|
};
|
||||||
uint8_t idx = 2;
|
uint8_t idx = 2;
|
||||||
arg_add_t55xx_downloadlink(argtable, &idx, T55XX_DLMODE_SINGLE, config.downlink_mode);
|
arg_add_t55xx_downloadlink(argtable, &idx, T55XX_DLMODE_SINGLE, config.downlink_mode);
|
||||||
|
@ -1731,7 +1731,7 @@ static int CmdT55xxReadTrace(const char *Cmd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DemodBufferLen == 0){
|
if (DemodBufferLen == 0) {
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2360,13 +2360,13 @@ static int CmdT55xxRestore(const char *Cmd) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval != PM3_SUCCESS) {
|
if (retval != PM3_SUCCESS) {
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (datalen == T55x7_BLOCK_COUNT * 4) {
|
if (datalen == T55x7_BLOCK_COUNT * 4) {
|
||||||
// 12 blocks * 4 bytes per block
|
// 12 blocks * 4 bytes per block
|
||||||
|
|
||||||
// this fct creats strings to call "lf t55 write" command.
|
// this fct creats strings to call "lf t55 write" command.
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
@ -3058,9 +3058,9 @@ static int CmdT55xxChkPwds(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t downlink_mode = refFixedBit; // Password checks should always start with default/fixed bit unluess requested by user for specific mode
|
uint8_t downlink_mode = refFixedBit; // Password checks should always start with default/fixed bit unluess requested by user for specific mode
|
||||||
// if (r0 || ra) // ra should start downlink mode ad fixed bit to loop through all modes correctly
|
// if (r0 || ra) // ra should start downlink mode ad fixed bit to loop through all modes correctly
|
||||||
// downlink_mode = refFixedBit;
|
// downlink_mode = refFixedBit;
|
||||||
// else
|
// else
|
||||||
if (r1)
|
if (r1)
|
||||||
downlink_mode = refLongLeading;
|
downlink_mode = refLongLeading;
|
||||||
else if (r2)
|
else if (r2)
|
||||||
|
@ -3069,7 +3069,7 @@ static int CmdT55xxChkPwds(const char *Cmd) {
|
||||||
downlink_mode = ref1of4;
|
downlink_mode = ref1of4;
|
||||||
|
|
||||||
bool use_pwd_file = true; // Assume we are going to use a file, unless turned off later.
|
bool use_pwd_file = true; // Assume we are going to use a file, unless turned off later.
|
||||||
|
|
||||||
if (strlen(filename) == 0) {
|
if (strlen(filename) == 0) {
|
||||||
snprintf(filename, sizeof(filename), "t55xx_default_pwds");
|
snprintf(filename, sizeof(filename), "t55xx_default_pwds");
|
||||||
}
|
}
|
||||||
|
@ -3265,10 +3265,10 @@ static int CmdT55xxBruteForce(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t downlink_mode = refFixedBit; // if no downlink mode suppliled use fixed bit/default as the is the most common
|
uint8_t downlink_mode = refFixedBit; // if no downlink mode suppliled use fixed bit/default as the is the most common
|
||||||
// Since we dont know the password the config.downlink mode is of little value.
|
// Since we dont know the password the config.downlink mode is of little value.
|
||||||
// if (r0 || ra) // if try all (ra) then start at fixed bit for correct try all
|
// if (r0 || ra) // if try all (ra) then start at fixed bit for correct try all
|
||||||
// downlink_mode = refFixedBit;
|
// downlink_mode = refFixedBit;
|
||||||
// else
|
// else
|
||||||
if (r1)
|
if (r1)
|
||||||
downlink_mode = refLongLeading;
|
downlink_mode = refLongLeading;
|
||||||
else if (r2)
|
else if (r2)
|
||||||
|
|
|
@ -280,9 +280,9 @@ static int CmdPref(const char *Cmd) {
|
||||||
static int CmdClear(const char *Cmd) {
|
static int CmdClear(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "clear",
|
CLIParserInit(&ctx, "clear",
|
||||||
"Clear the Proxmark3 client terminal screen",
|
"Clear the Proxmark3 client terminal screen",
|
||||||
"clear"
|
"clear"
|
||||||
);
|
);
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
arg_param_end
|
arg_param_end
|
||||||
|
@ -296,7 +296,7 @@ static int CmdClear(const char *Cmd) {
|
||||||
static command_t CommandTable[] = {
|
static command_t CommandTable[] = {
|
||||||
|
|
||||||
{"help", CmdHelp, AlwaysAvailable, "Use `" _YELLOW_("<command> help") "` for details of a command"},
|
{"help", CmdHelp, AlwaysAvailable, "Use `" _YELLOW_("<command> help") "` for details of a command"},
|
||||||
{"preferences", CmdPref, AlwaysAvailable, "{ Edit client/device preferences... }"},
|
{"preferences", CmdPref, AlwaysAvailable, "{ Edit client/device preferences... }"},
|
||||||
{"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Technology") " -----------------------"},
|
{"--------", CmdHelp, AlwaysAvailable, "----------------------- " _CYAN_("Technology") " -----------------------"},
|
||||||
{"analyse", CmdAnalyse, AlwaysAvailable, "{ Analyse utils... }"},
|
{"analyse", CmdAnalyse, AlwaysAvailable, "{ Analyse utils... }"},
|
||||||
{"data", CmdData, AlwaysAvailable, "{ Plot window / data buffer manipulation... }"},
|
{"data", CmdData, AlwaysAvailable, "{ Plot window / data buffer manipulation... }"},
|
||||||
|
|
|
@ -262,7 +262,7 @@ static int smart_wait(uint8_t *out, int maxoutlen, bool verbose) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
PacketResponseNG resp;
|
PacketResponseNG resp;
|
||||||
if (WaitForResponseTimeout(CMD_SMART_RAW, &resp, 1000)) {
|
if (WaitForResponseTimeout(CMD_SMART_RAW, &resp, 1000)) {
|
||||||
|
|
||||||
if (resp.status != PM3_SUCCESS) {
|
if (resp.status != PM3_SUCCESS) {
|
||||||
if (verbose) PrintAndLogEx(WARNING, "smart card response status failed");
|
if (verbose) PrintAndLogEx(WARNING, "smart card response status failed");
|
||||||
return -3;
|
return -3;
|
||||||
|
@ -283,7 +283,7 @@ static int smart_wait(uint8_t *out, int maxoutlen, bool verbose) {
|
||||||
if (len >= 2) {
|
if (len >= 2) {
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
|
||||||
|
|
||||||
if (out[len - 2] == 0x90 && out[len - 1] == 0x00) {
|
if (out[len - 2] == 0x90 && out[len - 1] == 0x00) {
|
||||||
PrintAndLogEx(SUCCESS, _GREEN_("%02X%02X") " | %s", out[len - 2], out[len - 1], GetAPDUCodeDescription(out[len - 2], out[len - 1]));
|
PrintAndLogEx(SUCCESS, _GREEN_("%02X%02X") " | %s", out[len - 2], out[len - 1], GetAPDUCodeDescription(out[len - 2], out[len - 1]));
|
||||||
} else {
|
} else {
|
||||||
|
@ -299,7 +299,7 @@ static int smart_wait(uint8_t *out, int maxoutlen, bool verbose) {
|
||||||
}
|
}
|
||||||
} while (i--);
|
} while (i--);
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
PrintAndLogEx(WARNING, "smart card response timeout");
|
PrintAndLogEx(WARNING, "smart card response timeout");
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -330,7 +330,7 @@ static int smart_responseEx(uint8_t *out, int maxoutlen, bool verbose) {
|
||||||
memcpy(payload->data, cmd_getresp, sizeof(cmd_getresp));
|
memcpy(payload->data, cmd_getresp, sizeof(cmd_getresp));
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + sizeof(cmd_getresp));
|
SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + sizeof(cmd_getresp));
|
||||||
free(payload);
|
free(payload);
|
||||||
|
|
||||||
datalen = smart_wait(out, maxoutlen, verbose);
|
datalen = smart_wait(out, maxoutlen, verbose);
|
||||||
|
@ -424,7 +424,7 @@ static int CmdSmartRaw(const char *Cmd) {
|
||||||
payload->flags |= SC_SELECT;
|
payload->flags |= SC_SELECT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dlen > 0) {
|
if (dlen > 0) {
|
||||||
if (use_t0)
|
if (use_t0)
|
||||||
payload->flags |= SC_RAW_T0;
|
payload->flags |= SC_RAW_T0;
|
||||||
else
|
else
|
||||||
|
@ -439,9 +439,9 @@ static int CmdSmartRaw(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + dlen);
|
SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + dlen);
|
||||||
|
|
||||||
if (reply == false) {
|
if (reply == false) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,7 +459,7 @@ static int CmdSmartRaw(const char *Cmd) {
|
||||||
data[4] = buf[1];
|
data[4] = buf[1];
|
||||||
memcpy(payload->data, data, dlen);
|
memcpy(payload->data, data, dlen);
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + dlen);
|
SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + dlen);
|
||||||
|
|
||||||
len = smart_response(buf, PM3_CMD_DATA_SIZE);
|
len = smart_response(buf, PM3_CMD_DATA_SIZE);
|
||||||
|
|
||||||
|
@ -858,7 +858,7 @@ static void smart_brute_prim(void) {
|
||||||
memcpy(payload->data, get_card_data + i, 5);
|
memcpy(payload->data, get_card_data + i, 5);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + 5);
|
SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + 5);
|
||||||
free(payload);
|
free(payload);
|
||||||
|
|
||||||
int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
|
int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
|
||||||
|
@ -901,7 +901,7 @@ static int smart_brute_sfi(bool decodeTLV) {
|
||||||
memcpy(payload->data, READ_RECORD, sizeof(READ_RECORD));
|
memcpy(payload->data, READ_RECORD, sizeof(READ_RECORD));
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + sizeof(READ_RECORD));
|
SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + sizeof(READ_RECORD));
|
||||||
|
|
||||||
len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
|
len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
|
||||||
|
|
||||||
|
@ -910,7 +910,7 @@ static int smart_brute_sfi(bool decodeTLV) {
|
||||||
|
|
||||||
memcpy(payload->data, READ_RECORD, sizeof(READ_RECORD));
|
memcpy(payload->data, READ_RECORD, sizeof(READ_RECORD));
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + sizeof(READ_RECORD));
|
SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + sizeof(READ_RECORD));
|
||||||
len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
|
len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
|
||||||
|
|
||||||
READ_RECORD[4] = 0;
|
READ_RECORD[4] = 0;
|
||||||
|
@ -952,7 +952,7 @@ static void smart_brute_options(bool decodeTLV) {
|
||||||
memcpy(payload->data, GET_PROCESSING_OPTIONS, sizeof(GET_PROCESSING_OPTIONS));
|
memcpy(payload->data, GET_PROCESSING_OPTIONS, sizeof(GET_PROCESSING_OPTIONS));
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + sizeof(GET_PROCESSING_OPTIONS));
|
SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + sizeof(GET_PROCESSING_OPTIONS));
|
||||||
free(payload);
|
free(payload);
|
||||||
|
|
||||||
int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
|
int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
|
||||||
|
@ -1054,7 +1054,7 @@ static int CmdSmartBruteforceSFI(const char *Cmd) {
|
||||||
|
|
||||||
memcpy(payload->data, cmddata, hexlen);
|
memcpy(payload->data, cmddata, hexlen);
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + hexlen);
|
SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + hexlen);
|
||||||
free(payload);
|
free(payload);
|
||||||
|
|
||||||
int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
|
int len = smart_responseEx(buf, PM3_CMD_DATA_SIZE, false);
|
||||||
|
@ -1138,7 +1138,7 @@ int ExchangeAPDUSC(bool verbose, uint8_t *datain, int datainlen, bool activateCa
|
||||||
memcpy(payload->data, datain, datainlen);
|
memcpy(payload->data, datain, datainlen);
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + datainlen);
|
SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + datainlen);
|
||||||
|
|
||||||
int len = smart_responseEx(dataout, maxdataoutlen, verbose);
|
int len = smart_responseEx(dataout, maxdataoutlen, verbose);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
|
@ -1155,7 +1155,7 @@ int ExchangeAPDUSC(bool verbose, uint8_t *datain, int datainlen, bool activateCa
|
||||||
datain[4] = dataout[len - 1];
|
datain[4] = dataout[len - 1];
|
||||||
memcpy(payload->data, datain, 5);
|
memcpy(payload->data, datain, 5);
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_SMART_RAW, (uint8_t*)payload, sizeof(smart_card_raw_t) + 5);
|
SendCommandNG(CMD_SMART_RAW, (uint8_t *)payload, sizeof(smart_card_raw_t) + 5);
|
||||||
datain[4] = 0;
|
datain[4] = 0;
|
||||||
len = smart_responseEx(dataout, maxdataoutlen, verbose);
|
len = smart_responseEx(dataout, maxdataoutlen, verbose);
|
||||||
}
|
}
|
||||||
|
|
|
@ -839,7 +839,7 @@ static bool dl_it(uint8_t *dest, uint32_t bytes, PacketResponseNG *response, siz
|
||||||
|
|
||||||
if (response->cmd == CMD_ACK)
|
if (response->cmd == CMD_ACK)
|
||||||
return true;
|
return true;
|
||||||
// Spiffs download is converted to NG,
|
// Spiffs download is converted to NG,
|
||||||
if (response->cmd == CMD_SPIFFS_DOWNLOAD)
|
if (response->cmd == CMD_SPIFFS_DOWNLOAD)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
@ -695,7 +695,7 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl
|
||||||
mem[4] = (chunk & 0xFF);
|
mem[4] = (chunk & 0xFF);
|
||||||
|
|
||||||
// upload to flash.
|
// upload to flash.
|
||||||
res = flashmem_spiffs_load((char*)destfn, mem, 5 + (chunk * 6));
|
res = flashmem_spiffs_load((char *)destfn, mem, 5 + (chunk * 6));
|
||||||
if (res != PM3_SUCCESS) {
|
if (res != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(WARNING, "\nSPIFFS upload failed");
|
PrintAndLogEx(WARNING, "\nSPIFFS upload failed");
|
||||||
free(mem);
|
free(mem);
|
||||||
|
@ -769,7 +769,7 @@ int mfReadBlock(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t *data) {
|
||||||
mf_readblock_t payload = {
|
mf_readblock_t payload = {
|
||||||
.blockno = blockNo,
|
.blockno = blockNo,
|
||||||
.keytype = keyType
|
.keytype = keyType
|
||||||
};
|
};
|
||||||
memcpy(payload.key, key, sizeof(payload.key));
|
memcpy(payload.key, key, sizeof(payload.key));
|
||||||
|
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
|
@ -1224,13 +1224,13 @@ int detect_mfc_ev1_signature(uint8_t *signature) {
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
uint8_t sign[32] = {0};
|
uint8_t sign[32] = {0};
|
||||||
uint8_t key[] = {0x4b, 0x79, 0x1b, 0xea, 0x7b, 0xcc};
|
uint8_t key[] = {0x4b, 0x79, 0x1b, 0xea, 0x7b, 0xcc};
|
||||||
int res = mfReadBlock(69, 1, key, sign);
|
int res = mfReadBlock(69, 1, key, sign);
|
||||||
if ( res == PM3_SUCCESS) {
|
if (res == PM3_SUCCESS) {
|
||||||
res = mfReadBlock(70, 1, key, sign + 16);
|
res = mfReadBlock(70, 1, key, sign + 16);
|
||||||
if (res == PM3_SUCCESS) {
|
if (res == PM3_SUCCESS) {
|
||||||
memcpy(signature, sign, sizeof(sign));
|
memcpy(signature, sign, sizeof(sign));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue