mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
Upload also iClass and T55XX keys to spiffs files
This commit is contained in:
parent
dd646a64a6
commit
470536f0fd
1 changed files with 17 additions and 22 deletions
|
@ -261,39 +261,32 @@ static int CmdFlashMemLoad(const char *Cmd) {
|
||||||
strcpy_s(spiffsDest, 32, MF_KEYS_FILE);
|
strcpy_s(spiffsDest, 32, MF_KEYS_FILE);
|
||||||
break;
|
break;
|
||||||
case DICTIONARY_T55XX:
|
case DICTIONARY_T55XX:
|
||||||
offset = DEFAULT_T55XX_KEYS_OFFSET_P(spi_flash_pages);
|
keylen = T55XX_KEY_LENGTH;
|
||||||
keylen = 4;
|
res = loadFileDICTIONARY(filename, data, &datalen, keylen, &keycount);
|
||||||
res = loadFileDICTIONARY(filename, data + 2, &datalen, keylen, &keycount);
|
|
||||||
if (res || !keycount) {
|
if (res || !keycount) {
|
||||||
free(data);
|
free(data);
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
// limited space on flash mem
|
if (datalen > FLASH_MEM_MAX_SIZE_P(spi_flash_pages)) {
|
||||||
if (keycount > DEFAULT_T55XX_KEYS_MAX) {
|
PrintAndLogEx(ERR, "error, filesize is larger than available memory");
|
||||||
keycount = DEFAULT_T55XX_KEYS_MAX;
|
free(data);
|
||||||
datalen = keycount * keylen;
|
return PM3_EOVFLOW;
|
||||||
}
|
}
|
||||||
|
strcpy_s(spiffsDest, 32, T55XX_KEYS_FILE);
|
||||||
data[0] = (keycount >> 0) & 0xFF;
|
|
||||||
data[1] = (keycount >> 8) & 0xFF;
|
|
||||||
datalen += 2;
|
|
||||||
break;
|
break;
|
||||||
case DICTIONARY_ICLASS:
|
case DICTIONARY_ICLASS:
|
||||||
offset = DEFAULT_ICLASS_KEYS_OFFSET_P(spi_flash_pages);
|
keylen = ICLASS_KEY_LENGTH;
|
||||||
res = loadFileDICTIONARY(filename, data + 2, &datalen, keylen, &keycount);
|
res = loadFileDICTIONARY(filename, data, &datalen, keylen, &keycount);
|
||||||
if (res || !keycount) {
|
if (res || !keycount) {
|
||||||
free(data);
|
free(data);
|
||||||
return PM3_EFILE;
|
return PM3_EFILE;
|
||||||
}
|
}
|
||||||
// limited space on flash mem
|
if (datalen > FLASH_MEM_MAX_SIZE_P(spi_flash_pages)) {
|
||||||
if (keycount > DEFAULT_ICLASS_KEYS_MAX) {
|
PrintAndLogEx(ERR, "error, filesize is larger than available memory");
|
||||||
keycount = DEFAULT_ICLASS_KEYS_MAX;
|
free(data);
|
||||||
datalen = keycount * keylen;
|
return PM3_EOVFLOW;
|
||||||
}
|
}
|
||||||
|
strcpy_s(spiffsDest, 32, ICLASS_KEYS_FILE);
|
||||||
data[0] = (keycount >> 0) & 0xFF;
|
|
||||||
data[1] = (keycount >> 8) & 0xFF;
|
|
||||||
datalen += 2;
|
|
||||||
break;
|
break;
|
||||||
case DICTIONARY_NONE:
|
case DICTIONARY_NONE:
|
||||||
res = loadFile_safe(filename, ".bin", (void **)&data, &datalen);
|
res = loadFile_safe(filename, ".bin", (void **)&data, &datalen);
|
||||||
|
@ -324,7 +317,7 @@ static int CmdFlashMemLoad(const char *Cmd) {
|
||||||
uint32_t bytes_remaining = datalen;
|
uint32_t bytes_remaining = datalen;
|
||||||
|
|
||||||
// we will treat dictionary files as spiffs files, so we need to handle this here
|
// we will treat dictionary files as spiffs files, so we need to handle this here
|
||||||
if (d == DICTIONARY_MIFARE) {
|
if (d != DICTIONARY_NONE) {
|
||||||
res = flashmem_spiffs_load(spiffsDest, data, datalen);
|
res = flashmem_spiffs_load(spiffsDest, data, datalen);
|
||||||
if (res != PM3_SUCCESS) {
|
if (res != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(FAILED, "Failed writing passwrods to file %s", spiffsDest);
|
PrintAndLogEx(FAILED, "Failed writing passwrods to file %s", spiffsDest);
|
||||||
|
@ -332,6 +325,8 @@ static int CmdFlashMemLoad(const char *Cmd) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
PrintAndLogEx(SUCCESS, "Wrote "_GREEN_("%u")" passwords to file "_GREEN_("%s"), keycount, spiffsDest);
|
PrintAndLogEx(SUCCESS, "Wrote "_GREEN_("%u")" passwords to file "_GREEN_("%s"), keycount, spiffsDest);
|
||||||
|
SendCommandNG(CMD_SPIFFS_UNMOUNT, NULL, 0);
|
||||||
|
SendCommandNG(CMD_SPIFFS_MOUNT, NULL, 0);
|
||||||
} else {
|
} else {
|
||||||
// fast push mode
|
// fast push mode
|
||||||
g_conn.block_after_ACK = true;
|
g_conn.block_after_ACK = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue