Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
iceman1001 committed Oct 30, 2023
1 parent 2763ead commit b9dcd14
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 53 deletions.
12 changes: 6 additions & 6 deletions client/src/cmdhfntag424.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions client/src/cmdlfem4x05.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions client/src/pm3line_vocabulary.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand Down
83 changes: 43 additions & 40 deletions doc/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <dec> Key number",
"--keyno <dec> Key number",
"-k, --key <hex> Key for authenticate (HEX 16 bytes)"
],
"usage": "hf ntag424 auth [-h] -n <dec> -k <hex>"
"usage": "hf ntag424 auth [-h] --keyno <dec> -k <hex>"
},
"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 <dec> File number",
"-n, --keyno <dec> Key number",
"--fileno <dec> File number",
"--keyno <dec> Key number",
"-k, --key <hex> Key for authentication (HEX 16 bytes)",
"-o, --options <hex> File options byte (HEX 1 byte)",
"-a, --access <hex> File access settings (HEX 2 bytes)",
"-s, --sdmoptions <hex> SDM options (HEX 1 byte)",
"-c, --sdmaccess <hex> SDM access settings (HEX 2 bytes)",
"--sdmdata1 <hex> SDM data (HEX 3 bytes)",
"--sdmdata2 <hex> SDM data (HEX 3 bytes)",
"--sdmdata3 <hex> SDM data (HEX 3 bytes)",
"--sdmdata4 <hex> SDM data (HEX 3 bytes)",
"--sdmdata5 <hex> SDM data (HEX 3 bytes)",
"--sdmdata6 <hex> SDM data (HEX 3 bytes)",
"--sdmdata7 <hex> SDM data (HEX 3 bytes)",
"--sdmdata8 <hex> SDM data (HEX 3 bytes)"
"--data1 <hex> SDM data (HEX 3 bytes)",
"--data2 <hex> SDM data (HEX 3 bytes)",
"--data3 <hex> SDM data (HEX 3 bytes)",
"--data4 <hex> SDM data (HEX 3 bytes)",
"--data5 <hex> SDM data (HEX 3 bytes)",
"--data6 <hex> SDM data (HEX 3 bytes)",
"--data7 <hex> SDM data (HEX 3 bytes)",
"--data8 <hex> SDM data (HEX 3 bytes)"
],
"usage": "hf ntag424 changefilesettings [-h] -f <dec> -n <dec> -k <hex> [-o <hex>] [-a <hex>] [-s <hex>] [-c <hex>] [--sdmdata1 <hex>] [--sdmdata2 <hex>] [--sdmdata3 <hex>] [--sdmdata4 <hex>] [--sdmdata5 <hex>] [--sdmdata6 <hex>] [--sdmdata7 <hex>] [--sdmdata8 <hex>]"
"usage": "hf ntag424 changefs [-h] --fileno <dec> --keyno <dec> -k <hex> [-o <hex>] [-a <hex>] [-s <hex>] [-c <hex>] [--data1 <hex>] [--data2 <hex>] [--data3 <hex>] [--data4 <hex>] [--data5 <hex>] [--data6 <hex>] [--data7 <hex>] [--data8 <hex>]"
},
"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 <dec> Key number to change",
"--keyno <dec> Key number to change",
"--oldkey <hex> Old key (only needed when changing key 1-4, HEX 16 bytes)",
"--newkey <hex> New key (HEX 16 bytes)",
"--key0 <hex> Authentication key (must be key 0, HEX 16 bytes)",
"-v, --version <dec> Version of the new key"
"--kv <dec> New key version number"
],
"usage": "hf ntag424 changekey [-h] -n <dec> [--oldkey <hex>] --newkey <hex> --key0 <hex> -v <dec>"
"usage": "hf ntag424 changekey [-h] --keyno <dec> [--oldkey <hex>] --newkey <hex> --key0 <hex> --kv <dec>"
},
"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 <dec> File number"
"--fileno <dec> File number"
],
"usage": "hf ntag424 getfilesettings [-h] -f <dec>"
"usage": "hf ntag424 getfs [-h] --fileno <dec>"
},
"hf ntag424 info": {
"command": "hf ntag424 info",
Expand All @@ -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 <dec> File number (1-3), (default 2)",
"-n, --keyno <dec> Key number",
"--fileno <1|2|3> File number",
"--keyno <dec> Key number",
"-k, --key <hex> Key for authentication (HEX 16 bytes)",
"-o, --offset <dec> Offset to read in file (default 0)",
"-o, --offset <dec> Offset to read in file (def 0)",
"-l, --length <dec> Number of bytes to read",
"-m, --cmode <plain|mac|encrypt> Communicaton mode"
"-m, --cmode <plain|mac|encrypt> Communication mode"
],
"usage": "hf ntag424 read [-h] -f <dec> [-n <dec>] [-k <hex>] [-o <dec>] -l <dec> [-m <plain|mac|encrypt>]"
"usage": "hf ntag424 read [-h] --fileno <1|2|3> [--keyno <dec>] [-k <hex>] [-o <dec>] -l <dec> [-m <plain|mac|encrypt>]"
},
"hf ntag424 view": {
"command": "hf ntag424 view",
Expand All @@ -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 <dec> File number (1-3), (default 2)",
"-n, --keyno <dec> Key number",
"--fileno <1|2|3> File number (def 2)",
"--keyno <dec> Key number",
"-k, --key <hex> Key for authentication (HEX 16 bytes)",
"-o, --offset <dec> Offset to write in file (default 0)",
"-o, --offset <dec> Offset to write in file (def 0)",
"-d, --data <hex> Data to write",
"-m, --cmode <plain|mac|encrypt> Communicaton mode"
"-m, --cmode <plain|mac|encrypt> Communication mode"
],
"usage": "hf ntag424 write [-h] -f <dec> [-n <dec>] [-k <hex>] [-o <dec>] -d <hex> [-m <plain|mac|encrypt>]"
"usage": "hf ntag424 write [-h] --fileno <1|2|3> [--keyno <dec>] [-k <hex>] [-o <dec>] -d <hex> [-m <plain|mac|encrypt>]"
},
"hf plot": {
"command": "hf plot",
Expand Down Expand Up @@ -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"
}
}
6 changes: 3 additions & 3 deletions doc/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`


Expand Down

0 comments on commit b9dcd14

Please sign in to comment.