From 026cd7d53d017b10dcaab858f377e7e784682ea3 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sun, 15 Oct 2023 13:21:16 +0200 Subject: [PATCH] style --- armsrc/i2c.c | 8 ++-- client/experimental_lib/example_c/test_grab.c | 10 ++--- client/src/cmddata.c | 2 +- client/src/cmdhficlass.c | 20 +++++----- client/src/comms.c | 2 +- doc/commands.json | 37 +++++++++---------- doc/commands.md | 2 +- 7 files changed, 40 insertions(+), 41 deletions(-) diff --git a/armsrc/i2c.c b/armsrc/i2c.c index 39f623197..da9d5b9c7 100644 --- a/armsrc/i2c.c +++ b/armsrc/i2c.c @@ -717,10 +717,10 @@ void I2C_print_status(void) { if (I2C_get_version(&major, &minor) == PM3_SUCCESS) { Dbprintf(" version................. v%x.%02d ( %s )" - , major - , minor - , ( (major == 4) && (minor == 42) ) ? _GREEN_("ok") : _RED_("Outdated") - ); + , major + , minor + , ((major == 4) && (minor == 42)) ? _GREEN_("ok") : _RED_("Outdated") + ); } else { DbpString(" version................. ( " _RED_("fail") " )"); } diff --git a/client/experimental_lib/example_c/test_grab.c b/client/experimental_lib/example_c/test_grab.c index 6b093b3ce..f4a6c64bf 100644 --- a/client/experimental_lib/example_c/test_grab.c +++ b/client/experimental_lib/example_c/test_grab.c @@ -23,7 +23,7 @@ int main(int argc, char *argv[]) { // child if (pid == 0) { printf("[INFO] inside child\n"); - + // Redirect stdout to the write end of the pipe dup2(pipefd[1], STDOUT_FILENO); @@ -39,13 +39,13 @@ int main(int argc, char *argv[]) { pm3_close(p); _exit(-1); } else { - + printf("[INFO] inside parent\n"); // Parent: close write end of the pipe close(pipefd[1]); - + // Read from the pipe - while (1) { + while (1) { n = read(pipefd[0], buf, sizeof(buf)); if (n == -1) { continue; @@ -63,5 +63,5 @@ int main(int argc, char *argv[]) { // Close read end close(pipefd[0]); - } + } } diff --git a/client/src/cmddata.c b/client/src/cmddata.c index d628a9285..a1ed8dc65 100644 --- a/client/src/cmddata.c +++ b/client/src/cmddata.c @@ -3289,7 +3289,7 @@ static int CmdNumCon(const char *Cmd) { for (uint8_t i = 0; i < ARRAYLEN(radix); i++) { MBEDTLS_MPI_CHK(mbedtls_mpi_write_string(&N, radix[i].radix, s, sizeof(s), &slen)); - if (slen > 0) { + if (slen > 0) { PrintAndLogEx(SUCCESS, "%s%s", radix[i].desc, s); } } diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index b72eba40c..df520cb78 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -365,7 +365,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke // KEYROLL need to encrypt uint8_t key_en[16] = {0}; uint8_t *keyptr_en = NULL; - if (IsCardHelperPresent(false) == false){ + if (IsCardHelperPresent(false) == false) { size_t keylen = 0; int res_key = loadFile_safe(ICLASS_DECRYPTION_BIN, "", (void **)&keyptr_en, &keylen); if (res_key != PM3_SUCCESS) { @@ -384,13 +384,13 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke PrintAndLogEx(INFO, "Setting up encryption... " NOLF); uint8_t ffs[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; - if (IsCardHelperPresent(false) != false){ + if (IsCardHelperPresent(false) != false) { if (Encrypt(ffs, ffs) == false) { PrintAndLogEx(WARNING, "failed to encrypt FF"); } else { PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); } - }else{ + } else { iclass_encrypt_block_data(ffs, key_en); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); } @@ -400,13 +400,13 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke uint8_t lkey[8]; memcpy(lkey, key, sizeof(lkey)); uint8_t enckey1[8]; - if (IsCardHelperPresent(false) != false){ + if (IsCardHelperPresent(false) != false) { if (Encrypt(lkey, enckey1) == false) { PrintAndLogEx(WARNING, "failed to encrypt key1"); } else { PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); } - }else{ + } else { iclass_encrypt_block_data(lkey, key_en); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); } @@ -416,7 +416,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke memcpy(data + (6 * 8), o->data, sizeof(o->data)); // encrypted keyroll key 0D - if (IsCardHelperPresent(false) != false){ + if (IsCardHelperPresent(false) != false) { memcpy(data + (0x0D * 8), enckey1, sizeof(enckey1)); } else { memcpy(data + (0x0D * 8), lkey, sizeof(enckey1)); @@ -432,14 +432,14 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke uint8_t foo[8] = {0x15}; memcpy(foo + 1, key, 7); uint8_t enckey2[8]; - if (IsCardHelperPresent(false) != false){ + if (IsCardHelperPresent(false) != false) { if (Encrypt(foo, enckey2) == false) { PrintAndLogEx(WARNING, "failed to encrypt partial 1"); } else { PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); memcpy(data + (0x14 * 8), enckey2, sizeof(enckey2)); } - }else{ + } else { iclass_encrypt_block_data(foo, key_en); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); memcpy(data + (0x14 * 8), foo, sizeof(enckey2)); @@ -449,14 +449,14 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke PrintAndLogEx(INFO, "Setting encrypted partial key15... " NOLF); memset(foo, 0xFF, sizeof(foo)); foo[0] = lkey[7]; - if (IsCardHelperPresent(false) != false){ + if (IsCardHelperPresent(false) != false) { if (Encrypt(foo, enckey2) == false) { PrintAndLogEx(WARNING, "failed to encrypt partial 2"); } else { PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); memcpy(data + (0x15 * 8), enckey2, sizeof(enckey2)); } - }else{ + } else { iclass_encrypt_block_data(foo, key_en); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )"); memcpy(data + (0x15 * 8), foo, sizeof(enckey2)); diff --git a/client/src/comms.c b/client/src/comms.c index 4aaa37689..6fd2ff9b0 100644 --- a/client/src/comms.c +++ b/client/src/comms.c @@ -682,7 +682,7 @@ int TestProxmark(pm3_device_t *dev) { int res; if (is_tcp_conn || is_udp_conn) { if ((strstr(g_conn.serial_port_name, "localhost") != NULL) || - (strstr(g_conn.serial_port_name, "127.0.0.1") != NULL)) { + (strstr(g_conn.serial_port_name, "127.0.0.1") != NULL)) { res = uart_reconfigure_timeouts(UART_TCP_CLIENT_LOCAL_RX_TIMEOUT_MS); } else { res = uart_reconfigure_timeouts(UART_TCP_CLIENT_RX_TIMEOUT_MS); diff --git a/doc/commands.json b/doc/commands.json index 35ff5d2d9..20b4b941f 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -3178,10 +3178,10 @@ "offline": false, "options": [ "-h, --help This help", - "-b, --blk block number", + "--blk block number", "-d, --data bytes to write, 8 hex bytes" ], - "usage": "hf iclass esetblk [-h] -b [-d ]" + "usage": "hf iclass esetblk [-h] --blk [-d ]" }, "hf iclass eview": { "command": "hf iclass eview", @@ -3309,16 +3309,16 @@ "command": "hf iclass rdbl", "description": "Read a iCLASS block from tag", "notes": [ - "hf iclass rdbl -b 6 -k 0011223344556677", - "hf iclass rdbl -b 27 -k 0011223344556677 --credit", - "hf iclass rdbl -b 10 --ki 0" + "hf iclass rdbl --blk 6 -k 0011223344556677", + "hf iclass rdbl --blk 27 -k 0011223344556677 --credit", + "hf iclass rdbl --blk 10 --ki 0" ], "offline": false, "options": [ "-h, --help This help", "-k, --key Access key as 8 hex bytes", "--ki Key index to select key from memory 'hf iclass managekeys'", - "-b, --block The block number to read", + "--blk Block number", "--credit key is assumed to be the credit key", "--elite elite computations applied to key", "--raw no computations applied to key", @@ -3326,7 +3326,7 @@ "-v, --verbose verbose output", "--shallow use shallow (ASK) reader modulation instead of OOK" ], - "usage": "hf iclass rdbl [-hv] [-k ] [--ki ] -b [--credit] [--elite] [--raw] [--nr] [--shallow]" + "usage": "hf iclass rdbl [-hv] [-k ] [--ki ] --blk [--credit] [--elite] [--raw] [--nr] [--shallow]" }, "hf iclass reader": { "command": "hf iclass reader", @@ -3368,17 +3368,16 @@ }, "hf iclass sam": { "command": "hf iclass sam", - "description": "Manage via SAM", + "description": "Extract PACS via a HID SAM", "notes": [ "hf iclass sam" ], "offline": false, "options": [ "-h, --help This help", - "-d, --data data", "-v, --verbose verbose output" ], - "usage": "hf iclass sam [-hv] [-d ]" + "usage": "hf iclass sam [-hv]" }, "hf iclass sim": { "command": "hf iclass sim", @@ -3437,16 +3436,16 @@ "command": "hf iclass wrbl", "description": "Write data to an iCLASS tag", "notes": [ - "hf iclass wrbl -b 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B", - "hf iclass wrbl -b 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B --credit", - "hf iclass wrbl -b 10 -d AAAAAAAAAAAAAAAA --ki 0" + "hf iclass wrbl --blk 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B", + "hf iclass wrbl --blk 10 -d AAAAAAAAAAAAAAAA -k 001122334455667B --credit", + "hf iclass wrbl --blk 10 -d AAAAAAAAAAAAAAAA --ki 0" ], "offline": false, "options": [ "-h, --help This help", "-k, --key Access key as 8 hex bytes", "--ki Key index to select key from memory 'hf iclass managekeys'", - "-b, --block The block number to read", + "--blk block number", "-d, --data data to write as 8 hex bytes", "-m, --mac replay mac data (4 hex bytes)", "--credit key is assumed to be the credit key", @@ -3456,7 +3455,7 @@ "-v, --verbose verbose output", "--shallow use shallow (ASK) reader modulation instead of OOK" ], - "usage": "hf iclass wrbl [-hv] [-k ] [--ki ] -b -d [-m ] [--credit] [--elite] [--raw] [--nr] [--shallow]" + "usage": "hf iclass wrbl [-hv] [-k ] [--ki ] --blk -d [-m ] [--credit] [--elite] [--raw] [--nr] [--shallow]" }, "hf jooki clone": { "command": "hf jooki clone", @@ -3951,15 +3950,15 @@ "command": "hf lto wrbl", "description": "Write data to block on LTO tag", "notes": [ - "hf lto wrbl --block 128 -d 0001020304050607080910111213141516171819202122232425262728293031" + "hf lto wrbl --blk 128 -d 0001020304050607080910111213141516171819202122232425262728293031" ], "offline": false, "options": [ "-h, --help This help", "-d, --data 32 bytes of data to write (64 hex symbols, no spaces)", - "--block The block number to write to as an integer" + "--blk The block number to write to as an integer" ], - "usage": "hf lto wrbl [-h] -d --block " + "usage": "hf lto wrbl [-h] -d --blk " }, "hf mf acl": { "command": "hf mf acl", @@ -11857,6 +11856,6 @@ "metadata": { "commands_extracted": 687, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2023-10-12T12:53:10" + "extracted_on": "2023-10-15T11:21:02" } } \ No newline at end of file diff --git a/doc/commands.md b/doc/commands.md index 40216f74b..07d744045 100644 --- a/doc/commands.md +++ b/doc/commands.md @@ -2,7 +2,7 @@ # Proxmark3 command dump -Some commands are available only if a Proxmark3 is actually connected. +Some commands are available only if a Proxmark3 is actually connected. Check column "offline" for their availability.