mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
WIP: Adding --emu functionality to hf iclass encode
For some reason it wipes the entire emu memory
This commit is contained in:
parent
9798071ec9
commit
bebd1bb654
1 changed files with 19 additions and 11 deletions
|
@ -4594,6 +4594,7 @@ static int CmdHFiClassEncode(const char *Cmd) {
|
||||||
arg_u64_0(NULL, "cn", "<dec>", "card number"),
|
arg_u64_0(NULL, "cn", "<dec>", "card number"),
|
||||||
arg_u64_0(NULL, "issue", "<dec>", "issue level"),
|
arg_u64_0(NULL, "issue", "<dec>", "issue level"),
|
||||||
arg_str0("w", "wiegand", "<format>", "see " _YELLOW_("`wiegand list`") " for available formats"),
|
arg_str0("w", "wiegand", "<format>", "see " _YELLOW_("`wiegand list`") " for available formats"),
|
||||||
|
arg_lit0(NULL, "emu", "Write to emulation memory instead of card"),
|
||||||
arg_lit0(NULL, "shallow", "use shallow (ASK) reader modulation instead of OOK"),
|
arg_lit0(NULL, "shallow", "use shallow (ASK) reader modulation instead of OOK"),
|
||||||
arg_lit0("v", NULL, "verbose (print encoded blocks)"),
|
arg_lit0("v", NULL, "verbose (print encoded blocks)"),
|
||||||
arg_param_end
|
arg_param_end
|
||||||
|
@ -4640,10 +4641,12 @@ static int CmdHFiClassEncode(const char *Cmd) {
|
||||||
|
|
||||||
char format[16] = {0};
|
char format[16] = {0};
|
||||||
int format_len = 0;
|
int format_len = 0;
|
||||||
|
|
||||||
CLIParamStrToBuf(arg_get_str(ctx, 10), (uint8_t *)format, sizeof(format), &format_len);
|
CLIParamStrToBuf(arg_get_str(ctx, 10), (uint8_t *)format, sizeof(format), &format_len);
|
||||||
|
|
||||||
bool shallow_mod = arg_get_lit(ctx, 11);
|
bool use_emulator_memory = arg_get_lit(ctx, 11);
|
||||||
bool verbose = arg_get_lit(ctx, 12);
|
bool shallow_mod = arg_get_lit(ctx, 12);
|
||||||
|
bool verbose = arg_get_lit(ctx, 13);
|
||||||
|
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
|
|
||||||
|
@ -4776,15 +4779,20 @@ static int CmdHFiClassEncode(const char *Cmd) {
|
||||||
|
|
||||||
int isok = PM3_SUCCESS;
|
int isok = PM3_SUCCESS;
|
||||||
// write
|
// write
|
||||||
for (uint8_t i = 0; i < 4; i++) {
|
if (use_emulator_memory) {
|
||||||
isok = iclass_write_block(6 + i, credential + (i * 8), NULL, key, use_credit_key, elite, rawkey, false, false, auth, shallow_mod);
|
uint16_t bytes_sent = 0;
|
||||||
switch (isok) {
|
iclass_upload_emul(credential, sizeof(credential), 6 * PICOPASS_BLOCK_SIZE, &bytes_sent);
|
||||||
case PM3_SUCCESS:
|
} else {
|
||||||
PrintAndLogEx(SUCCESS, "Write block %d/0x0%x ( " _GREEN_("ok") " ) --> " _YELLOW_("%s"), 6 + i, 6 + i, sprint_hex_inrow(credential + (i * 8), 8));
|
for (uint8_t i = 0; i < 4; i++) {
|
||||||
break;
|
isok = iclass_write_block(6 + i, credential + (i * 8), NULL, key, use_credit_key, elite, rawkey, false, false, auth, shallow_mod);
|
||||||
default:
|
switch (isok) {
|
||||||
PrintAndLogEx(INFO, "Write block %d/0x0%x ( " _RED_("fail") " )", 6 + i, 6 + i);
|
case PM3_SUCCESS:
|
||||||
break;
|
PrintAndLogEx(SUCCESS, "Write block %d/0x0%x ( " _GREEN_("ok") " ) --> " _YELLOW_("%s"), 6 + i, 6 + i, sprint_hex_inrow(credential + (i * 8), 8));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
PrintAndLogEx(INFO, "Write block %d/0x0%x ( " _RED_("fail") " )", 6 + i, 6 + i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isok;
|
return isok;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue