mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
style
This commit is contained in:
parent
f09eaa8c3a
commit
18bcbf1894
2 changed files with 41 additions and 27 deletions
|
@ -6295,7 +6295,7 @@ static int CmdHF14AGen4View(const char *Cmd) {
|
||||||
static int CmdHF14AMfValue(const char *Cmd) {
|
static int CmdHF14AMfValue(const char *Cmd) {
|
||||||
|
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf mf value1",
|
CLIParserInit(&ctx, "hf mf value",
|
||||||
"MIFARE Classic value data commands\n",
|
"MIFARE Classic value data commands\n",
|
||||||
"hf mf value --blk 16 -k FFFFFFFFFFFF --set 1000\n"
|
"hf mf value --blk 16 -k FFFFFFFFFFFF --set 1000\n"
|
||||||
"hf mf value --blk 16 -k FFFFFFFFFFFF --inc 10\n"
|
"hf mf value --blk 16 -k FFFFFFFFFFFF --inc 10\n"
|
||||||
|
@ -6333,18 +6333,18 @@ static int CmdHF14AMfValue(const char *Cmd) {
|
||||||
uint8_t key[6] = {0};
|
uint8_t key[6] = {0};
|
||||||
CLIGetHexWithReturn(ctx, 1, key, &keylen);
|
CLIGetHexWithReturn(ctx, 1, key, &keylen);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Value /Value Value BLK /BLK BLK /BLK
|
Value /Value Value BLK /BLK BLK /BLK
|
||||||
00000000 FFFFFFFF 00000000 10 EF 10 EF
|
00000000 FFFFFFFF 00000000 10 EF 10 EF
|
||||||
BLK is used to referece where the backup come from, I suspect its just the current block for the actual value ?
|
BLK is used to referece where the backup come from, I suspect its just the current block for the actual value ?
|
||||||
increment and decrement are an unsigned value
|
increment and decrement are an unsigned value
|
||||||
set value is a signed value
|
set value is a signed value
|
||||||
|
|
||||||
We are getting signed and/or bigger values to allow a defult to be set meaning users did not supply that option.
|
We are getting signed and/or bigger values to allow a defult to be set meaning users did not supply that option.
|
||||||
*/
|
*/
|
||||||
int64_t incval = (int64_t)arg_get_u64_def(ctx, 4, -1); // Inc by -1 is invalid, so not set.
|
int64_t incval = (int64_t)arg_get_u64_def(ctx, 4, -1); // Inc by -1 is invalid, so not set.
|
||||||
int64_t decval = (int64_t)arg_get_u64_def(ctx, 5, -1); // Inc by -1 is invalid, so not set.
|
int64_t decval = (int64_t)arg_get_u64_def(ctx, 5, -1); // Inc by -1 is invalid, so not set.
|
||||||
int64_t setval = (int64_t)arg_get_u64_def(ctx, 6, 0x7FFFFFFFFFFFFFFF ); // out of bounds (for int32) so not set
|
int64_t setval = (int64_t)arg_get_u64_def(ctx, 6, 0x7FFFFFFFFFFFFFFF); // out of bounds (for int32) so not set
|
||||||
bool getval = arg_get_lit(ctx, 7);
|
bool getval = arg_get_lit(ctx, 7);
|
||||||
uint8_t block[MFBLOCK_SIZE] = {0x00};
|
uint8_t block[MFBLOCK_SIZE] = {0x00};
|
||||||
int dlen = 0;
|
int dlen = 0;
|
||||||
|
@ -6362,7 +6362,7 @@ static int CmdHF14AMfValue(const char *Cmd) {
|
||||||
if (incval != -1) {
|
if (incval != -1) {
|
||||||
optionsprovided++;
|
optionsprovided++;
|
||||||
action = 0;
|
action = 0;
|
||||||
if ((incval <=0) || (incval > 2147483647)) {
|
if ((incval <= 0) || (incval > 2147483647)) {
|
||||||
PrintAndLogEx(WARNING, "increment value must be between 1 and 2147483647. Got %lli", incval);
|
PrintAndLogEx(WARNING, "increment value must be between 1 and 2147483647. Got %lli", incval);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
} else
|
} else
|
||||||
|
@ -6393,25 +6393,25 @@ static int CmdHF14AMfValue(const char *Cmd) {
|
||||||
optionsprovided++;
|
optionsprovided++;
|
||||||
action = 4;
|
action = 4;
|
||||||
if (dlen != 16) {
|
if (dlen != 16) {
|
||||||
PrintAndLogEx(WARNING,"date length must be 16 hex bytes long, got %d",dlen);
|
PrintAndLogEx(WARNING, "date length must be 16 hex bytes long, got %d", dlen);
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optionsprovided > 1) { // more then one option provided
|
if (optionsprovided > 1) { // more then one option provided
|
||||||
PrintAndLogEx(WARNING,"must have one and only one of --inc, --dec, --set or --data");
|
PrintAndLogEx(WARNING, "must have one and only one of --inc, --dec, --set or --data");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
// dont want to write value data and break something
|
// dont want to write value data and break something
|
||||||
if ((blockno == 0) || (mfIsSectorTrailer (blockno))) {
|
if ((blockno == 0) || (mfIsSectorTrailer(blockno))) {
|
||||||
PrintAndLogEx(WARNING, "invlaid block number, should be a data block ");
|
PrintAndLogEx(WARNING, "invlaid block number, should be a data block ");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action < 3) {
|
if (action < 3) {
|
||||||
if (action <= 1) { // increment/decrement value
|
if (action <= 1) { // increment/decrement value
|
||||||
memcpy (block, (uint8_t *)&value, 4);
|
memcpy(block, (uint8_t *)&value, 4);
|
||||||
uint8_t cmddata[26];
|
uint8_t cmddata[26];
|
||||||
memcpy(cmddata, key, sizeof(key)); // Key == 6 data went to 10, so lets offset 9 for inc/dec
|
memcpy(cmddata, key, sizeof(key)); // Key == 6 data went to 10, so lets offset 9 for inc/dec
|
||||||
if (action == 0)
|
if (action == 0)
|
||||||
|
@ -6487,7 +6487,7 @@ static int CmdHF14AMfValue(const char *Cmd) {
|
||||||
PrintAndLogEx(FAILED, "No value block detected");
|
PrintAndLogEx(FAILED, "No value block detected");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintAndLogEx(FAILED, "failed to read value block");
|
PrintAndLogEx(FAILED, "failed to read value block");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4128,7 +4128,7 @@
|
||||||
},
|
},
|
||||||
"hf mf help": {
|
"hf mf help": {
|
||||||
"command": "hf mf help",
|
"command": "hf mf help",
|
||||||
"description": "help This help list List MIFARE history hardnested Nested attack for hardened MIFARE Classic cards decrypt [nt] [ar_enc] [at_enc] [data] - to decrypt sniff or trace acl Decode and print MIFARE Classic access rights bytes value Decode a value block view Display content from tag dump file",
|
"description": "help This help list List MIFARE history hardnested Nested attack for hardened MIFARE Classic cards decrypt [nt] [ar_enc] [at_enc] [data] - to decrypt sniff or trace acl Decode and print MIFARE Classic access rights bytes value Value blocks view Display content from tag dump file",
|
||||||
"notes": [],
|
"notes": [],
|
||||||
"offline": true,
|
"offline": true,
|
||||||
"options": [],
|
"options": [],
|
||||||
|
@ -4171,9 +4171,10 @@
|
||||||
"-k, --key <key> key for printing sectors",
|
"-k, --key <key> key for printing sectors",
|
||||||
"-b, --keyb use key B for access printing sectors (by default: key A)",
|
"-b, --keyb use key B for access printing sectors (by default: key A)",
|
||||||
"--be (optional, BigEndian)",
|
"--be (optional, BigEndian)",
|
||||||
"--dch decode Card Holder information"
|
"--dch decode Card Holder information",
|
||||||
|
"-f, --file <fn> load dump file and decode MAD"
|
||||||
],
|
],
|
||||||
"usage": "hf mf mad [-hvb] [--aid <aid>] [-k <key>] [--be] [--dch]"
|
"usage": "hf mf mad [-hvb] [--aid <aid>] [-k <key>] [--be] [--dch] [-f <fn>]"
|
||||||
},
|
},
|
||||||
"hf mf nack": {
|
"hf mf nack": {
|
||||||
"command": "hf mf nack",
|
"command": "hf mf nack",
|
||||||
|
@ -4390,16 +4391,28 @@
|
||||||
},
|
},
|
||||||
"hf mf value": {
|
"hf mf value": {
|
||||||
"command": "hf mf value",
|
"command": "hf mf value",
|
||||||
"description": "Decode of a MIFARE value block",
|
"description": "MIFARE Classic value data commands",
|
||||||
"notes": [
|
"notes": [
|
||||||
|
"hf mf value --blk 16 -k FFFFFFFFFFFF --set 1000",
|
||||||
|
"hf mf value --blk 16 -k FFFFFFFFFFFF --inc 10",
|
||||||
|
"hf mf value --blk 16 -k FFFFFFFFFFFF --dec 10 -b",
|
||||||
|
"hf mf value --blk 16 -k FFFFFFFFFFFF --get -b",
|
||||||
"hf mf value -d 87D612007829EDFF87D6120011EE11EE"
|
"hf mf value -d 87D612007829EDFF87D6120011EE11EE"
|
||||||
],
|
],
|
||||||
"offline": true,
|
"offline": true,
|
||||||
"options": [
|
"options": [
|
||||||
"-h, --help This help",
|
"-h, --help This help",
|
||||||
"-d, --data <hex> 16 hex bytes"
|
"-k, --key <hex> key, 6 hex bytes",
|
||||||
|
"-a input key type is key A (def)",
|
||||||
|
"-b input key type is key B",
|
||||||
|
"--inc <dec> Incremenet value by X (0 - 2147483647)",
|
||||||
|
"--dec <dec> Dcrement value by X (0 - 2147483647)",
|
||||||
|
"--set <dec> Set value to X (-2147483647 - 2147483647)",
|
||||||
|
"--get Get value from block",
|
||||||
|
"--blk <dec> block number",
|
||||||
|
"-d, --data <hex> block data to extract values from (16 hex bytes)"
|
||||||
],
|
],
|
||||||
"usage": "hf mf value [-h] -d <hex>"
|
"usage": "hf mf value [-hab] [-k <hex>] [--inc <dec>] [--dec <dec>] [--set <dec>] [--get] [--blk <dec>] [-d <hex>]"
|
||||||
},
|
},
|
||||||
"hf mf view": {
|
"hf mf view": {
|
||||||
"command": "hf mf view",
|
"command": "hf mf view",
|
||||||
|
@ -4700,13 +4713,14 @@
|
||||||
"--aid <hex> Application ID for create. Mandatory. (3 hex bytes, big endian)",
|
"--aid <hex> Application ID for create. Mandatory. (3 hex bytes, big endian)",
|
||||||
"--fid <hex> ISO file ID. Forbidden values: 0000 3F00, 3FFF, FFFF. (2 hex bytes, big endian)",
|
"--fid <hex> ISO file ID. Forbidden values: 0000 3F00, 3FFF, FFFF. (2 hex bytes, big endian)",
|
||||||
"--dfname <string> ISO DF Name (1..16 chars)",
|
"--dfname <string> ISO DF Name (1..16 chars)",
|
||||||
|
"--dfhex <hex> ISO DF Name as hex (1..16 bytes)",
|
||||||
"--ks1 <hex> Key settings 1 (1 hex byte). Application Master Key Settings (def: 0x0F)",
|
"--ks1 <hex> Key settings 1 (1 hex byte). Application Master Key Settings (def: 0x0F)",
|
||||||
"--ks2 <hex> Key settings 2 (1 hex byte). (def: 0x0E)",
|
"--ks2 <hex> Key settings 2 (1 hex byte). (def: 0x0E)",
|
||||||
"--dstalgo <DES|2TDEA|3TDEA|AES> Application key crypt algo (def: DES)",
|
"--dstalgo <DES|2TDEA|3TDEA|AES> Application key crypt algo (def: DES)",
|
||||||
"--numkeys <dec> Number of keys 0x00..0x0e (def: 0x0E)",
|
"--numkeys <dec> Number of keys 0x00..0x0e (def: 0x0E)",
|
||||||
"--no-auth Execute without authentication"
|
"--no-auth Execute without authentication"
|
||||||
],
|
],
|
||||||
"usage": "hf mfdes createapp [-hav] [-n <dec>] [-t <DES|2TDEA|3TDEA|AES>] [-k <hex>] [--kdf <none|AN10922|gallagher>] [-i <hex>] [-m <plain|mac|encrypt>] [-c <native|niso|iso>] [--schann <d40|ev1|ev2|lrp>] [--rawdata <hex>] [--aid <hex>] [--fid <hex>] [--dfname <string>] [--ks1 <hex>] [--ks2 <hex>] [--dstalgo <DES|2TDEA|3TDEA|AES>] [--numkeys <dec>] [--no-auth]"
|
"usage": "hf mfdes createapp [-hav] [-n <dec>] [-t <DES|2TDEA|3TDEA|AES>] [-k <hex>] [--kdf <none|AN10922|gallagher>] [-i <hex>] [-m <plain|mac|encrypt>] [-c <native|niso|iso>] [--schann <d40|ev1|ev2|lrp>] [--rawdata <hex>] [--aid <hex>] [--fid <hex>] [--dfname <string>] [--dfhex <hex>] [--ks1 <hex>] [--ks2 <hex>] [--dstalgo <DES|2TDEA|3TDEA|AES>] [--numkeys <dec>] [--no-auth]"
|
||||||
},
|
},
|
||||||
"hf mfdes createfile": {
|
"hf mfdes createfile": {
|
||||||
"command": "hf mfdes createfile",
|
"command": "hf mfdes createfile",
|
||||||
|
@ -10983,8 +10997,8 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"commands_extracted": 693,
|
"commands_extracted": 696,
|
||||||
"extracted_by": "PM3Help2JSON v1.00",
|
"extracted_by": "PM3Help2JSON v1.00",
|
||||||
"extracted_on": "2022-04-29T14:32:43"
|
"extracted_on": "2022-06-06T05:54:04"
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue