diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index 058722c36..559465956 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -2079,12 +2079,12 @@ static int CmdHF14ADesSelectApp(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes selectaid", "Select Application ID", - "Usage:\n\thf mfdes selectaid -a 123456\n" + "hf mfdes selectaid -a 123456" ); void *argtable[] = { arg_param_begin, - arg_strx0("aA", "aid", "", "App ID to select as hex bytes (3 bytes,big endian)"), + arg_strx0("a", "aid", "", "App ID to select as hex bytes (3 bytes,big endian)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -2114,16 +2114,16 @@ static int CmdHF14ADesCreateApp(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes createaid", "Create Application ID", - "Usage:\n\thf mfdes createaid -a 123456 -f 1111 -k 0E -l 2E -n Test\n" + "hf mfdes createaid -a 123456 -f 1111 -k 0E -l 2E -n Test" ); void *argtable[] = { arg_param_begin, - arg_strx0("aA", "aid", "", "App ID to create as hex bytes ("), - arg_strx0("fF", "fid", "", "File ID to create (optional)"), - arg_strx0("kK", "keysetting1", "", "Key Setting 1 (Application Master Key Settings)"), - arg_strx0("lL", "keysetting2", "", "Key Setting 2"), - arg_str0("nN", "name", "", "App ISO-4 Name (optional)"), + arg_strx0("a", "aid", "", "App ID to create as hex bytes (3 hex bytes)"), + arg_strx0("f", "fid", "", "File ID to create (optional)"), + arg_strx0("k", "ks1", "", "Key Setting 1 (Application Master Key Settings)"), + arg_strx0("l", "ks2", "", "Key Setting 2"), + arg_str0("n", "name", "", "App ISO-4 Name (optional)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -2242,13 +2242,13 @@ static int CmdHF14ADesDeleteApp(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes deleteaid", "Delete Application ID", - "Usage:\n\t-a aid (3 hex bytes, big endian)\n\n" - "Example:\n\thf mfdes deleteaid -a 123456\n" +// "Usage:\n\t-a aid (3 hex bytes, big endian)\n\n" + "hf mfdes deleteaid -a 123456" ); void *argtable[] = { arg_param_begin, - arg_strx0("aA", "aid", "", "App ID to delete"), + arg_strx0("a", "aid", "", "App ID (3 hex bytes, big endian) to delete"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -2305,17 +2305,15 @@ static int selectfile(uint8_t *aid, uint32_t fileno, uint8_t *cs) { static int CmdHF14ADesClearRecordFile(const char *Cmd) { CLIParserContext *ctx; - CLIParserInit(&ctx, "hf mfdes clearrecord", - "Clear record file", - "Usage:\n\t" - "hf mfdes clearrecord -n 01\n" - "Make sure to select aid or authenticate aid before running this command.\n" + CLIParserInit(&ctx, "hf mfdes clearfile", + "Clear record file\nMake sure to select aid or authenticate aid before running this command.", + "hf mfdes clearfile -n 01" ); void *argtable[] = { arg_param_begin, - arg_strx0("nN", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), - arg_strx0("aA", "aid", "", "App ID to select as hex bytes (3 bytes,big endian,optional)"), + arg_strx0("n", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), + arg_strx0("a", "aid", "", "App ID to select as hex bytes (3 bytes, big endian, optional)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -2369,15 +2367,13 @@ static int CmdHF14ADesDeleteFile(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes deletefile", "Delete File", - "Usage:\n\t" - "hf mfdes deletefile -n 01\n" - "Make sure to select aid or authenticate aid before running this command.\n" + "hf mfdes deletefile -n 01 -> Make sure to select aid or authenticate aid before running this command." ); void *argtable[] = { arg_param_begin, - arg_strx0("nN", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), - arg_strx0("aA", "aid", "", "App ID to select as hex bytes (3 bytes,big endian,optional)"), + arg_strx0("n", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), + arg_strx0("a", "aid", "", "App ID to select as hex bytes (3 bytes,big endian,optional)"), arg_param_end }; @@ -2431,19 +2427,19 @@ static int CmdHF14ADesCreateFile(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes createfile", "Create Standard/Backup File", - "Usage:" - "\n\thf mfdes createfile -f 0001 -n 01 -c 0 -r EEEE -s 000100 -a 123456\n" + "hf mfdes createfile -f 0001 -n 01 -c 0 -r EEEE -s 000100 -a 123456" ); void *argtable[] = { arg_param_begin, - arg_strx0("nN", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), - arg_strx0("fF", "fileid", "", "ISO FID (2 hex bytes, big endian)"), - arg_int0("cC", "com.set", "", "Communication setting (0=Plain,1=Plain+MAC,3=Enciphered)"), - arg_strx0("rR", "accessrights", "", "Access rights (2 hex bytes -> RW/Chg/R/W, 0-D Key, E Free, F Denied)"), - arg_strx0("sS", "filesize", "", "File size (3 hex bytes, big endian)"), - arg_lit0("bB", "backup", "Create backupfile instead of standard file"), - arg_strx0("aA", "aid", "", "App ID to select as hex bytes (3 bytes,big endian)"), + arg_strx0("n", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), + arg_strx0("f", "fileid", "", "ISO FID (2 hex bytes, big endian)"), + arg_int0("c", "com.set", "", "Communication setting (0=Plain,1=Plain+MAC,3=Enciphered)"), +// arg_strx0("r", "accessrights", "", "Access rights (2 hex bytes -> RW/Chg/R/W, 0-D Key, E Free, F Denied)"), + arg_strx0("r", "rights", "", "Access rights (2 hex bytes -> RW/Chg/R/W, 0-D Key, E Free, F Denied)"), + arg_strx0("s", "filesize", "", "File size (3 hex bytes, big endian)"), + arg_lit0("b", "backup", "Create backupfile instead of standard file"), + arg_strx0("a", "aid", "", "App ID to select as hex bytes (3 bytes,big endian)"), arg_param_end }; @@ -2548,16 +2544,15 @@ static int CmdHF14ADesCreateFile(const char *Cmd) { static int CmdHF14ADesGetValueData(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes getvalue", - "Get value from value file", - "Usage:" - "\n\thf mfdes getvalue -n 03\n" - "Make sure to select aid or authenticate aid before running this command.\n" + "Get value from value file\n" + "Make sure to select aid or authenticate aid before running this command.", + "hf mfdes getvalue -n 03" ); void *argtable[] = { arg_param_begin, - arg_strx0("nN", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), - arg_strx0("aA", "aid", "", "App ID to select as hex bytes (3 bytes,big endian)"), + arg_strx0("n", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), + arg_strx0("a", "aid", "", "App ID to select as hex bytes (3 bytes,big endian)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -2620,21 +2615,19 @@ static int CmdHF14ADesGetValueData(const char *Cmd) { static int CmdHF14ADesReadData(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes readdata", - "Read data from File", - "Usage:" - "\n\thf mfdes readdata -n 01 -t 0 -o 000000 -l 000000 -a 123456\n" - "\thf mfdes readdata -n 01 -t 0 (Read all data from standard file, fileno 01)\n" - "Make sure to select aid or authenticate aid before running this command.\n" + "Read data from File\n" + "Make sure to select aid or authenticate aid before running this command.", + "hf mfdes readdata -n 01 -t 0 -o 000000 -l 000000 -a 123456\n" + "hf mfdes readdata -n 01 -t 0 -> Read all data from standard file, fileno 01" ); void *argtable[] = { arg_param_begin, - arg_strx0("nN", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), - arg_strx0("oO", "offset", "", "File Offset (3 hex bytes, big endian), optional"), - arg_strx0("lL", "length", "", - "Length to read (3 hex bytes, big endian -> 000000 = Read all data),optional"), - arg_int0("tT", "type", "", "File Type (0=Standard/Backup, 1=Record)"), - arg_strx0("aA", "aid", "", "App ID to select as hex bytes (3 bytes,big endian,optional)"), + arg_strx0("n", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), + arg_strx0("o", "offset", "", "File Offset (3 hex bytes, big endian), optional"), + arg_strx0("l", "length", "", "Length to read (3 hex bytes, big endian -> 000000 = Read all data),optional"), + arg_int0("t", "type", "", "File Type (0=Standard/Backup, 1=Record)"), + arg_strx0("a", "aid", "", "App ID to select as hex bytes (3 bytes,big endian,optional)"), arg_param_end }; @@ -2743,18 +2736,17 @@ static int CmdHF14ADesReadData(const char *Cmd) { static int CmdHF14ADesChangeValue(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes changevalue", - "Change value (credit/limitedcredit/debit)", - "Usage:" - "\n\thf mfdes changevalue -n 03 -m 0 -d 00000001\n" - "Make sure to select aid or authenticate aid before running this command.\n" + "Change value (credit/limitedcredit/debit)\n" + "Make sure to select aid or authenticate aid before running this command.", + "hf mfdes changevalue -n 03 -m 0 -d 00000001" ); void *argtable[] = { arg_param_begin, - arg_strx0("nN", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), - arg_strx0("dD", "value", "", "Value to increase (4 hex bytes, big endian)"), - arg_int0("mM", "mode", "", "Mode (0=Credit, 1=LimitedCredit, 2=Debit)"), - arg_strx0("aA", "aid", "", "App ID to select as hex bytes (3 bytes,big endian)"), + arg_strx0("n", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), + arg_strx0("d", "value", "", "Value to increase (4 hex bytes, big endian)"), + arg_int0("m", "mode", "", "Mode (0=Credit, 1=LimitedCredit, 2=Debit)"), + arg_strx0("a", "aid", "", "App ID to select as hex bytes (3 bytes,big endian)"), arg_param_end }; @@ -2841,19 +2833,18 @@ static int CmdHF14ADesWriteData(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes writedata", - "Write data to File", - "Usage:" - "\n\thf mfdes writedata -n 01 -t 0 -o 000000 -d 3132333435363738\n" - "Make sure to select aid or authenticate aid before running this command.\n" + "Write data to File\n" + "Make sure to select aid or authenticate aid before running this command.", + "hf mfdes writedata -n 01 -t 0 -o 000000 -d 3132333435363738" ); void *argtable[] = { arg_param_begin, - arg_strx0("nN", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), - arg_strx0("oO", "offset", "", "File Offset (3 hex bytes, big endian), optional"), - arg_strx0("dD", "data", "", "Data to write (hex bytes, 256 bytes max)"), - arg_int0("type", "type", "", "File Type (0=Standard/Backup, 1=Record)"), - arg_strx0("aA", "aid", "", "App ID to select as hex bytes (3 bytes, big endian, optional)"), + arg_strx0("n", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), + arg_strx0("o", "offset", "", "File Offset (3 hex bytes, big endian), optional"), + arg_strx0("d", "data", "", "Data to write (hex bytes, 256 bytes max)"), + arg_int0("t", "type", "", "File Type (0=Standard/Backup, 1=Record)"), + arg_strx0("a", "aid", "", "App ID to select as hex bytes (3 bytes, big endian, optional)"), arg_param_end }; @@ -2947,22 +2938,23 @@ static int CmdHF14ADesWriteData(const char *Cmd) { static int CmdHF14ADesCreateRecordFile(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes createrecordfile", - "Create Linear/Cyclic Record File", - "Usage:" - "\n\thf mfdes createrecordfile -f 1122 -n 02 -c 0 -r EEEE -s 000010 -m 000005 -a 123456\n" - "Make sure to select aid or authenticate aid before running this command.\n" + "Create Linear/Cyclic Record File\n" + "Make sure to select aid or authenticate aid before running this command.", + "hf mfdes createrecordfile -f 1122 -n 02 -c 0 -r EEEE -s 000010 -m 000005 -a 123456" ); void *argtable[] = { arg_param_begin, - arg_strx0("nN", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), - arg_strx0("fF", "fileid", "", "ISO FID (2 hex bytes, big endian)"), - arg_int0("cC", "com.set", "", "Communication setting (0=Plain,1=Plain+MAC,3=Enciphered)"), - arg_strx0("rR", "accessrights", "", "Access rights (2 hex bytes -> RW/Chg/R/W, 0-D Key, E Free, F Denied)"), - arg_strx0("sS", "recordsize", "", "Record size (3 hex bytes, big endian, 000001 to FFFFFF)"), - arg_strx0("mM", "maxnumrecord", "", "Max. Number of Records (3 hex bytes, big endian)"), - arg_lit0("bB", "cyclic", "Create cyclic record file instead of linear record file"), - arg_strx0("aA", "aid", "", "App ID to select as hex bytes (3 bytes,big endian,optional)"), + arg_strx0("n", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), + arg_strx0("f", "fileid", "", "ISO FID (2 hex bytes, big endian)"), + arg_int0("c", "com.set", "", "Communication setting (0=Plain,1=Plain+MAC,3=Enciphered)"), +// arg_strx0("r", "accessrights", "", "Access rights (2 hex bytes -> RW/Chg/R/W, 0-D Key, E Free, F Denied)"), +// arg_strx0("s", "recordsize", "", "Record size (3 hex bytes, big endian, 000001 to FFFFFF)"), + arg_strx0("r", "rights", "", "Access rights (2 hex bytes -> RW/Chg/R/W, 0-D Key, E Free, F Denied)"), + arg_strx0("s", "size", "", "Record size (3 hex bytes, big endian, 000001 to FFFFFF)"), + arg_strx0("m", "maxrecord", "", "Max. Number of Records (3 hex bytes, big endian)"), + arg_lit0("b", "cyclic", "Create cyclic record file instead of linear record file"), + arg_strx0("a", "aid", "", "App ID to select as hex bytes (3 bytes,big endian,optional)"), arg_param_end }; @@ -3082,22 +3074,21 @@ static int CmdHF14ADesCreateRecordFile(const char *Cmd) { static int CmdHF14ADesCreateValueFile(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes createvaluefile", - "Create Value File", - "Usage:" - "\n\thf mfdes createvaluefile -n 03 -c 0 -r EEEE -l 00000000 -u 00002000 -v 00000001 -m 02 -a 123456\n" - "Make sure to select aid or authenticate aid before running this command.\n" + "Create Value File\n" + "Make sure to select aid or authenticate aid before running this command.", + "hf mfdes createvaluefile -n 03 -c 0 -r EEEE -l 00000000 -u 00002000 -v 00000001 -m 02 -a 123456\n" ); void *argtable[] = { arg_param_begin, - arg_strx0("nN", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), - arg_int0("cC", "com.set", "", "Communication setting (0=Plain,1=Plain+MAC,3=Enciphered)"), - arg_strx0("rR", "accessrights", "", "Access rights (2 hex bytes -> RW/Chg/R/W, 0-D Key, E Free, F Denied)"), - arg_strx0("lL", "lowerlimit", "", "Lower limit (4 hex bytes, big endian)"), - arg_strx0("uU", "upperlimit", "", "Upper limit (4 hex bytes, big endian)"), - arg_strx0("vV", "value", "", "Value (4 hex bytes, big endian)"), - arg_strx0("mM", "limitcredit", "", "Limited Credit enabled (1 hex byte [Bit 0=LimitedCredit, 1=FreeValue])"), - arg_strx0("aA", "aid", "", "App ID to select as hex bytes (3 bytes,big endian,optional)"), + arg_strx0("n", "fileno", "", "File Number (1 hex byte, 0x00 - 0x1F)"), + arg_int0("c", "com.set", "", "Communication setting (0=Plain,1=Plain+MAC,3=Enciphered)"), + arg_strx0("r", "rights", "", "Access rights (2 hex bytes -> RW/Chg/R/W, 0-D Key, E Free, F Denied)"), + arg_strx0("l", "lowerlimit", "", "Lower limit (4 hex bytes, big endian)"), + arg_strx0("u", "upperlimit", "", "Upper limit (4 hex bytes, big endian)"), + arg_strx0("v", "value", "", "Value (4 hex bytes, big endian)"), + arg_strx0("m", "limitcredit", "", "Limited Credit enabled (1 hex byte [Bit 0=LimitedCredit, 1=FreeValue])"), + arg_strx0("a", "aid", "", "App ID to select as hex bytes (3 bytes,big endian,optional)"), arg_param_end }; @@ -3215,11 +3206,15 @@ static int CmdHF14ADesCreateValueFile(const char *Cmd) { static int CmdHF14ADesFormatPICC(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes formatpicc", - "Formats MIFARE DESFire PICC to factory state", - "Usage:" - "\n\thf mfdes formatpicc\n" - "Make sure to authenticate picc before running this command.\n" + "Formats MIFARE DESFire PICC to factory state\n" + "Make sure to authenticate picc before running this command.", + "hf mfdes formatpicc" ); + void *argtable[] = { + arg_param_begin, + arg_param_end + }; + CLIExecWithReturn(ctx, Cmd, argtable, true); CLIParserFree(ctx); sAPDU apdu = {0x90, MFDES_FORMAT_PICC, 0x00, 0x00, 0, NULL}; // 0xDF uint16_t sw = 0; @@ -3761,20 +3756,19 @@ static int CmdHF14ADesChangeKey(const char *Cmd) { uint8_t newkeylength = 8; CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes changekey", - "Changes Mifare DESFire Key", - "Usage:" - "\n\thf mfdes changekey -n 0 -t 1 -k 0000000000000000 -u 1 -j 0102030405060708 (DES,keynumber 0)\n" - "Make sure to select aid or authenticate aid before running this command.\n" + "Changes Mifare DESFire Key\n" + "Make sure to select aid or authenticate aid before running this command.", + "hf mfdes changekey -n 0 -t 1 -k 0000000000000000 -u 1 -j 0102030405060708 -> DES,keynumber 0" ); void *argtable[] = { arg_param_begin, - arg_int0("nN", "keyno", "", "Key number used for authentification"), - arg_int0("tT", "algo", "", "Current key algo (1=DES, 2=3DES(2K2DES), 3=3K3DES, 4=AES)"), - arg_str0("kK", "key", "", "Current Key (HEX 8-24 bytes)"), - arg_int0("uU", "newalgo", "", "New key algo (1=DES, 2=3DES(2K2DES), 3=3K3DES, 4=AES)"), - arg_str0("jJ", "newkey", "", "New Key (HEX 8-24 bytes)"), - arg_int0("vV", "aesversion", "", "Aes version (if aes is used)"), + arg_int0("n", "keyno", "", "Key number used for authentification"), + arg_int0("t", "algo", "", "Current key algo (1=DES, 2=3DES(2K2DES), 3=3K3DES, 4=AES)"), + arg_str0("k", "key", "", "Current Key (HEX 8-24 bytes)"), + arg_int0("u", "newalgo", "", "New key algo (1=DES, 2=3DES(2K2DES), 3=3K3DES, 4=AES)"), + arg_str0("j", "newkey", "", "New Key (HEX 8-24 bytes)"), + arg_int0("v", "aesversion", "", "Aes version (if aes is used)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -3860,23 +3854,22 @@ static int CmdHF14ADesAuth(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes auth", "Authenticates Mifare DESFire using Key", - "Usage:" - "\n\thf mfdes auth -m 3 -t 4 -a 808301 -n 0 -k 00000000000000000000000000000000 (AES,keynumber 0, aid 0x803201)" - "\n\thf mfdes auth -m 2 -t 2 -a 000000 -n 1 -k 00000000000000000000000000000000 (3DES,keynumber 1, aid 0x000000)" - "\n\thf mfdes auth -m 1 -t 1 -a 000000 -n 2 -k 0000000000000000 (DES,keynumber 2, aid 0x000000)" - "\n\thf mfdes auth -m 1 -t 1 -a 000000 -n 0 (DES, defaultkey, aid 0x000000)" - "\n\thf mfdes auth -m 2 -t 2 -a 000000 -n 0 (3DES, defaultkey, aid 0x000000)" - "\n\thf mfdes auth -m 3 -t 4 -a 000000 -n 0 (3K3DES, defaultkey, aid 0x000000)" - "\n\thf mfdes auth -m 3 -t 4 -a 000000 -n 0 (AES, defaultkey, aid 0x000000)" + "hf mfdes auth -m 3 -t 4 -a 808301 -n 0 -k 00000000000000000000000000000000 -> AES,keynumber 0, aid 0x803201\n" + "hf mfdes auth -m 2 -t 2 -a 000000 -n 1 -k 00000000000000000000000000000000 -> 3DES,keynumber 1, aid 0x000000\n" + "hf mfdes auth -m 1 -t 1 -a 000000 -n 2 -k 0000000000000000 -> DES,keynumber 2, aid 0x000000\n" + "hf mfdes auth -m 1 -t 1 -a 000000 -n 0 -> DES, defaultkey, aid 0x000000\n" + "hf mfdes auth -m 2 -t 2 -a 000000 -n 0 -> 3DES, defaultkey, aid 0x000000\n" + "hf mfdes auth -m 3 -t 4 -a 000000 -n 0 -> 3K3DES, defaultkey, aid 0x000000\n" + "hf mfdes auth -m 3 -t 4 -a 000000 -n 0 -> AES, defaultkey, aid 0x000000" ); void *argtable[] = { arg_param_begin, - arg_int0("mM", "type", "", "Auth type (1=normal, 2=iso, 3=aes)"), - arg_int0("tT", "algo", "", "Crypt algo (1=DES, 2=3DES(2K2DES), 3=3K3DES, 4=AES)"), - arg_strx0("aA", "aid", "", "AID used for authentification (HEX 3 bytes)"), - arg_int0("nN", "keyno", "", "Key number used for authentification"), - arg_str0("kK", "key", "", "Key for checking (HEX 8-24 bytes)"), + arg_int0("m", "type", "", "Auth type (1=normal, 2=iso, 3=aes)"), + arg_int0("t", "algo", "", "Crypt algo (1=DES, 2=3DES(2K2DES), 3=3K3DES, 4=AES)"), + arg_strx0("a", "aid", "", "AID used for authentification (HEX 3 bytes)"), + arg_int0("n", "keyno", "", "Key number used for authentification"), + arg_str0("k", "key", "", "Key for checking (HEX 8-24 bytes)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -4222,23 +4215,22 @@ static int CmdHF14aDesChk(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes chk", "Checks keys with Mifare Desfire card.", - "Usage:\n" - " hf mfdes chk -a 123456 -k 000102030405060708090a0b0c0d0e0f -> check key on aid 0x123456\n" - " hf mfdes chk -d mfdes_default_keys -> check keys from dictionary against all existing aid on card\n" - " hf mfdes chk -d mfdes_default_keys -a 123456 -> check keys from dictionary against aid 0x123456\n" - " hf mfdes chk -a 123456 --pattern1b -j keys -> check all 1-byte keys pattern on aid 0x123456 and save found keys to json\n" - " hf mfdes chk -a 123456 --pattern2b --startp2b FA00 -> check all 2-byte keys pattern on aid 0x123456. Start from key FA00FA00...FA00\n"); + "hf mfdes chk -a 123456 -k 000102030405060708090a0b0c0d0e0f -> check key on aid 0x123456\n" + "hf mfdes chk -d mfdes_default_keys -> check keys from dictionary against all existing aid on card\n" + "hf mfdes chk -d mfdes_default_keys -a 123456 -> check keys from dictionary against aid 0x123456\n" + "hf mfdes chk -a 123456 --pattern1b -j keys -> check all 1-byte keys pattern on aid 0x123456 and save found keys to json\n" + "hf mfdes chk -a 123456 --pattern2b --startp2b FA00 -> check all 2-byte keys pattern on aid 0x123456. Start from key FA00FA00...FA00"); void *argtable[] = { arg_param_begin, - arg_strx0("aA", "aid", "", "Use specific AID (3 hex bytes, big endian)"), - arg_str0("kK", "key", "", "Key for checking (HEX 16 bytes)"), - arg_str0("dD", "dict", "", "File with keys dictionary"), + arg_strx0("a", "aid", "", "Use specific AID (3 hex bytes, big endian)"), + arg_str0("k", "key", "", "Key for checking (HEX 16 bytes)"), + arg_str0("d", "dict", "", "File with keys dictionary"), arg_lit0(NULL, "pattern1b", "Check all 1-byte combinations of key (0000...0000, 0101...0101, 0202...0202, ...)"), arg_lit0(NULL, "pattern2b", "Check all 2-byte combinations of key (0000...0000, 0001...0001, 0002...0002, ...)"), arg_str0(NULL, "startp2b", "", "Start key (2-byte HEX) for 2-byte search (use with `--pattern2b`)"), - arg_str0("jJ", "json", "", "Json file to save keys"), - arg_lit0("vV", "verbose", "Verbose mode."), + arg_str0("j", "json", "", "Json file to save keys"), + arg_lit0("v", "verbose", "Verbose mode."), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -4489,17 +4481,16 @@ static int CmdHF14aDesNDEF(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfdes ndef", "Prints NFC Data Exchange Format (NDEF)", - "Usage:\n" - _YELLOW_("\thf mfdes ndef") " -> shows NDEF data\n" - _YELLOW_("\thf mfdes ndef -vv") " -> shows NDEF parsed and raw data\n" - _YELLOW_("\thf mfdes ndef -a e103 -k d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7") " -> shows NDEF data with custom AID and key\n"); + "hf mfdes ndef -> shows NDEF data\n" + "hf mfdes ndef -v -> shows NDEF parsed and raw data\n" + "hf mfdes ndef -a e103 -k d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7 -> shows NDEF data with custom AID and key"); void *argtable[] = { arg_param_begin, - arg_litn("vV", "verbose", 0, 2, "show technical data"), + arg_litn("v", "verbose", 0, 2, "show technical data"), arg_str0("", "aid", "", "replace default aid for NDEF"), - arg_str0("kK", "key", "", "replace default key for NDEF"), - arg_lit0("bB", "keyb", "use key B for access sectors (by default: key A)"), + arg_str0("k", "key", "", "replace default key for NDEF"), + arg_lit0("b", "keyb", "use key B for access sectors (by default: key A)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); diff --git a/client/src/cmdhfmfp.c b/client/src/cmdhfmfp.c index f7d7d2142..f56ef1ac8 100644 --- a/client/src/cmdhfmfp.c +++ b/client/src/cmdhfmfp.c @@ -436,12 +436,12 @@ static int CmdHFMFPWritePerso(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp wrp", "Executes Write Perso command. Can be used in SL0 mode only.", - "Usage:\n\thf mfp wrp 4000 000102030405060708090a0b0c0d0e0f -> write key (00..0f) to key number 4000 \n" - "\thf mfp wrp 4000 -> write default key(0xff..0xff) to key number 4000"); + "hf mfp wrp 4000 000102030405060708090a0b0c0d0e0f -> write key (00..0f) to key number 4000 \n" + "hf mfp wrp 4000 -> write default key(0xff..0xff) to key number 4000"); void *argtable[] = { arg_param_begin, - arg_lit0("vV", "verbose", "show internal data."), + arg_lit0("v", "verbose", "show internal data."), arg_str1(NULL, NULL, "", NULL), arg_strx0(NULL, NULL, "", NULL), arg_param_end @@ -503,12 +503,12 @@ static int CmdHFMFPInitPerso(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp initp", "Executes Write Perso command for all card's keys. Can be used in SL0 mode only.", - "Usage:\n\thf mfp initp 000102030405060708090a0b0c0d0e0f -> fill all the keys with key (00..0f)\n" - "\thf mfp initp -vv -> fill all the keys with default key(0xff..0xff) and show all the data exchange"); + "hf mfp initp 000102030405060708090a0b0c0d0e0f -> fill all the keys with key (00..0f)\n" + "hf mfp initp -vv -> fill all the keys with default key(0xff..0xff) and show all the data exchange"); void *argtable[] = { arg_param_begin, - arg_litn("vV", "verbose", 0, 2, "show internal data."), + arg_litn("v", "verbose", 0, 2, "show internal data."), arg_strx0(NULL, NULL, "", NULL), arg_param_end }; @@ -571,11 +571,11 @@ static int CmdHFMFPCommitPerso(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp commitp", "Executes Commit Perso command. Can be used in SL0 mode only.", - "Usage:\n\thf mfp commitp -> \n"); + "hf mfp commitp"); void *argtable[] = { arg_param_begin, - arg_lit0("vV", "verbose", "show internal data."), + arg_lit0("v", "verbose", "show internal data."), arg_int0(NULL, NULL, "SL mode", NULL), arg_param_end }; @@ -618,12 +618,12 @@ static int CmdHFMFPAuth(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp auth", "Executes AES authentication command for Mifare Plus card", - "Usage:\n\thf mfp auth 4000 000102030405060708090a0b0c0d0e0f -> executes authentication\n" - "\thf mfp auth 9003 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -v -> executes authentication and shows all the system data\n"); + "hf mfp auth 4000 000102030405060708090a0b0c0d0e0f -> executes authentication\n" + "hf mfp auth 9003 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -v -> executes authentication and shows all the system data"); void *argtable[] = { arg_param_begin, - arg_lit0("vV", "verbose", "show internal data."), + arg_lit0("v", "verbose", "show internal data."), arg_str1(NULL, NULL, "", NULL), arg_str1(NULL, NULL, "", NULL), arg_param_end @@ -656,15 +656,15 @@ static int CmdHFMFPRdbl(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp rdbl", "Reads several blocks from Mifare Plus card.", - "Usage:\n\thf mfp rdbl 0 000102030405060708090a0b0c0d0e0f -> executes authentication and read block 0 data\n" - "\thf mfp rdbl 1 -v -> executes authentication and shows sector 1 data with default key 0xFF..0xFF and some additional data\n"); + "hf mfp rdbl 0 000102030405060708090a0b0c0d0e0f -> executes authentication and read block 0 data\n" + "hf mfp rdbl 1 -v -> executes authentication and shows sector 1 data with default key 0xFF..0xFF and some additional data"); void *argtable[] = { arg_param_begin, - arg_lit0("vV", "verbose", "show internal data."), - arg_int0("nN", "count", "blocks count (by default 1).", NULL), - arg_lit0("bB", "keyb", "use key B (by default keyA)."), - arg_lit0("pP", "plain", "plain communication mode between reader and card."), + arg_lit0("v", "verbose", "show internal data."), + arg_int0("n", "count", "blocks count (by default 1).", NULL), + arg_lit0("b", "keyb", "use key B (by default keyA)."), + arg_lit0("p", "plain", "plain communication mode between reader and card."), arg_int1(NULL, NULL, "", NULL), arg_str0(NULL, NULL, "", NULL), arg_param_end @@ -769,14 +769,14 @@ static int CmdHFMFPRdsc(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp rdsc", "Reads one sector from Mifare Plus card.", - "Usage:\n\thf mfp rdsc 0 000102030405060708090a0b0c0d0e0f -> executes authentication and read sector 0 data\n" - "\thf mfp rdsc 1 -v -> executes authentication and shows sector 1 data with default key 0xFF..0xFF and some additional data\n"); + "hf mfp rdsc 0 000102030405060708090a0b0c0d0e0f -> executes authentication and read sector 0 data\n" + "hf mfp rdsc 1 -v -> executes authentication and shows sector 1 data with default key 0xFF..0xFF and some additional data"); void *argtable[] = { arg_param_begin, - arg_lit0("vV", "verbose", "show internal data."), - arg_lit0("bB", "keyb", "use key B (by default keyA)."), - arg_lit0("pP", "plain", "plain communication mode between reader and card."), + arg_lit0("v", "verbose", "show internal data."), + arg_lit0("b", "keyb", "use key B (by default keyA)."), + arg_lit0("p", "plain", "plain communication mode between reader and card."), arg_int1(NULL, NULL, "", NULL), arg_str0(NULL, NULL, "", NULL), arg_param_end @@ -868,13 +868,13 @@ static int CmdHFMFPWrbl(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp wrbl", "Writes one block to Mifare Plus card.", - "Usage:\n\thf mfp wrbl 1 ff0000000000000000000000000000ff 000102030405060708090a0b0c0d0e0f -> writes block 1 data\n" - "\thf mfp wrbl 2 ff0000000000000000000000000000ff -v -> writes block 2 data with default key 0xFF..0xFF and some additional data\n"); + "hf mfp wrbl 1 ff0000000000000000000000000000ff 000102030405060708090a0b0c0d0e0f -> writes block 1 data\n" + "hf mfp wrbl 2 ff0000000000000000000000000000ff -v -> writes block 2 data with default key 0xFF..0xFF and some additional data"); void *argtable[] = { arg_param_begin, - arg_lit0("vV", "verbose", "show internal data."), - arg_lit0("bB", "keyb", "use key B (by default keyA)."), + arg_lit0("v", "verbose", "show internal data."), + arg_lit0("b", "keyb", "use key B (by default keyA)."), arg_int1(NULL, NULL, "", NULL), arg_str1(NULL, NULL, "", NULL), arg_str0(NULL, NULL, "", NULL), @@ -1070,26 +1070,25 @@ static int CmdHFMFPChk(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp chk", "Checks keys with Mifare Plus card.", - "Usage:\n" - " hf mfp chk -k 000102030405060708090a0b0c0d0e0f -> check key on sector 0 as key A and B\n" - " hf mfp chk -s 2 -a -> check default key list on sector 2, key A\n" - " hf mfp chk -d mfp_default_keys -s0 -e6 -> check keys from dictionary against sectors 0-6\n" - " hf mfp chk --pattern1b -j keys -> check all 1-byte keys pattern and save found keys to json\n" - " hf mfp chk --pattern2b --startp2b FA00 -> check all 2-byte keys pattern. Start from key FA00FA00...FA00\n"); + "hf mfp chk -k 000102030405060708090a0b0c0d0e0f -> check key on sector 0 as key A and B\n" + "hf mfp chk -s 2 -a -> check default key list on sector 2, key A\n" + "hf mfp chk -d mfp_default_keys -s0 -e6 -> check keys from dictionary against sectors 0-6\n" + "hf mfp chk --pattern1b -j keys -> check all 1-byte keys pattern and save found keys to json\n" + "hf mfp chk --pattern2b --startp2b FA00 -> check all 2-byte keys pattern. Start from key FA00FA00...FA00"); void *argtable[] = { arg_param_begin, - arg_lit0("aA", "keya", "check only key A (by default check all keys)."), - arg_lit0("bB", "keyb", "check only key B (by default check all keys)."), - arg_int0("sS", "startsec", "Start sector Num (0..255)", NULL), - arg_int0("eE", "endsec", "End sector Num (0..255)", NULL), - arg_str0("kK", "key", "", "Key for checking (HEX 16 bytes)"), - arg_str0("dD", "dict", "", "file with keys dictionary"), + arg_lit0("a", "keya", "check only key A (by default check all keys)."), + arg_lit0("b", "keyb", "check only key B (by default check all keys)."), + arg_int0("s", "startsec", "Start sector Num (0..255)", NULL), + arg_int0("e", "endsec", "End sector Num (0..255)", NULL), + arg_str0("k", "key", "", "Key for checking (HEX 16 bytes)"), + arg_str0("d", "dict", "", "file with keys dictionary"), arg_lit0(NULL, "pattern1b", "check all 1-byte combinations of key (0000...0000, 0101...0101, 0202...0202, ...)"), arg_lit0(NULL, "pattern2b", "check all 2-byte combinations of key (0000...0000, 0001...0001, 0002...0002, ...)"), arg_str0(NULL, "startp2b", "", "Start key (2-byte HEX) for 2-byte search (use with `--pattern2b`)"), - arg_str0("jJ", "json", "", "json file to save keys"), - arg_lit0("vV", "verbose", "verbose mode."), + arg_str0("j", "json", "", "json file to save keys"), + arg_lit0("v", "verbose", "verbose mode."), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -1303,17 +1302,17 @@ static int CmdHFMFPMAD(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp mad", "Checks and prints Mifare Application Directory (MAD)", - "Usage:\n\thf mfp mad -> shows MAD if exists\n" - "\thf mfp mad -a e103 -k d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7 -> shows NDEF data if exists\n"); + "hf mfp mad -> shows MAD if exists\n" + "hf mfp mad -a e103 -k d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7 -> shows NDEF data if exists"); void *argtable[] = { arg_param_begin, - arg_lit0("vV", "verbose", "show technical data"), - arg_str0("", "aid", "", "print all sectors with aid"), - arg_str0("kK", "key", "", "key for printing sectors"), - arg_lit0("bB", "keyb", "use key B for access printing sectors (by default: key A)"), - arg_lit0("", "be", "(optional, BigEndian)"), - arg_lit0("", "dch", "decode Card Holder information"), + arg_lit0("v", "verbose", "show technical data"), + arg_str0(NULL, "aid", "", "print all sectors with aid"), + arg_str0("k", "key", "", "key for printing sectors"), + arg_lit0("b", "keyb", "use key B for access printing sectors (by default: key A)"), + arg_lit0(NULL, "be", "(optional, BigEndian)"), + arg_lit0(NULL, "dch", "decode Card Holder information"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -1443,17 +1442,16 @@ static int CmdHFMFPNDEF(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp ndef", "Prints NFC Data Exchange Format (NDEF)", - "Usage:\n" - _YELLOW_("\thf mfp ndef") " -> shows NDEF data\n" - _YELLOW_("\thf mfp ndef -vv") " -> shows NDEF parsed and raw data\n" - _YELLOW_("\thf mfp ndef -a e103 -k d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7") " -> shows NDEF data with custom AID and key\n"); + "hf mfp ndef -> shows NDEF data\n" + "hf mfp ndef -vv -> shows NDEF parsed and raw data\n" + "hf mfp ndef -a e103 -k d3f7d3f7d3f7d3f7d3f7d3f7d3f7d3f7 -> shows NDEF data with custom AID and key"); void *argtable[] = { arg_param_begin, - arg_litn("vV", "verbose", 0, 2, "show technical data"), - arg_str0("", "aid", "", "replace default aid for NDEF"), - arg_str0("kK", "key", "", "replace default key for NDEF"), - arg_lit0("bB", "keyb", "use key B for access sectors (by default: key A)"), + arg_litn("v", "verbose", 0, 2, "show technical data"), + arg_str0(NULL, "aid", "", "replace default aid for NDEF"), + arg_str0("k", "key", "", "replace default key for NDEF"), + arg_lit0("b", "keyb", "use key B for access sectors (by default: key A)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index 28b560991..58099b8da 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -2954,13 +2954,13 @@ static int CmdHF14MfuNDEF(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfu ndef", "Prints NFC Data Exchange Format (NDEF)", - "Usage:\n\thf mfu ndef -> shows NDEF data\n" - "\thf mfu ndef -k ffffffff -> shows NDEF data with key\n"); + "hf mfu ndef -> shows NDEF data\n" + "hf mfu ndef -k ffffffff -> shows NDEF data with key"); void *argtable[] = { arg_param_begin, - arg_str0("kK", "key", "replace default key for NDEF", NULL), - arg_lit0("lL", "key", "(optional) swap entered key's endianness"), + arg_str0("k", "key", "replace default key for NDEF", NULL), + arg_lit0("l", "key", "(optional) swap entered key's endianness"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); diff --git a/client/src/cmdlfindala.c b/client/src/cmdlfindala.c index 7c29c1eba..829cee8d0 100644 --- a/client/src/cmdlfindala.c +++ b/client/src/cmdlfindala.c @@ -580,20 +580,19 @@ static int CmdIndalaClone(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "lf indala clone", "clone INDALA UID to T55x7 or Q5/T5555 tag", - "Examples:\n" - _YELLOW_("\tlf indala clone --heden 888\n") - _YELLOW_("\tlf indala clone --fc 123 --cn 1337\n") - _YELLOW_("\tlf indala clone -r a0000000a0002021\n") - _YELLOW_("\tlf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5")); + "lf indala clone --heden 888\n" + "lf indala clone --fc 123 --cn 1337\n" + "lf indala clone -r a0000000a0002021\n" + "lf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5"); void *argtable[] = { arg_param_begin, - arg_lit0("lL", "long", "optional - long UID 224 bits"), - arg_int0("cC", "heden", "", "Cardnumber for Heden 2L format"), - arg_strx0("rR", "raw", "", "raw bytes"), - arg_lit0("qQ", "Q5", "optional - specify writing to Q5/T5555 tag"), - arg_int0("", "fc", "", "Facility Code (26 bit format)"), - arg_int0("", "cn", "", "Cardnumber (26 bit format)"), + arg_lit0("l", "long", "optional - long UID 224 bits"), + arg_int0("c", "heden", "", "Cardnumber for Heden 2L format"), + arg_strx0("r", "raw", "", "raw bytes"), + arg_lit0("q", "Q5", "optional - specify writing to Q5/T5555 tag"), + arg_int0(NULL, "fc", "", "Facility Code (26 bit format)"), + arg_int0(NULL, "cn", "", "Cardnumber (26 bit format)"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); diff --git a/client/src/cmdlfmotorola.c b/client/src/cmdlfmotorola.c index 7deec0590..a717e6e89 100644 --- a/client/src/cmdlfmotorola.c +++ b/client/src/cmdlfmotorola.c @@ -155,12 +155,10 @@ static int CmdMotorolaClone(const char *Cmd) { int datalen = 0; CLIParserContext *ctx; - CLIParserInit(&ctx, "lf indala clone", + CLIParserInit(&ctx, "lf motorola clone", "Enables cloning of Motorola card with specified uid onto T55x7\n" - "defaults to 64.\n", - "\n" - "Samples:\n" - _YELLOW_("\tlf motorola clone a0000000a0002021") "\n" + "defaults to 64.", + "lf motorola clone a0000000a0002021" ); void *argtable[] = {