mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
hf iclass eload - now uses cliparser
This commit is contained in:
parent
777cb5a8ce
commit
71cf7da4c2
2 changed files with 27 additions and 46 deletions
|
@ -66,22 +66,12 @@ static int usage_hf_iclass_sim(void) {
|
||||||
PrintAndLogEx(NORMAL, " -- execute loclass attack online part");
|
PrintAndLogEx(NORMAL, " -- execute loclass attack online part");
|
||||||
PrintAndLogEx(NORMAL, _YELLOW_("\thf iclass sim 2"));
|
PrintAndLogEx(NORMAL, _YELLOW_("\thf iclass sim 2"));
|
||||||
PrintAndLogEx(NORMAL, " -- simulate full iCLASS 2k tag");
|
PrintAndLogEx(NORMAL, " -- simulate full iCLASS 2k tag");
|
||||||
PrintAndLogEx(NORMAL, _YELLOW_("\thf iclass eload f hf-iclass-AA162D30F8FF12F1-dump.bin"));
|
PrintAndLogEx(NORMAL, _YELLOW_("\thf iclass eload -f hf-iclass-AA162D30F8FF12F1-dump.bin"));
|
||||||
PrintAndLogEx(NORMAL, _YELLOW_("\thf iclass sim 3"));
|
PrintAndLogEx(NORMAL, _YELLOW_("\thf iclass sim 3"));
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
static int usage_hf_iclass_eload(void) {
|
|
||||||
PrintAndLogEx(NORMAL, "Loads iCLASS tag dump into emulator memory on device\n");
|
|
||||||
PrintAndLogEx(NORMAL, "Usage: hf iclass eload [h] f <filename>\n");
|
|
||||||
PrintAndLogEx(NORMAL, "Options");
|
|
||||||
PrintAndLogEx(NORMAL, " h : Show this help");
|
|
||||||
PrintAndLogEx(NORMAL, " f <filename> : filename of dump");
|
|
||||||
PrintAndLogEx(NORMAL, "Examples:");
|
|
||||||
PrintAndLogEx(NORMAL, _YELLOW_("\thf iclass eload f hf-iclass-AA162D30F8FF12F1-dump.bin"));
|
|
||||||
PrintAndLogEx(NORMAL, "");
|
|
||||||
return PM3_SUCCESS;
|
|
||||||
}
|
|
||||||
static int usage_hf_iclass_esave(void) {
|
static int usage_hf_iclass_esave(void) {
|
||||||
PrintAndLogEx(NORMAL, "Save emulator memory to file.");
|
PrintAndLogEx(NORMAL, "Save emulator memory to file.");
|
||||||
PrintAndLogEx(NORMAL, "if not filename is supplied, CSN will be used.");
|
PrintAndLogEx(NORMAL, "if not filename is supplied, CSN will be used.");
|
||||||
|
@ -884,42 +874,33 @@ static int CmdHFiClassReader(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CmdHFiClassELoad(const char *Cmd) {
|
static int CmdHFiClassELoad(const char *Cmd) {
|
||||||
|
CLIParserContext *ctx;
|
||||||
|
CLIParserInit(&ctx, "hf iclass eload",
|
||||||
|
"Loads iCLASS tag dump into emulator memory on device",
|
||||||
|
"hf iclass eload -f hf-iclass-AA162D30F8FF12F1-dump.bin\n");
|
||||||
|
|
||||||
|
void *argtable[] = {
|
||||||
|
arg_param_begin,
|
||||||
|
arg_str1("f", "file", "<filename>", "filename of dump"),
|
||||||
|
arg_lit0(NULL, "json", "print from this block (default block6)"),
|
||||||
|
arg_lit0(NULL, "eml", "end printing at this block (default 0, ALL)"),
|
||||||
|
arg_param_end
|
||||||
|
};
|
||||||
|
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||||
|
|
||||||
|
int fnlen = 0;
|
||||||
|
char filename[FILE_PATH_SIZE] = {0};
|
||||||
|
CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen);
|
||||||
|
|
||||||
DumpFileType_t dftype = BIN;
|
DumpFileType_t dftype = BIN;
|
||||||
char filename[FILE_PATH_SIZE] = {0};
|
|
||||||
bool errors = false;
|
if (arg_get_lit(ctx, 2)) {
|
||||||
uint8_t cmdp = 0;
|
dftype = JSON;
|
||||||
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
|
} else if (arg_get_lit(ctx, 3)) {
|
||||||
switch (tolower(param_getchar(Cmd, cmdp))) {
|
dftype = EML;
|
||||||
case 'h':
|
|
||||||
return usage_hf_iclass_eload();
|
|
||||||
case 'f':
|
|
||||||
if (param_getstr(Cmd, cmdp + 1, filename, FILE_PATH_SIZE) >= FILE_PATH_SIZE) {
|
|
||||||
PrintAndLogEx(FAILED, "Filename too long");
|
|
||||||
errors = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
cmdp += 2;
|
|
||||||
break;
|
|
||||||
case 'j':
|
|
||||||
dftype = JSON;
|
|
||||||
cmdp++;
|
|
||||||
break;
|
|
||||||
case 'e':
|
|
||||||
dftype = EML;
|
|
||||||
cmdp++;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
|
|
||||||
errors = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Validations
|
CLIParserFree(ctx);
|
||||||
if (errors || cmdp == 0) {
|
|
||||||
return usage_hf_iclass_eload();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t *dump = calloc(2048, sizeof(uint8_t));
|
uint8_t *dump = calloc(2048, sizeof(uint8_t));
|
||||||
if (!dump) {
|
if (!dump) {
|
||||||
|
|
|
@ -135,7 +135,7 @@ Options
|
||||||
---
|
---
|
||||||
f <filename> : load iCLASS tag-dump filename
|
f <filename> : load iCLASS tag-dump filename
|
||||||
|
|
||||||
pm3 --> hf iclass eload f hf-iclass-db883702f8ff12e0.bin
|
pm3 --> hf iclass eload -f hf-iclass-db883702f8ff12e0.bin
|
||||||
```
|
```
|
||||||
|
|
||||||
Clone iCLASS Legacy Sequence
|
Clone iCLASS Legacy Sequence
|
||||||
|
@ -160,7 +160,7 @@ pm3 --> hf iclass sim 3
|
||||||
Simulate iCLASS Sequence
|
Simulate iCLASS Sequence
|
||||||
```
|
```
|
||||||
pm3 --> hf iclass dump k 0
|
pm3 --> hf iclass dump k 0
|
||||||
pm3 --> hf iclass eload f hf-iclass-db883702f8ff12e0.bin
|
pm3 --> hf iclass eload -f hf-iclass-db883702f8ff12e0.bin
|
||||||
pm3 --> hf iclass sim 3
|
pm3 --> hf iclass sim 3
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue