From 4356cf11512d2799fb2461002aff1c86738ba48e Mon Sep 17 00:00:00 2001 From: merlokk <807634+merlokk@users.noreply.github.com> Date: Mon, 26 Jul 2021 19:26:20 +0300 Subject: [PATCH] remove old code --- client/src/cmdhfmfdes.c | 143 ---------------------------------------- 1 file changed, 143 deletions(-) diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index 831327e09..11e26e9f9 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -6081,149 +6081,6 @@ static int CmdHF14ADesCreateRecordFile(const char *Cmd) { DropField(); return PM3_SUCCESS; - - - - - - - - - - - - - - - /* - CLIParserContext *ctx; - CLIParserInit(&ctx, "hf mfdes createrecordfile", - "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_int0("n", "fileno", "", "File Number (0 - 31)"), - arg_strx0("f", "fileid", "", "ISO FID (2 hex bytes, big endian)"), - arg_int0("c", "com", "", "Communication setting (0 = Plain, 1 = Plain + MAC, 3 = Enciphered)"), -// 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, 0x0 - 0xD Key, 0xE Free, 0xF 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)"), - arg_param_end - }; - - CLIExecWithReturn(ctx, Cmd, argtable, false); - int fno = arg_get_int_def(ctx, 1, 0); - - int fidlength = 0; - uint8_t fid[2] = {0}; - int res_flen = CLIParamHexToBuf(arg_get_str(ctx, 2), fid, 2, &fidlength); - - uint8_t comset = arg_get_int(ctx, 3); - - int arlength = 0; - uint8_t ar[2] = {0}; - CLIGetHexWithReturn(ctx, 4, ar, &arlength); - - int rsizelen = 0; - uint8_t recordsize[3] = {0}; - CLIGetHexWithReturn(ctx, 5, recordsize, &rsizelen); - - int msizelen = 0; - uint8_t maxnumrecords[3] = {0}; - CLIGetHexWithReturn(ctx, 6, maxnumrecords, &msizelen); - - bool cyclic = arg_get_lit(ctx, 7); - - int aidlength = 3; - uint8_t aid[3] = {0}; - CLIGetHexWithReturn(ctx, 8, aid, &aidlength); - swap24(aid); - CLIParserFree(ctx); - - swap16(fid); - swap24(recordsize); - swap24(maxnumrecords); - - if (msizelen != 3) { - PrintAndLogEx(ERR, "Maximum number of records must have 3 hex bytes length."); - return PM3_EINVARG; - } - - if (memcmp("\x00\x00\x00", maxnumrecords, 3) == 0x0) { - PrintAndLogEx(ERR, "Maximum number of records is invalid (0x000001-0xFFFFFF)."); - return PM3_EINVARG; - } - - if (fno > 0x1F) { - PrintAndLogEx(ERR, "File number range is invalid (exp 0 - 31), got %d", fno); - return PM3_EINVARG; - } - - if (comset != 0 && comset != 1 && comset != 3) { - PrintAndLogEx(ERR, "Communication setting must be either 0=Plain, 1=Plain+MAC or 3=Encrypt."); - return PM3_EINVARG; - } - - if (arlength != 2) { - PrintAndLogEx(ERR, "Access rights must have 2 hex bytes length."); - return PM3_EINVARG; - } - - if (rsizelen != 3) { - PrintAndLogEx(ERR, "Recordsize must have 3 hex bytes length."); - return PM3_EINVARG; - } - - if (res_flen || fidlength != 2) { - PrintAndLogEx(ERR, "ISO File id must have 2 hex bytes length."); - return PM3_EINVARG; - } - - mfdes_linear_t ft = { - .fileno = fno, - .comset = comset - }; - memcpy(ft.fid, fid, 2); - memcpy(ft.access_rights, ar, 2); - memcpy(ft.recordsize, recordsize, 3); - memcpy(ft.maxnumrecords, maxnumrecords, 3); - - if (aidlength != 3 && aidlength != 0) { - PrintAndLogEx(ERR, _RED_(" The given aid must have 3 bytes (big endian).")); - return PM3_ESOFT; - } else if (aidlength == 0) { - if (memcmp(&tag->selected_application, aid, 3) == 0) { - PrintAndLogEx(ERR, _RED_(" You need to select an aid first.")); - return PM3_ESOFT; - } - memcpy(aid, (uint8_t *)&tag->selected_application, 3); - } - if (handler_desfire_select_application(aid) != PM3_SUCCESS) { - PrintAndLogEx(ERR, _RED_(" Error on selecting aid.")); - return PM3_ESOFT; - } - - int res = PM3_SUCCESS; - if (cyclic) { - res = handler_desfire_create_cyclicrecordfile(&ft); - } else { - res = handler_desfire_create_linearrecordfile(&ft); - } - - if (res == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "Successfully created linear/cyclic record file."); - } else { - PrintAndLogEx(ERR, "Couldn't create linear/cyclic record file. Error %d", res); - } - DropFieldDesfire(); - return res;*/ - } static int CmdHF14ADesDeleteFile(const char *Cmd) {