diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index be3e3fa23..954b4209e 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -460,7 +460,7 @@ static int mf_save_keys_from_arr(uint16_t n, uint8_t *d) { char fn[FILE_PATH_SIZE] = {0}; snprintf(fn, sizeof(fn), "hf-mf-%s-key", sprint_hex_inrow(d, 4)); - saveFile(fn, ".bin", keys, keysize); + saveFileEx(fn, ".bin", keys, keysize, spDump); free(keys); return PM3_SUCCESS; } diff --git a/client/src/fileutils.c b/client/src/fileutils.c index f93c15aa1..481c872cc 100644 --- a/client/src/fileutils.c +++ b/client/src/fileutils.c @@ -261,12 +261,14 @@ void truncate_filename(char *fn, uint16_t maxlen) { // --------- SAVE FILES int saveFile(const char *preferredName, const char *suffix, const void *data, size_t datalen) { - + return saveFileEx(preferredName, suffix, data, datalen, spDefault); +} +int saveFileEx(const char *preferredName, const char *suffix, const void *data, size_t datalen, savePaths_t e_save_path) { if (data == NULL || datalen == 0) { return PM3_EINVARG; } - char *fileName = newfilenamemcopy(preferredName, suffix); + char *fileName = newfilenamemcopyEx(preferredName, suffix, e_save_path); if (fileName == NULL) { return PM3_EMALLOC; } @@ -3135,7 +3137,7 @@ int pm3_save_mf_dump(const char *fn, uint8_t *d, size_t n, JSONFileType jsft) { PrintAndLogEx(INFO, "No data to save, skipping..."); return PM3_EINVARG; } - saveFile(fn, ".bin", d, n); + saveFileEx(fn, ".bin", d, n, spDump); iso14a_mf_extdump_t jd = {0}; jd.card_info.ats_len = 0; diff --git a/client/src/fileutils.h b/client/src/fileutils.h index 023820f64..ae04b8265 100644 --- a/client/src/fileutils.h +++ b/client/src/fileutils.h @@ -125,6 +125,7 @@ void truncate_filename(char *fn, uint16_t maxlen); * @return 0 for ok, 1 for failz */ int saveFile(const char *preferredName, const char *suffix, const void *data, size_t datalen); +int saveFileEx(const char *preferredName, const char *suffix, const void *data, size_t datalen, savePaths_t e_save_path); /** STUB * @brief Utility function to save JSON data to a file. This method takes a preferred name, but if that