mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-25 16:45:09 +08:00
remove old
This commit is contained in:
parent
8674a5ef18
commit
68ebc84641
1 changed files with 0 additions and 114 deletions
|
@ -6421,120 +6421,6 @@ static int CmdHF14ADesCreateFile(const char *Cmd) {
|
|||
|
||||
DropField();
|
||||
return PM3_SUCCESS;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
CLIParserContext *ctx;
|
||||
CLIParserInit(&ctx, "hf mfdes createfile",
|
||||
"Create Standard/Backup File",
|
||||
"hf mfdes createfile -f 0001 -n 01 -c 0 -r EEEE -s 000100 -a 123456"
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_int0("n", "fileno", "<dec>", "File Number (0 - 31)"),
|
||||
arg_strx0("f", "fileid", "<hex>", "ISO FID (2 hex bytes, big endian)"),
|
||||
arg_int0("c", "com", "<dec>", "Communication setting (0 = Plain, 1 = Plain + MAC, 3 = Enciphered)"),
|
||||
arg_strx0("r", "rights", "<hex>", "Access rights (2 hex bytes -> RW/Chg/R/W, 0x0 - 0xD Key, 0xE Free, 0xF Denied)"),
|
||||
arg_strx0("s", "filesize", "<hex>", "File size (3 hex bytes, big endian)"),
|
||||
arg_lit0("b", "backup", "Create backupfile instead of standard file"),
|
||||
arg_strx0("a", "aid", "<hex>", "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 fsizelen = 0;
|
||||
uint8_t filesize[3] = {0};
|
||||
CLIGetHexWithReturn(ctx, 5, filesize, &fsizelen);
|
||||
|
||||
bool isbackup = arg_get_lit(ctx, 6);
|
||||
int aidlength = 3;
|
||||
uint8_t aid[3] = {0};
|
||||
CLIGetHexWithReturn(ctx, 7, aid, &aidlength);
|
||||
swap24(aid);
|
||||
CLIParserFree(ctx);
|
||||
|
||||
swap16(fid);
|
||||
swap24(filesize);
|
||||
|
||||
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 (fsizelen != 3) {
|
||||
PrintAndLogEx(ERR, "Filesize 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_file_t ft;
|
||||
memcpy(ft.fid, fid, 2);
|
||||
memcpy(ft.filesize, filesize, 3);
|
||||
ft.fileno = fno;
|
||||
ft.comset = comset;
|
||||
memcpy(ft.access_rights, ar, 2);
|
||||
|
||||
if (aidlength != 3 && aidlength != 0) {
|
||||
PrintAndLogEx(ERR, _RED_(" The given aid must have 3 bytes (big endian)."));
|
||||
DropFieldDesfire();
|
||||
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."));
|
||||
DropFieldDesfire();
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
memcpy(aid, (uint8_t *)&tag->selected_application, 3);
|
||||
}
|
||||
|
||||
// int res;
|
||||
// a select here seems to invalidate the current authentication with AMK and create file fails if not open access.
|
||||
// This will be managed when we track Authenticated or Note, so a place holder comment as a reminder.
|
||||
int res = handler_desfire_select_application(aid);
|
||||
if (res != PM3_SUCCESS) {
|
||||
PrintAndLogEx(ERR, "Couldn't select aid. Error %d", res);
|
||||
DropFieldDesfire();
|
||||
return res;
|
||||
}
|
||||
|
||||
if (isbackup)
|
||||
res = handler_desfire_create_backup_file(&ft);
|
||||
else
|
||||
res = handler_desfire_create_std_file(&ft);
|
||||
|
||||
if (res == PM3_SUCCESS)
|
||||
PrintAndLogEx(SUCCESS, "Successfully created standard / backup file.");
|
||||
else
|
||||
PrintAndLogEx(ERR, "Couldn't create standard / backup file. Error %d", res);
|
||||
|
||||
DropFieldDesfire();
|
||||
return res;*/
|
||||
}
|
||||
|
||||
static int CmdHF14ADesDeleteFile(const char *Cmd) {
|
||||
|
|
Loading…
Reference in a new issue