fix hf mf cload - now f param is optional

This commit is contained in:
iceman1001 2021-07-24 21:26:55 +02:00
commit fffe46e652
2 changed files with 8 additions and 3 deletions

View file

@ -142,6 +142,7 @@ static int CmdHFEPAPACEReplay(const char *Cmd) {
// fast push mode
conn.block_after_ACK = true;
for (int i = 0; i < ARRAYLEN(apdu_lengths); i++) {
// transfer the APDU in several parts if necessary
for (int j = 0; j * sizeof(data) < apdu_lengths[i]; j++) {
// amount of data in this packet
@ -161,7 +162,10 @@ static int CmdHFEPAPACEReplay(const char *Cmd) {
// arg0: APDU number
// arg1: offset into the APDU
SendCommandOLD(CMD_HF_EPA_REPLAY, i + 1, j * sizeof(data), packet_length, data, packet_length);
WaitForResponse(CMD_ACK, &resp);
if (WaitForResponseTimeout(CMD_HF_EPA_REPLAY, &resp, 2500) == false) {
PrintAndLogEx(WARNING, "command time out");
return PM3_ETIMEOUT;
}
if (resp.oldarg[0] != 0) {
PrintAndLogEx(WARNING, "Transfer of APDU #%d Part %d failed!", i, j);
return PM3_ESOFT;

View file

@ -4372,17 +4372,18 @@ static int CmdHF14AMfCLoad(const char *Cmd) {
);
void *argtable[] = {
arg_param_begin,
arg_str1("f", "file", "<fn>", "filename of dump"),
arg_str0("f", "file", "<fn>", "filename of dump"),
arg_lit0(NULL, "emu", "from emulator memory"),
arg_param_end
};
CLIExecWithReturn(ctx, Cmd, argtable, false);
int fnlen = 0;
char filename[FILE_PATH_SIZE];
char filename[FILE_PATH_SIZE] = {0};
CLIParamStrToBuf(arg_get_str(ctx, 1), (uint8_t *)filename, FILE_PATH_SIZE, &fnlen);
bool fill_from_emulator = arg_get_lit(ctx, 2);
CLIParserFree(ctx);
if (fill_from_emulator) {