mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
Make sure MFC dumps & keys are saved in the dump user pref path
This commit is contained in:
parent
c66834f19c
commit
02f0b1bcdd
3 changed files with 7 additions and 4 deletions
|
@ -460,7 +460,7 @@ static int mf_save_keys_from_arr(uint16_t n, uint8_t *d) {
|
||||||
|
|
||||||
char fn[FILE_PATH_SIZE] = {0};
|
char fn[FILE_PATH_SIZE] = {0};
|
||||||
snprintf(fn, sizeof(fn), "hf-mf-%s-key", sprint_hex_inrow(d, 4));
|
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);
|
free(keys);
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,12 +261,14 @@ void truncate_filename(char *fn, uint16_t maxlen) {
|
||||||
|
|
||||||
// --------- SAVE FILES
|
// --------- SAVE FILES
|
||||||
int saveFile(const char *preferredName, const char *suffix, const void *data, size_t datalen) {
|
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) {
|
if (data == NULL || datalen == 0) {
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *fileName = newfilenamemcopy(preferredName, suffix);
|
char *fileName = newfilenamemcopyEx(preferredName, suffix, e_save_path);
|
||||||
if (fileName == NULL) {
|
if (fileName == NULL) {
|
||||||
return PM3_EMALLOC;
|
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...");
|
PrintAndLogEx(INFO, "No data to save, skipping...");
|
||||||
return PM3_EINVARG;
|
return PM3_EINVARG;
|
||||||
}
|
}
|
||||||
saveFile(fn, ".bin", d, n);
|
saveFileEx(fn, ".bin", d, n, spDump);
|
||||||
|
|
||||||
iso14a_mf_extdump_t jd = {0};
|
iso14a_mf_extdump_t jd = {0};
|
||||||
jd.card_info.ats_len = 0;
|
jd.card_info.ats_len = 0;
|
||||||
|
|
|
@ -125,6 +125,7 @@ void truncate_filename(char *fn, uint16_t maxlen);
|
||||||
* @return 0 for ok, 1 for failz
|
* @return 0 for ok, 1 for failz
|
||||||
*/
|
*/
|
||||||
int saveFile(const char *preferredName, const char *suffix, const void *data, size_t datalen);
|
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
|
/** STUB
|
||||||
* @brief Utility function to save JSON data to a file. This method takes a preferred name, but if that
|
* @brief Utility function to save JSON data to a file. This method takes a preferred name, but if that
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue