diff --git a/client/src/cmdhfntag424.c b/client/src/cmdhfntag424.c index 0b90b2b3d..835f88adc 100644 --- a/client/src/cmdhfntag424.c +++ b/client/src/cmdhfntag424.c @@ -628,10 +628,10 @@ static int ntag424_write_data(uint8_t fileno, uint32_t offset, uint32_t num_byte uint8_t cmd_header[] = { fileno, - (uint8_t)offset, - (uint8_t)(offset << 8), + (uint8_t)offset, + (uint8_t)(offset << 8), (uint8_t)(offset << 16), // offset - (uint8_t)num_bytes, + (uint8_t)num_bytes, (uint8_t)(num_bytes >> 8), (uint8_t)(num_bytes >> 16) // size }; @@ -768,7 +768,7 @@ static int CmdHF_ntag424_view(const char *Cmd) { // to be implemented... PrintAndLogEx(INFO, "not implemented yet"); - PrintAndLogEx(INFO, "Feel free to contribute!"); + PrintAndLogEx(INFO, "Feel free to contribute!"); free(dump); return PM3_SUCCESS; @@ -978,7 +978,7 @@ static int CmdHF_ntag424_write(const char *Cmd) { PrintAndLogEx(ERR, "Only plain communication mode can be used without a key specified"); return PM3_EINVARG; } - + if (SelectCard14443A_4(false, true, NULL) != PM3_SUCCESS) { DropField(); PrintAndLogEx(ERR, "Failed to select card"); @@ -1081,7 +1081,7 @@ static int CmdHF_ntag424_changefilesettings(const char *Cmd) { "You must also start with sdmdata1, then sdmdata2, up to the number of sdm_data you want to write", "hf ntag424 changefs --fileno 2 --keyno 0 -k 00000000000000000000000000000000 -o 40 -a 00E0 -s C1 -c F000 --data1 000020 --data2 000043 --data3 000043" - ); + ); void *argtable[] = { arg_param_begin, diff --git a/client/src/cmdlfem4x05.c b/client/src/cmdlfem4x05.c index 9b0e69753..f93db58d3 100644 --- a/client/src/cmdlfem4x05.c +++ b/client/src/cmdlfem4x05.c @@ -832,9 +832,9 @@ int CmdEM4x05Write(const char *Cmd) { PrintAndLogEx(INFO, "Writing address " _YELLOW_("%d") " data " _YELLOW_("%08X") " using password " _YELLOW_("%08X"), addr, data, pwd); } else { if (protect_operation) - PrintAndLogEx(INFO, "Writing protection words data " _YELLOW_("%08X") , data); + PrintAndLogEx(INFO, "Writing protection words data " _YELLOW_("%08X"), data); else - PrintAndLogEx(INFO, "Writing address " _YELLOW_("%d") " data " _YELLOW_("%08X") , addr, data); + PrintAndLogEx(INFO, "Writing address " _YELLOW_("%d") " data " _YELLOW_("%08X"), addr, data); } res = PM3_SUCCESS; diff --git a/client/src/pm3line_vocabulary.h b/client/src/pm3line_vocabulary.h index 5b3720d85..858267278 100644 --- a/client/src/pm3line_vocabulary.h +++ b/client/src/pm3line_vocabulary.h @@ -459,8 +459,8 @@ const static vocabulary_t vocabulary[] = { { 0, "hf ntag424 auth" }, { 0, "hf ntag424 read" }, { 0, "hf ntag424 write" }, - { 0, "hf ntag424 getfilesettings" }, - { 0, "hf ntag424 changefilesettings" }, + { 0, "hf ntag424 getfs" }, + { 0, "hf ntag424 changefs" }, { 0, "hf ntag424 changekey" }, { 1, "hf seos help" }, { 0, "hf seos info" }, diff --git a/doc/commands.json b/doc/commands.json index 12bc7a5e1..4cb9c4623 100644 --- a/doc/commands.json +++ b/doc/commands.json @@ -6794,73 +6794,73 @@ "command": "hf ntag424 auth", "description": "Authenticate with selected key against NTAG424.", "notes": [ - "hf ntag424 auth -n 0 -k 00000000000000000000000000000000" + "hf ntag424 auth --keyno 0 -k 00000000000000000000000000000000" ], "offline": false, "options": [ "-h, --help This help", - "-n, --keyno Key number", + "--keyno Key number", "-k, --key Key for authenticate (HEX 16 bytes)" ], - "usage": "hf ntag424 auth [-h] -n -k " + "usage": "hf ntag424 auth [-h] --keyno -k " }, - "hf ntag424 changefilesettings": { - "command": "hf ntag424 changefilesettings", + "hf ntag424 changefs": { + "command": "hf ntag424 changefs", "description": "Updates file settings for file, must be authenticated. This is a short explanation of the settings. See AN12196 for more information: options: byte with bit flags Bit: Setting: 6 Enable SDM and mirroring access: two byte access rights. Each nibble is a key number, or E for free access. Order is key for readwrite, change, read and write sdmoptions: byte with bit flags Bit: Setting: 0 ASCII encoding 4 SDMEncFileData 5 SDMReadCtrLimit 6 SDMReadCtr 7 SDMOptionsUID sdmaccess: two byte access rights. Each nibble is a key, or E for plain mirror and F for no mirroring Order is Reserved, SDMCtrRet, SDMMetaRead and SDMFileRead sdm_data: Three bytes of data used to control SDM settings. Can be specified multiple times. Data means different things depending on settings. Note: Not all of these settings will be written. It depends on the option byte, and the keys set. See AN12196 for more information. You must also start with sdmdata1, then sdmdata2, up to the number of sdm_data you want to write", "notes": [ - "hf ntag424 changefilesettings -f 2 -n 0 -k 00000000000000000000000000000000 -o 40 -a 00E0 -s C1 -c F000 --sdmdata1 000020 --sdmdata2 000043 --sdmdata3 000043" + "hf ntag424 changefs --fileno 2 --keyno 0 -k 00000000000000000000000000000000 -o 40 -a 00E0 -s C1 -c F000 --data1 000020 --data2 000043 --data3 000043" ], "offline": false, "options": [ "-h, --help This help", - "-f, --file File number", - "-n, --keyno Key number", + "--fileno File number", + "--keyno Key number", "-k, --key Key for authentication (HEX 16 bytes)", "-o, --options File options byte (HEX 1 byte)", "-a, --access File access settings (HEX 2 bytes)", "-s, --sdmoptions SDM options (HEX 1 byte)", "-c, --sdmaccess SDM access settings (HEX 2 bytes)", - "--sdmdata1 SDM data (HEX 3 bytes)", - "--sdmdata2 SDM data (HEX 3 bytes)", - "--sdmdata3 SDM data (HEX 3 bytes)", - "--sdmdata4 SDM data (HEX 3 bytes)", - "--sdmdata5 SDM data (HEX 3 bytes)", - "--sdmdata6 SDM data (HEX 3 bytes)", - "--sdmdata7 SDM data (HEX 3 bytes)", - "--sdmdata8 SDM data (HEX 3 bytes)" + "--data1 SDM data (HEX 3 bytes)", + "--data2 SDM data (HEX 3 bytes)", + "--data3 SDM data (HEX 3 bytes)", + "--data4 SDM data (HEX 3 bytes)", + "--data5 SDM data (HEX 3 bytes)", + "--data6 SDM data (HEX 3 bytes)", + "--data7 SDM data (HEX 3 bytes)", + "--data8 SDM data (HEX 3 bytes)" ], - "usage": "hf ntag424 changefilesettings [-h] -f -n -k [-o ] [-a ] [-s ] [-c ] [--sdmdata1 ] [--sdmdata2 ] [--sdmdata3 ] [--sdmdata4 ] [--sdmdata5 ] [--sdmdata6 ] [--sdmdata7 ] [--sdmdata8 ]" + "usage": "hf ntag424 changefs [-h] --fileno --keyno -k [-o ] [-a ] [-s ] [-c ] [--data1 ] [--data2 ] [--data3 ] [--data4 ] [--data5 ] [--data6 ] [--data7 ] [--data8 ]" }, "hf ntag424 changekey": { "command": "hf ntag424 changekey", "description": "Change a key. Authentication key must currently be different to the one we want to change.", "notes": [ - "hf ntag424 changekey -n 1 --oldkey 00000000000000000000000000000000 --newkey 11111111111111111111111111111111 --key0 00000000000000000000000000000000 -v 1", - "hf ntag424 changekey -n 0 --newkey 11111111111111111111111111111111 --key0 00000000000000000000000000000000 -v 1" + "hf ntag424 changekey --keyno 1 --oldkey 00000000000000000000000000000000 --newkey 11111111111111111111111111111111 --key0 00000000000000000000000000000000 --kv 1", + "hf ntag424 changekey --keyno 0 --newkey 11111111111111111111111111111111 --key0 00000000000000000000000000000000 --kv 1" ], "offline": false, "options": [ "-h, --help This help", - "-n, --keyno Key number to change", + "--keyno Key number to change", "--oldkey Old key (only needed when changing key 1-4, HEX 16 bytes)", "--newkey New key (HEX 16 bytes)", "--key0 Authentication key (must be key 0, HEX 16 bytes)", - "-v, --version Version of the new key" + "--kv New key version number" ], - "usage": "hf ntag424 changekey [-h] -n [--oldkey ] --newkey --key0 -v " + "usage": "hf ntag424 changekey [-h] --keyno [--oldkey ] --newkey --key0 --kv " }, - "hf ntag424 getfilesettings": { - "command": "hf ntag424 getfilesettings", + "hf ntag424 getfs": { + "command": "hf ntag424 getfs", "description": "Read and print file settings for file", "notes": [ - "hf ntag424 getfilesettings -f 2" + "hf ntag424 getfs --fileno 2" ], "offline": false, "options": [ "-h, --help This help", - "-f, --file File number" + "--fileno File number" ], - "usage": "hf ntag424 getfilesettings [-h] -f " + "usage": "hf ntag424 getfs [-h] --fileno " }, "hf ntag424 info": { "command": "hf ntag424 info", @@ -6878,19 +6878,21 @@ "command": "hf ntag424 read", "description": "Read and print data from file on NTAG424 tag. Will authenticate if key information is provided.", "notes": [ - "hf ntag424 read -f 2 -n 0 -k 00000000000000000000000000000000 -o 0 -l 256" + "hf ntag424 read --fileno 1 --keyno 0 -k 00000000000000000000000000000000 -o 0 -l 32", + "hf ntag424 read --fileno 2 --keyno 0 -k 00000000000000000000000000000000 -o 0 -l 256", + "hf ntag424 read --fileno 3 --keyno 3 -k 00000000000000000000000000000000 -o 0 -l 128 -m encrypt" ], "offline": false, "options": [ "-h, --help This help", - "-f, --fileno File number (1-3), (default 2)", - "-n, --keyno Key number", + "--fileno <1|2|3> File number", + "--keyno Key number", "-k, --key Key for authentication (HEX 16 bytes)", - "-o, --offset Offset to read in file (default 0)", + "-o, --offset Offset to read in file (def 0)", "-l, --length Number of bytes to read", - "-m, --cmode Communicaton mode" + "-m, --cmode Communication mode" ], - "usage": "hf ntag424 read [-h] -f [-n ] [-k ] [-o ] -l [-m ]" + "usage": "hf ntag424 read [-h] --fileno <1|2|3> [--keyno ] [-k ] [-o ] -l [-m ]" }, "hf ntag424 view": { "command": "hf ntag424 view", @@ -6910,19 +6912,20 @@ "command": "hf ntag424 write", "description": "Write data to file on NTAG424 tag. Will authenticate if key information is provided.", "notes": [ - "hf ntag424 write -f 2 -n 0 -k 00000000000000000000000000000000 -o 0 -d 1122334455667788" + "hf ntag424 write --fileno 2 --keyno 0 -k 00000000000000000000000000000000 -o 0 -d 1122334455667788", + "hf ntag424 write --fileno 3 --keyno 3 -k 00000000000000000000000000000000 -o 0 -d 1122334455667788 -m encrypt" ], "offline": false, "options": [ "-h, --help This help", - "-f, --fileno File number (1-3), (default 2)", - "-n, --keyno Key number", + "--fileno <1|2|3> File number (def 2)", + "--keyno Key number", "-k, --key Key for authentication (HEX 16 bytes)", - "-o, --offset Offset to write in file (default 0)", + "-o, --offset Offset to write in file (def 0)", "-d, --data Data to write", - "-m, --cmode Communicaton mode" + "-m, --cmode Communication mode" ], - "usage": "hf ntag424 write [-h] -f [-n ] [-k ] [-o ] -d [-m ]" + "usage": "hf ntag424 write [-h] --fileno <1|2|3> [--keyno ] [-k ] [-o ] -d [-m ]" }, "hf plot": { "command": "hf plot", @@ -12014,6 +12017,6 @@ "metadata": { "commands_extracted": 696, "extracted_by": "PM3Help2JSON v1.00", - "extracted_on": "2023-10-29T15:43:05" + "extracted_on": "2023-10-30T12:11:34" } } \ No newline at end of file diff --git a/doc/commands.md b/doc/commands.md index 43eeb3535..49d34875d 100644 --- a/doc/commands.md +++ b/doc/commands.md @@ -649,13 +649,13 @@ Check column "offline" for their availability. |command |offline |description |------- |------- |----------- |`hf ntag424 help `|Y |`This help` -|`hf ntag424 info `|N |`Tag information (not implemented yet)` +|`hf ntag424 info `|N |`Tag information` |`hf ntag424 view `|Y |`Display content from tag dump file` |`hf ntag424 auth `|N |`Test authentication with key` |`hf ntag424 read `|N |`Read file` |`hf ntag424 write `|N |`Write file` -|`hf ntag424 getfilesettings`|N |`Get file settings` -|`hf ntag424 changefilesettings`|N |`Change file settings` +|`hf ntag424 getfs `|N |`Get file settings` +|`hf ntag424 changefs `|N |`Change file settings` |`hf ntag424 changekey `|N |`Change key`