From 89db5d38752459fd360ea10873cb7244fa1e8389 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 2 Oct 2023 20:59:01 +0200 Subject: [PATCH] text --- client/src/cmdhf14b.c | 2 +- client/src/cmdhf15.c | 20 +++++++------- client/src/cmdhfcryptorf.c | 8 +++--- client/src/cmdhffudan.c | 6 ++--- client/src/cmdhficlass.c | 20 +++++++------- client/src/cmdhflegic.c | 4 +-- client/src/cmdhfmf.c | 26 +++++++++--------- client/src/cmdhfmfp.c | 6 ++--- client/src/cmdhfmfu.c | 10 +++---- client/src/cmdhfntag424.c | 2 +- client/src/cmdhftopaz.c | 6 ++--- client/src/cmdlfem4x50.c | 4 +-- client/src/cmdlft55xx.c | 2 +- client/src/fileutils.c | 54 +++----------------------------------- client/src/fileutils.h | 13 --------- doc/cheatsheet.md | 10 +++---- 16 files changed, 66 insertions(+), 127 deletions(-) diff --git a/client/src/cmdhf14b.c b/client/src/cmdhf14b.c index 59a452fb6..9ceb7f3ee 100644 --- a/client/src/cmdhf14b.c +++ b/client/src/cmdhf14b.c @@ -2168,7 +2168,7 @@ static int CmdHF14BView(const char *Cmd) { ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_lit0("v", "verbose", "verbose output"), arg_param_end }; diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index eea85272a..a4f6e5922 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -1143,13 +1143,13 @@ static int CmdHF15ELoad(const char *Cmd) { static int CmdHF15ESave(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf 15 esave", - "Save emulator memory into two files (BIN/JSON) ", + "Save emulator memory into two files (bin/json) ", "hf 15 esave -f hf-15-01020304" "hf 15 esave -b 8 -c 42 -f hf-15-01020304" ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_int0(NULL, "bsize", "", "block size, defaults to 4"), arg_int0("c", "count", "", "number of blocks to export, defaults to all"), arg_param_end @@ -1542,7 +1542,7 @@ static int CmdHF15WriteDsfid(const char *Cmd) { static int CmdHF15Dump(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf 15 dump", - "This command dumps the contents of a ISO-15693 tag and save it to file", + "This command dumps the contents of a ISO-15693 tag and save to file (bin/json)", "hf 15 dump\n" "hf 15 dump -*\n" "hf 15 dump -u E011223344556677 -f hf-15-my-dump.bin" @@ -1550,7 +1550,7 @@ static int CmdHF15Dump(const char *Cmd) { void *argtable[6 + 2] = {}; uint8_t arglen = arg_add_default(argtable); - argtable[arglen++] = arg_str0("f", "file", "", "filename of dump"), + argtable[arglen++] = arg_str0("f", "file", "", "Specify a filename for dump file"), argtable[arglen++] = arg_param_end; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -2175,7 +2175,7 @@ static int CmdHF15Write(const char *Cmd) { static int CmdHF15Restore(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf 15 restore", - "This command restore the contents of a dump file onto a ISO-15693 tag", + "This command restore the contents of a dump file (bin/eml/json) onto a ISO-15693 tag", "hf 15 restore\n" "hf 15 restore -*\n" "hf 15 restore -u E011223344556677 -f hf-15-my-dump.bin" @@ -2183,10 +2183,10 @@ static int CmdHF15Restore(const char *Cmd) { void *argtable[6 + 5] = {}; uint8_t arglen = arg_add_default(argtable); - argtable[arglen++] = arg_str0("f", "file", "", "filename of dump"), - argtable[arglen++] = arg_int0("r", "retry", "", "number of retries (def 3)"), - argtable[arglen++] = arg_int0(NULL, "bs", "", "block size (def 4)"), - argtable[arglen++] = arg_lit0("v", "verbose", "verbose output"); + argtable[arglen++] = arg_str0("f", "file", "", "Specify a filename for dump file"), + argtable[arglen++] = arg_int0("r", "retry", "", "number of retries (def 3)"), + argtable[arglen++] = arg_int0(NULL, "bs", "", "block size (def 4)"), + argtable[arglen++] = arg_lit0("v", "verbose", "verbose output"); argtable[arglen++] = arg_param_end; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -2856,7 +2856,7 @@ static int CmdHF15View(const char *Cmd) { ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), // arg_lit0("z", "dense", "dense dump output style"), arg_param_end }; diff --git a/client/src/cmdhfcryptorf.c b/client/src/cmdhfcryptorf.c index 12e522f2a..ef0979182 100644 --- a/client/src/cmdhfcryptorf.c +++ b/client/src/cmdhfcryptorf.c @@ -423,13 +423,13 @@ static int CmdHFCryptoRFELoad(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf cryptorf eload", - "Loads CryptoRF tag dump into emulator memory on device", + "Loads CryptoRF tag dump (bin/eml/json) into emulator memory on device", "hf cryptorf eload -f hf-cryptorf-0102030405-dump.bin\n" ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); @@ -485,14 +485,14 @@ static int CmdHFCryptoRFESave(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf cryptorf esave", - "Save emulator memory to to two files (bin/json)\n" + "Save emulator memory to file (bin/json)\n" "if filename is not supplied, UID will be used.", "hf cryptorf esave\n" "hf cryptorf esave -f filename" ); void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); diff --git a/client/src/cmdhffudan.c b/client/src/cmdhffudan.c index 7403afeb6..85e857e6e 100644 --- a/client/src/cmdhffudan.c +++ b/client/src/cmdhffudan.c @@ -235,14 +235,14 @@ static int CmdHFFudanReader(const char *Cmd) { static int CmdHFFudanDump(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf fudan dump", - "Dump FUDAN tag to binary file\n" + "Dump FUDAN tag to file (bin/json)\n" "If no given, UID will be used as filename", "hf fudan dump -f mydump --> dump using filename\n" ); void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, true); @@ -453,7 +453,7 @@ static int CmdHFFudanView(const char *Cmd) { ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index 08ed01068..8fa9910f7 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -1009,14 +1009,14 @@ static int CmdHFiClassReader(const char *Cmd) { static int CmdHFiClassELoad(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf iclass eload", - "Load emulator memory with data from (bin/eml/json) iCLASS dump file", - "hf iclass eload -f hf-iclass-AA162D30F8FF12F1-dump.eml\n" + "Load emulator memory with data from (bin/json) iCLASS dump file", + "hf iclass eload -f hf-iclass-AA162D30F8FF12F1-dump.json\n" "hf iclass eload -f hf-iclass-AA162D30F8FF12F1-dump.bin -m\n" ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_lit0("m", "mem", "use RDV4 spiffs"), arg_lit0("v", "verbose", "verbose output"), arg_param_end @@ -1103,7 +1103,7 @@ static int CmdHFiClassELoad(const char *Cmd) { static int CmdHFiClassESave(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf iclass esave", - "Save emulator memory to file.\n" + "Save emulator memory to file (bin/json)\n" "if filename is not supplied, CSN will be used.", "hf iclass esave\n" "hf iclass esave -f hf-iclass-dump\n" @@ -1111,7 +1111,7 @@ static int CmdHFiClassESave(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump file"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_int0("s", "size", "<256|2048>", "number of bytes to save (default 256)"), arg_param_end }; @@ -1308,7 +1308,7 @@ static int CmdHFiClassDecrypt(const char *Cmd) { "which is defined by the configuration block.\n" "\nOBS!\n" "In order to use this function, the file `iclass_decryptionkey.bin` must reside\n" - "in the resources directory. The file should be 16 bytes binary data\n" + "in the resources directory. The file must be 16 bytes binary data\n" "or...\n" "make sure your cardhelper is placed in the sim module", "hf iclass decrypt -f hf-iclass-AA162D30F8FF12F1-dump.bin\n" @@ -1317,7 +1317,7 @@ static int CmdHFiClassDecrypt(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump file (bin/eml/json)"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_str0("d", "data", "", "3DES encrypted data"), arg_str0("k", "key", "", "3DES transport key"), arg_lit0("v", "verbose", "verbose output"), @@ -2328,7 +2328,7 @@ static int CmdHFiClassCreditEpurse(const char *Cmd) { static int CmdHFiClassRestore(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf iclass restore", - "Restore data from dumpfile onto a iCLASS tag", + "Restore data from dumpfile (bin/eml/json) onto a iCLASS tag", "hf iclass restore -f hf-iclass-AA162D30F8FF12F1-dump.bin --first 6 --last 18 --ki 0\n" "hf iclass restore -f hf-iclass-AA162D30F8FF12F1-dump.bin --first 6 --last 18 --ki 0 --elite\n" "hf iclass restore -f hf-iclass-AA162D30F8FF12F1-dump.bin --first 6 --last 18 -k 1122334455667788 --elite\n" @@ -2336,7 +2336,7 @@ static int CmdHFiClassRestore(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "specify a filename to restore (bin/eml/json)"), + arg_str1("f", "file", "", "specify a filename to restore"), arg_str0("k", "key", "", "Access key as 8 hex bytes"), arg_int0(NULL, "ki", "", "Key index to select key from memory 'hf iclass managekeys'"), arg_int1(NULL, "first", "", "The first block number to restore"), @@ -3026,7 +3026,7 @@ static int CmdHFiClassView(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_int0(NULL, "first", "", "Begin printing from this block (default first user block)"), arg_int0(NULL, "last", "", "End printing at this block (default 0, ALL)"), arg_lit0("v", "verbose", "verbose output"), diff --git a/client/src/cmdhflegic.c b/client/src/cmdhflegic.c index 676ed3911..33aad2518 100644 --- a/client/src/cmdhflegic.c +++ b/client/src/cmdhflegic.c @@ -966,7 +966,7 @@ static int CmdLegicRestore(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "Filename to restore"), + arg_str1("f", "file", "", "Specify a filename to restore"), arg_lit0(NULL, "ob", "obfuscate dump data (xor with MCC)"), arg_param_end }; @@ -1406,7 +1406,7 @@ static int CmdLegicView(const char *Cmd) { ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "Filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_lit0("v", "verbose", "verbose output"), arg_param_end }; diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 1267235de..fb620edbf 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -1130,7 +1130,7 @@ static int FastDumpWithEcFill(uint8_t numsectors) { static int CmdHF14AMfDump(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mf dump", - "Dump MIFARE Classic tag to binary file\n" + "Dump MIFARE Classic tag to file (bin/json)\n" "If no given, UID will be used as filename", "hf mf dump --mini --> MIFARE Mini\n" "hf mf dump --1k --> MIFARE Classic 1k\n" @@ -1140,7 +1140,7 @@ static int CmdHF14AMfDump(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_str0("k", "keys", "", "filename of keys"), arg_lit0(NULL, "mini", "MIFARE Classic Mini / S20"), arg_lit0(NULL, "1k", "MIFARE Classic 1k / S50 (def)"), @@ -1264,7 +1264,7 @@ static int CmdHF14AMfRestore(const char *Cmd) { arg_lit0(NULL, "2k", "MIFARE Classic/Plus 2k"), arg_lit0(NULL, "4k", "MIFARE Classic 4k / S70"), arg_str0("u", "uid", "", "uid, (4|7|10 hex bytes)"), - arg_str0("f", "file", "", "specify dump filename (bin/eml/json)"), + arg_str0("f", "file", "", "specify a filename for dump file"), arg_str0("k", "kfn", "", "key filename"), arg_lit0(NULL, "ka", "use specified keyfile to authenticate"), arg_lit0(NULL, "force", "override warnings"), @@ -4250,7 +4250,7 @@ int CmdHF14AMfELoad(const char *Cmd) { ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_lit0(NULL, "mini", "MIFARE Classic Mini / S20"), arg_lit0(NULL, "1k", "MIFARE Classic 1k / S50 (def)"), arg_lit0(NULL, "2k", "MIFARE Classic/Plus 2k"), @@ -4439,14 +4439,14 @@ static int CmdHF14AMfESave(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mf esave", - "Save emulator memory into two files (bin//json) ", + "Save emulator memory to file (bin/json) ", "hf mf esave\n" "hf mf esave --4k\n" "hf mf esave --4k -f hf-mf-01020304.eml" ); void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_lit0(NULL, "mini", "MIFARE Classic Mini / S20"), arg_lit0(NULL, "1k", "MIFARE Classic 1k / S50 (def)"), arg_lit0(NULL, "2k", "MIFARE Classic/Plus 2k"), @@ -4952,7 +4952,7 @@ static int CmdHF14AMfCLoad(const char *Cmd) { ); void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_lit0(NULL, "emu", "from emulator memory"), arg_param_end }; @@ -5181,14 +5181,14 @@ static int CmdHF14AMfCGetSc(const char *Cmd) { static int CmdHF14AMfCSave(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mf csave", - "Save magic gen1a card memory into two files (bin/json)" + "Save magic gen1a card memory to file (bin/json)" "or into emulator memory", "hf mf csave\n" "hf mf csave --4k" ); void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_lit0(NULL, "mini", "MIFARE Classic Mini / S20"), arg_lit0(NULL, "1k", "MIFARE Classic 1k / S50 (def)"), arg_lit0(NULL, "2k", "MIFARE Classic/Plus 2k"), @@ -7332,7 +7332,7 @@ static int CmdHF14AMfView(const char *Cmd) { ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_lit0("v", "verbose", "verbose output"), arg_lit0(NULL, "sk", "Save extracted keys to file"), arg_param_end @@ -7509,7 +7509,7 @@ static int CmdHF14AGen4Load(const char *cmd) { arg_lit0(NULL, "4k", "MIFARE Classic 4k / S70"), arg_str0("p", "pwd", "", "password 4bytes"), arg_lit0("v", "verbose", "verbose output"), - arg_str0("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_lit0(NULL, "emu", "from emulator memory"), arg_int0(NULL, "start", "", "index of block to start writing (default 0)"), arg_int0(NULL, "end", "", "index of block to end writing (default last block)"), @@ -7855,7 +7855,7 @@ static int CmdHF14AGen4Save(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mf gsave", - "Save `magic gen4 gtu` card memory into two files (bin/json)" + "Save `magic gen4 gtu` card memory to file (bin/json)" "or into emulator memory", "hf mf gsave\n" "hf mf gsave --4k\n" @@ -7868,7 +7868,7 @@ static int CmdHF14AGen4Save(const char *Cmd) { arg_lit0(NULL, "2k", "MIFARE Classic/Plus 2k"), arg_lit0(NULL, "4k", "MIFARE Classic 4k / S70"), arg_str0("p", "pwd", "", "password 4 bytes"), - arg_str0("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_lit0(NULL, "emu", "to emulator memory"), arg_param_end }; diff --git a/client/src/cmdhfmfp.c b/client/src/cmdhfmfp.c index 9d854290e..9c02e8aea 100644 --- a/client/src/cmdhfmfp.c +++ b/client/src/cmdhfmfp.c @@ -1384,15 +1384,15 @@ static int CmdHFMFPChk(const char *Cmd) { static int CmdHFMFPDump(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfp dump", - "Dump MIFARE Plus tag to binary file\n" + "Dump MIFARE Plus tag to file (bin/json)\n" "If no given, UID will be used as filename", "hf mfp dump\n" "hf mfp dump --keys hf-mf-066C8B78-key.bin --> MIFARE Plus with keys from specified file\n"); void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump"), - arg_str0("k", "keys", "", "filename of keys"), + arg_str0("f", "file", "", "Specify a filename for dump file"), + arg_str0("k", "keys", "", "Specify a filename for keys file"), arg_lit0(NULL, "ns", "no save to file"), arg_lit0("v", "verbose", "Verbose mode"), arg_param_end diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index 8c46ad992..c15ad1b74 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -2434,7 +2434,7 @@ static int CmdHF14AMfUDump(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf mfu dump", - "Dump MIFARE Ultralight/NTAG tag to binary/eml/json files.\n" + "Dump MIFARE Ultralight/NTAG tag to files (bin/json)\n" "It autodetects card type." "Supports:\n" "Ultralight, Ultralight-C, Ultralight EV1\n" @@ -2848,7 +2848,7 @@ static int CmdHF14AMfURestore(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "specify dump filename"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_str0("k", "key", "", "key for authentication (UL-C 16 bytes, EV1/NTAG 4 bytes)"), arg_lit0("l", NULL, "swap entered key's endianness"), arg_lit0("s", NULL, "enable special write UID -MAGIC TAG ONLY-"), @@ -3065,7 +3065,7 @@ static int CmdHF14AMfUeLoad(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "Filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_int0("q", "qty", "", "Number of blocks to load from eml file"), arg_lit0("v", "verbose", "verbose output"), arg_param_end @@ -4574,7 +4574,7 @@ static int CmdHF14AMfuESave(const char *Cmd) { void *argtable[] = { arg_param_begin, arg_int0("e", "end", "", "index of last block"), - arg_str0("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_param_end }; @@ -4634,7 +4634,7 @@ static int CmdHF14AMfuView(const char *Cmd) { ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "Filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_lit0("v", "verbose", "Verbose output"), arg_param_end }; diff --git a/client/src/cmdhfntag424.c b/client/src/cmdhfntag424.c index fa6170c94..b3b6c47c7 100644 --- a/client/src/cmdhfntag424.c +++ b/client/src/cmdhfntag424.c @@ -41,7 +41,7 @@ static int CmdHF_ntag424_view(const char *Cmd) { ); void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "Filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_lit0("v", "verbose", "Verbose output"), arg_param_end }; diff --git a/client/src/cmdhftopaz.c b/client/src/cmdhftopaz.c index 97ba7e5f0..5b8ab2677 100644 --- a/client/src/cmdhftopaz.c +++ b/client/src/cmdhftopaz.c @@ -838,13 +838,13 @@ static int CmdHFTopazDump(const char *Cmd) { CLIParserContext *ctx; CLIParserInit(&ctx, "hf topaz dump", - "Dump TOPAZ tag to binary file\n" + "Dump TOPAZ tag to file (bin/json)\n" "If no given, UID will be used as filename", "hf topaz dump\n"); void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_lit0(NULL, "ns", "no save to file"), arg_param_end }; @@ -916,7 +916,7 @@ static int CmdHFTopazView(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "filename of dump"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_param_end }; CLIExecWithReturn(ctx, Cmd, argtable, false); diff --git a/client/src/cmdlfem4x50.c b/client/src/cmdlfem4x50.c index d44d71dcf..b94acfcc5 100644 --- a/client/src/cmdlfem4x50.c +++ b/client/src/cmdlfem4x50.c @@ -194,7 +194,7 @@ int CmdEM4x50ELoad(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str1("f", "file", "", "dump filename"), + arg_str1("f", "file", "", "Specify a filename for dump file"), arg_param_end }; @@ -1113,7 +1113,7 @@ int CmdEM4x50Restore(const char *Cmd) { void *argtable[] = { arg_param_begin, arg_str0("u", "uid", "", "uid, 4 hex bytes, msb"), - arg_str0("f", "file", "", "specify dump filename (bin/eml/json)"), + arg_str0("f", "file", "", "specify a filename for dump file"), arg_str0("p", "pwd", "", "password, 4 hex bytes, lsb"), arg_param_end }; diff --git a/client/src/cmdlft55xx.c b/client/src/cmdlft55xx.c index e9da9de64..639fa2ce0 100644 --- a/client/src/cmdlft55xx.c +++ b/client/src/cmdlft55xx.c @@ -2336,7 +2336,7 @@ static int CmdT55xxRestore(const char *Cmd) { void *argtable[] = { arg_param_begin, - arg_str0("f", "file", "", "filename of dump file"), + arg_str0("f", "file", "", "Specify a filename for dump file"), arg_str0("p", "pwd", "", "password if target card has password set (4 hex bytes)"), arg_param_end }; diff --git a/client/src/fileutils.c b/client/src/fileutils.c index 8ed6e01ee..845b49fcd 100644 --- a/client/src/fileutils.c +++ b/client/src/fileutils.c @@ -264,57 +264,6 @@ int saveFile(const char *preferredName, const char *suffix, const void *data, si return PM3_SUCCESS; } -// dump file -int saveFileEML(const char *preferredName, uint8_t *data, size_t datalen, size_t blocksize) { - - if (data == NULL || datalen == 0) { - return PM3_EINVARG; - } - - char *fileName = newfilenamemcopyEx(preferredName, ".eml", spDump); - if (fileName == NULL) { - return PM3_EMALLOC; - } - - int retval = PM3_SUCCESS; - int blocks = datalen / blocksize; - uint16_t currblock = 1; - - // We should have a valid filename now, e.g. dumpdata-3.bin - - // Opening file for writing in text mode - FILE *f = fopen(fileName, "w+"); - if (!f) { - PrintAndLogEx(WARNING, "file not found or locked `" _YELLOW_("%s") "`", fileName); - retval = PM3_EFILE; - goto out; - } - - for (size_t i = 0; i < datalen; i++) { - fprintf(f, "%02X", data[i]); - - // no extra line in the end - if ((i + 1) % blocksize == 0 && currblock != blocks) { - fprintf(f, "\n"); - currblock++; - } - } - // left overs - if (datalen % blocksize != 0) { - int index = blocks * blocksize; - for (size_t j = 0; j < datalen % blocksize; j++) { - fprintf(f, "%02X", data[index + j]); - } - } - fflush(f); - fclose(f); - PrintAndLogEx(SUCCESS, "saved " _YELLOW_("%" PRId32) " blocks to text file " _YELLOW_("%s"), blocks, fileName); - -out: - free(fileName); - return retval; -} - // dump file (normally, we also got preference file, etc) int saveFileJSON(const char *preferredName, JSONFileType ftype, uint8_t *data, size_t datalen, void (*callback)(json_t *)) { return saveFileJSONex(preferredName, ftype, data, datalen, true, callback, spDump); @@ -1543,12 +1492,15 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz if (!strcmp(ctype, "ndef")) { + /* + // when we will read and return extra values from NDEF json json_error_t up_error = {0}; int i1 = 0; size_t ndefsize = 0; if (json_unpack_ex(root, &up_error, 0, "{s:i}", "Ndef.Size", &i1) == 0) { ndefsize = i1; } + */ size_t sptr = 0; for (int i = 0; i < (maxdatalen / 16); i++) { diff --git a/client/src/fileutils.h b/client/src/fileutils.h index 98ecc466d..885692569 100644 --- a/client/src/fileutils.h +++ b/client/src/fileutils.h @@ -100,19 +100,6 @@ char *newfilenamemcopyEx(const char *preferredName, const char *suffix, savePath */ int saveFile(const char *preferredName, const char *suffix, const void *data, size_t datalen); -/** - * @brief Utility function to save data to a textfile (EML). This method takes a preferred name, but if that - * file already exists, it tries with another name until it finds something suitable. - * E.g. dumpdata-15.txt - * - * @param preferredName - * @param data The binary data to write to the file - * @param datalen the length of the data - * @param blocksize the length of one row - * @return 0 for ok, 1 for failz -*/ -int saveFileEML(const char *preferredName, uint8_t *data, size_t datalen, size_t blocksize); - /** STUB * @brief Utility function to save JSON data to a file. This method takes a preferred name, but if that * file already exists, it tries with another name until it finds something suitable. diff --git a/doc/cheatsheet.md b/doc/cheatsheet.md index c25b7f486..f012a0f17 100644 --- a/doc/cheatsheet.md +++ b/doc/cheatsheet.md @@ -140,7 +140,7 @@ Decrypt iCLASS Block / file ``` Options --- --f, --file filename of dumpfile +-f, --file Specify a filename for dump file -d, --data 3DES encrypted data -k, --key 3DES transport key -v, --verbose verbose output @@ -153,7 +153,7 @@ Load iCLASS dump into memory for simulation ``` Options --- --f, --file filename of dump +-f, --file Specify a filename for dump file --json load JSON type dump --eml load EML type dump @@ -261,8 +261,8 @@ Dump MIFARE Classic card contents ``` Options: --- --f, --file filename of dump --k, --keys filename of keys +-f, --file Specify a filename for dump file +-k, --keys Specify a filename for keys file --mini MIFARE Classic Mini / S20 --1k MIFARE Classic 1k / S50 (default) --2k MIFARE Classic/Plus 2k @@ -335,7 +335,7 @@ Accepts (BIN/EML/JSON) ``` Options --- --f, --file filename of dump +-f, --file Specify a filename for dump file --mini MIFARE Classic Mini / S20 --1k MIFARE Classic 1k / S50 (def) --2k MIFARE Classic/Plus 2k