From bc1c47e81be5a4b9445376a6e71f1dc05df429a0 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 13 Apr 2025 12:25:14 +0200 Subject: [PATCH] style --- armsrc/Standalone/hf_mattyrun.h | 2 +- armsrc/iso14443a.c | 16 ++++++++-------- client/deps/cliparser/argtable3.c | 4 ++-- client/luascripts/kybercrystals.lua | 2 +- client/src/cmdhfmfu.c | 12 +++++------- client/src/cmdhftesla.c | 8 ++++---- doc/commands.json | 7 ++++--- 7 files changed, 25 insertions(+), 26 deletions(-) diff --git a/armsrc/Standalone/hf_mattyrun.h b/armsrc/Standalone/hf_mattyrun.h index 17dfd0edd..892232e88 100644 --- a/armsrc/Standalone/hf_mattyrun.h +++ b/armsrc/Standalone/hf_mattyrun.h @@ -21,7 +21,7 @@ #include -// Filename to store the card info in spiff memory +// Filename to store the card info in spiff memory #define DUMP_FILE "hf_mattyrun_dump_%02x%02x%02x%02x.bin" // Set of standard keys to be used diff --git a/armsrc/iso14443a.c b/armsrc/iso14443a.c index 65453f24b..ddc3be0f9 100644 --- a/armsrc/iso14443a.c +++ b/armsrc/iso14443a.c @@ -193,9 +193,9 @@ void printHf14aConfig(void) { ); Dbprintf(" [p] Polling loop annotation....... %s %*D", (hf14aconfig.polling_loop_annotation.frame_length <= 0) ? _YELLOW_("disabled") : _GREEN_("enabled"), - hf14aconfig.polling_loop_annotation.frame_length, + hf14aconfig.polling_loop_annotation.frame_length, hf14aconfig.polling_loop_annotation.frame, - "" + "" ); } @@ -2713,22 +2713,22 @@ static int GetATQA(uint8_t *resp, uint16_t resp_len, uint8_t *resp_par, iso14a_p uint32_t save_iso14a_timeout = iso14a_get_timeout(); iso14a_set_timeout(1236 / 128 + 1); // response to WUPA is expected at exactly 1236/fc. No need to wait longer. - + // Create temporary polling parameters structure that might include both standard and custom frames iso14a_polling_parameters_t temp_params; memcpy(&temp_params, polling_parameters, sizeof(iso14a_polling_parameters_t)); - + // If we have a custom polling frame annotation, add it to the temporary structure if (hf14aconfig.polling_loop_annotation.frame_length > 0) { // Only add if we have space in the frames array if (temp_params.frame_count < ARRAYLEN(temp_params.frames)) { // Add the custom frame at the end of the frames array - memcpy(&temp_params.frames[temp_params.frame_count], - &hf14aconfig.polling_loop_annotation, + memcpy(&temp_params.frames[temp_params.frame_count], + &hf14aconfig.polling_loop_annotation, sizeof(iso14a_polling_frame_t)); temp_params.frame_count++; } - + // Increase timeout if polling loop annotation is provided, as target may respond slower if (temp_params.extra_timeout == 0) { temp_params.extra_timeout = 250; @@ -2740,7 +2740,7 @@ static int GetATQA(uint8_t *resp, uint16_t resp_len, uint8_t *resp_par, iso14a_p uint32_t retry_timeout = WUPA_RETRY_TIMEOUT * temp_params.frame_count + temp_params.extra_timeout; uint32_t start_time = 0; uint8_t current_frame = 0; - + // Use the temporary polling parameters do { iso14a_polling_frame_t *frame_parameters = &temp_params.frames[current_frame]; diff --git a/client/deps/cliparser/argtable3.c b/client/deps/cliparser/argtable3.c index 0680e8dc9..080d0ad9a 100644 --- a/client/deps/cliparser/argtable3.c +++ b/client/deps/cliparser/argtable3.c @@ -3621,12 +3621,12 @@ TRex *trex_compile(const TRexChar *pattern, const TRexChar **error, int flags) { exp->_first = trex_newnode(exp, OP_EXPR); exp->_error = error; exp->_jmpbuf = malloc(sizeof(jmp_buf)); - + if (exp->_jmpbuf == NULL) { trex_free(exp); return NULL; } - + exp->_flags = flags; if (setjmp(*((jmp_buf *)exp->_jmpbuf)) == 0) { int res = trex_list(exp); diff --git a/client/luascripts/kybercrystals.lua b/client/luascripts/kybercrystals.lua index 3052724cb..9df3f7a76 100644 --- a/client/luascripts/kybercrystals.lua +++ b/client/luascripts/kybercrystals.lua @@ -744,4 +744,4 @@ function main() print("\n[+] Read complete. Review output above.") end -main() \ No newline at end of file +main() diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index 0ccb852cf..872fc0f40 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -451,7 +451,7 @@ static int ul_comp_write(uint8_t page, const uint8_t *data, uint8_t datalen) { uint8_t response[1] = {0xFF}; ul_send_cmd_raw(cmd, 2 + datalen, response, sizeof(response)); // ACK - if (response[0] == 0x0a) { + if (response[0] == CARD_ACK) { return PM3_SUCCESS; } // NACK @@ -470,7 +470,8 @@ static int ulev1_requestAuthentication(const uint8_t *pwd, uint8_t *pack, uint16 int len = ul_send_cmd_raw(cmd, sizeof(cmd), pack, packLength); // NACK tables different tags, but between 0-9 is a NEGATIVE response. // ACK == 0xA - if (len == 1 && pack[0] <= 0x09) { + // should only give you PACK (4 byytes) + if (len == 1) { return PM3_EWRONGANSWER; } return len; @@ -498,10 +499,7 @@ static int ulaes_requestAuthentication(const uint8_t *key, uint8_t keyno, bool s if (WaitForResponseTimeout(CMD_HF_MIFAREULAES_AUTH, &resp, 1500) == false) { return PM3_ETIMEOUT; } - if (resp.status != PM3_SUCCESS) { - return resp.status; - } - return PM3_SUCCESS; + return resp.status; } static int ulc_authentication(const uint8_t *key, bool switch_off_field) { @@ -2048,7 +2046,7 @@ uint64_t GetHF14AMfU_Type(void) { } } - } else if ((card.uid[0] == 0x05) && (card.atqa[0] == 0x44)){ + } else if ((card.uid[0] == 0x05) && (card.atqa[0] == 0x44)) { // Infineon MY-D tests Exam high nibble DropField(); uint8_t nib = (card.uid[1] & 0xf0) >> 4; diff --git a/client/src/cmdhftesla.c b/client/src/cmdhftesla.c index eb81145e4..bf42f84cb 100644 --- a/client/src/cmdhftesla.c +++ b/client/src/cmdhftesla.c @@ -193,17 +193,17 @@ static int info_hf_tesla(bool parse_certs) { } sw = get_sw(response, resplen); - if (sw == ISO7816_OK ) { + if (sw == ISO7816_OK) { // save CERT for later uint8_t cert[MAX_CERT_SIZE] = {0}; memcpy(cert, response, resplen - 2); - PrintAndLogEx(INFO, "%s", sprint_hex_inrow(cert+ (cert_len_present ? 2 : 0), resplen - 2)); + PrintAndLogEx(INFO, "%s", sprint_hex_inrow(cert + (cert_len_present ? 2 : 0), resplen - 2)); if (parse_certs) { - asn1_print(cert+ (cert_len_present ? 2 : 0), cert_len-2, " "); + asn1_print(cert + (cert_len_present ? 2 : 0), cert_len - 2, " "); } } - } else if ( sw == 0x6f17 ){ + } else if (sw == 0x6f17) { PrintAndLogEx(INFO, "CERT # %i", i); PrintAndLogEx(INFO, "No certificate in slot %i", i); } else { diff --git a/doc/commands.json b/doc/commands.json index 2012b339e..cfe1a6190 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -7873,9 +7873,10 @@ ], "offline": true, "options": [ - "-h, --help This help" + "-h, --help This help", + "-p, --parse Parse the certificates as ASN.1" ], - "usage": "hf telsa info [-h]" + "usage": "hf telsa info [-hp]" }, "hf tesla list": { "command": "hf tesla list", @@ -13357,6 +13358,6 @@ "metadata": { "commands_extracted": 767, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2025-03-24T22:47:29" + "extracted_on": "2025-04-13T10:20:08" } }