mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
added file iso id to select command
This commit is contained in:
parent
4e6a59f169
commit
a06376a7f6
1 changed files with 26 additions and 4 deletions
|
@ -2274,7 +2274,8 @@ static int CmdHF14ADesSelectApp(const char *Cmd) {
|
||||||
"hf mfdes selectapp --aid 123456 -> select application 123456\n"
|
"hf mfdes selectapp --aid 123456 -> select application 123456\n"
|
||||||
"hf mfdes selectapp --mf -> select master file (PICC level)\n"
|
"hf mfdes selectapp --mf -> select master file (PICC level)\n"
|
||||||
"hf mfdes selectapp --dfname aid123456 -> select application aid123456 by DF name\n"
|
"hf mfdes selectapp --dfname aid123456 -> select application aid123456 by DF name\n"
|
||||||
"hf mfdes selectapp --isoid 1111 -> select application 1111 by ISO ID");
|
"hf mfdes selectapp --isoid 1111 -> select application 1111 by ISO ID\n"
|
||||||
|
"hf mfdes selectapp --isoid 1111 --fileisoid 2222 -> select application 1111 file 2222 by ISO ID");
|
||||||
|
|
||||||
void *argtable[] = {
|
void *argtable[] = {
|
||||||
arg_param_begin,
|
arg_param_begin,
|
||||||
|
@ -2290,8 +2291,9 @@ static int CmdHF14ADesSelectApp(const char *Cmd) {
|
||||||
arg_str0("s", "schann", "<d40/ev1/ev2>", "Secure channel: d40/ev1/ev2"),
|
arg_str0("s", "schann", "<d40/ev1/ev2>", "Secure channel: d40/ev1/ev2"),
|
||||||
arg_str0(NULL, "aid", "<app id hex>", "Application ID of application for some parameters (3 hex bytes, big endian)"),
|
arg_str0(NULL, "aid", "<app id hex>", "Application ID of application for some parameters (3 hex bytes, big endian)"),
|
||||||
arg_str0(NULL, "dfname", "<df name str>", "Application DF Name (string, max 16 chars). Selects application via ISO SELECT command"),
|
arg_str0(NULL, "dfname", "<df name str>", "Application DF Name (string, max 16 chars). Selects application via ISO SELECT command"),
|
||||||
arg_str0(NULL, "isoid", "<isoid hex>", "Application ISO ID (ISO DF ID) (2 hex bytes, big endian)"),
|
|
||||||
arg_lit0(NULL, "mf", "Select MF (master file) via ISO channel"),
|
arg_lit0(NULL, "mf", "Select MF (master file) via ISO channel"),
|
||||||
|
arg_str0(NULL, "isoid", "<isoid hex>", "Application ISO ID (ISO DF ID) (2 hex bytes, big endian)"),
|
||||||
|
arg_str0(NULL, "fileisoid", "<isoid hex>", "Select file inside application by ISO ID (ISO DF ID) (2 hex bytes, big endian)."),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
};
|
};
|
||||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||||
|
@ -2312,8 +2314,10 @@ static int CmdHF14ADesSelectApp(const char *Cmd) {
|
||||||
int dfnamelen = 16;
|
int dfnamelen = 16;
|
||||||
CLIGetStrWithReturn(ctx, 12, dfname, &dfnamelen);
|
CLIGetStrWithReturn(ctx, 12, dfname, &dfnamelen);
|
||||||
|
|
||||||
|
bool selectmf = arg_get_lit(ctx, 13);
|
||||||
|
|
||||||
uint32_t isoid = 0x0000;
|
uint32_t isoid = 0x0000;
|
||||||
res = arg_get_u32_hexstr_def_nlen(ctx, 13, 0x0000, &isoid, 2, true);
|
res = arg_get_u32_hexstr_def_nlen(ctx, 14, 0x0000, &isoid, 2, true);
|
||||||
bool idsoidpresent = (res == 1);
|
bool idsoidpresent = (res == 1);
|
||||||
if (res == 2) {
|
if (res == 2) {
|
||||||
PrintAndLogEx(ERR, "ISO ID for EF or DF must have 2 bytes length");
|
PrintAndLogEx(ERR, "ISO ID for EF or DF must have 2 bytes length");
|
||||||
|
@ -2321,7 +2325,14 @@ static int CmdHF14ADesSelectApp(const char *Cmd) {
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool selectmf = arg_get_lit(ctx, 14);
|
uint32_t fileisoid = 0x0000;
|
||||||
|
res = arg_get_u32_hexstr_def_nlen(ctx, 15, 0x0000, &fileisoid, 2, true);
|
||||||
|
bool fileisoidpresent = (res == 1);
|
||||||
|
if (res == 2) {
|
||||||
|
PrintAndLogEx(ERR, "ISO ID for EF or DF must have 2 bytes length");
|
||||||
|
CLIParserFree(ctx);
|
||||||
|
return PM3_EINVARG;
|
||||||
|
}
|
||||||
|
|
||||||
SetAPDULogging(APDULogging);
|
SetAPDULogging(APDULogging);
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
@ -2383,6 +2394,17 @@ static int CmdHF14ADesSelectApp(const char *Cmd) {
|
||||||
|
|
||||||
PrintAndLogEx(SUCCESS, "Application 0x%06x selected " _GREEN_("succesfully") " ", appid);
|
PrintAndLogEx(SUCCESS, "Application 0x%06x selected " _GREEN_("succesfully") " ", appid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fileisoidpresent) {
|
||||||
|
res = DesfireSelectEx(&dctx, false, ISWIsoID, fileisoid, NULL);
|
||||||
|
if (res != PM3_SUCCESS) {
|
||||||
|
DropField();
|
||||||
|
PrintAndLogEx(FAILED, "Select file 0x%04x " _RED_("failed") " ", fileisoid);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintAndLogEx(SUCCESS, "File 0x%04x selected " _GREEN_("succesfully") " ", fileisoid);
|
||||||
|
}
|
||||||
|
|
||||||
DropField();
|
DropField();
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue