mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
commit
dc8c3e70fa
1 changed files with 9 additions and 4 deletions
|
@ -53,31 +53,36 @@ static uint8_t uid[10];
|
||||||
static bool ecfill_from_file(char *inputfile) {
|
static bool ecfill_from_file(char *inputfile) {
|
||||||
|
|
||||||
if (exists_in_spiffs(inputfile)) {
|
if (exists_in_spiffs(inputfile)) {
|
||||||
|
|
||||||
uint32_t size = size_in_spiffs(inputfile);
|
uint32_t size = size_in_spiffs(inputfile);
|
||||||
uint8_t *mem = BigBuf_malloc(size);
|
uint8_t *mem = BigBuf_malloc(size);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
Dbprintf(_RED_("No memory!"));
|
Dbprintf(_RED_("No memory!"));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//read dumpfile
|
||||||
Dbprintf(_YELLOW_("Found dump file %s"), inputfile);
|
Dbprintf(_YELLOW_("Found dump file %s"), inputfile);
|
||||||
rdv40_spiffs_read_as_filetype(inputfile, mem, size, RDV40_SPIFFS_SAFETY_SAFE);
|
rdv40_spiffs_read_as_filetype(inputfile, mem, size, RDV40_SPIFFS_SAFETY_SAFE);
|
||||||
|
|
||||||
|
//check dumpfile size
|
||||||
Dbprintf(_YELLOW_("File size is %d"), size);
|
Dbprintf(_YELLOW_("File size is %d"), size);
|
||||||
if (size != DUMP_SIZE) {
|
if (size != DUMP_SIZE) {
|
||||||
Dbprintf(_RED_("Only support Mifare Classic 1K! Please check the dumpfile"));
|
Dbprintf(_RED_("Only support Mifare Classic 1K! Please check the dumpfile"));
|
||||||
|
BigBuf_free();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//load the dump into emulator memory
|
||||||
Dbprintf(_YELLOW_("Read card data from input file"));
|
Dbprintf(_YELLOW_("Read card data from input file"));
|
||||||
emlSetMem(mem, 0, MIFARE_1K_MAXBLOCK);
|
emlSetMem(mem, 0, MIFARE_1K_MAXBLOCK);
|
||||||
Dbprintf(_YELLOW_("Uploaded to emulator memory"));
|
Dbprintf(_YELLOW_("Uploaded to emulator memory"));
|
||||||
|
BigBuf_free_keep_EM();
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
Dbprintf(_RED_("no input file %s"), inputfile);
|
Dbprintf(_RED_("no input file %s"), inputfile);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
BigBuf_free();
|
return false;//Shouldn't be here
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModInfo(void) {
|
void ModInfo(void) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue