mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
[RDV4] Readed IDs store to file in spiffs
This commit is contained in:
parent
311f43172f
commit
097595cdef
1 changed files with 54 additions and 21 deletions
|
@ -5,12 +5,16 @@
|
||||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||||
// the license.
|
// the license.
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// LF rwc - This mode can simulate tag ID from selected slot and read tag ID
|
// LF rwc - This mode can simulate ID from selected slot, read ID to
|
||||||
// to selected slot and to flash (only RDV4). Also you can set
|
// selected slot, write from selected slot to T5555 tag and store
|
||||||
// predefined IDs in any slot.
|
// readed ID to flash (only RDV4). Also you can set predefined IDs
|
||||||
|
// in any slot.
|
||||||
// To recall stored ID from flash execute:
|
// To recall stored ID from flash execute:
|
||||||
// mem dump o offset l 5 p
|
// mem spifss dump o emdump p
|
||||||
// where offset = 5 * selected slot
|
// or:
|
||||||
|
// mem spifss dump o emdump f emdump
|
||||||
|
// then from shell:
|
||||||
|
// hexdump emdump -e '5/1 "%02X" /0 "\n"'
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#include "standalone.h"
|
#include "standalone.h"
|
||||||
#include "proxmark3_arm.h"
|
#include "proxmark3_arm.h"
|
||||||
|
@ -22,6 +26,7 @@
|
||||||
#include "ticks.h"
|
#include "ticks.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "BigBuf.h"
|
#include "BigBuf.h"
|
||||||
|
#include "spiffs.h"
|
||||||
|
|
||||||
#ifdef WITH_FLASH
|
#ifdef WITH_FLASH
|
||||||
#include "flashmem.h"
|
#include "flashmem.h"
|
||||||
|
@ -33,13 +38,13 @@
|
||||||
// low & high - array for storage IDs. Its length must be equal.
|
// low & high - array for storage IDs. Its length must be equal.
|
||||||
// Predefined IDs must be stored in low[].
|
// Predefined IDs must be stored in low[].
|
||||||
// In high[] must be nulls
|
// In high[] must be nulls
|
||||||
uint64_t low[] = {0x565AF781C7,0x540053E4E2,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
uint64_t low[] = {0x565AF781C7,0x540053E4E2,0x1234567890,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
uint32_t high[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
uint32_t high[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
uint8_t *bba,slots_count;
|
uint8_t *bba,slots_count;
|
||||||
int buflen;
|
int buflen;
|
||||||
|
|
||||||
void ModInfo(void) {
|
void ModInfo(void) {
|
||||||
DbpString(" LF EM4100 read/write/clone standalone mode");
|
DbpString(" LF EM4100 simulate standalone V2");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t ReversQuads(uint64_t bits){
|
uint64_t ReversQuads(uint64_t bits){
|
||||||
|
@ -99,11 +104,16 @@ void FlashLEDs(uint32_t speed, uint8_t times) {
|
||||||
|
|
||||||
#ifdef WITH_FLASH
|
#ifdef WITH_FLASH
|
||||||
void SaveIDtoFlash (int addr, uint64_t id) {
|
void SaveIDtoFlash (int addr, uint64_t id) {
|
||||||
uint8_t b, *ptr;
|
uint8_t bt[5];
|
||||||
|
char *filename = "emdump";
|
||||||
|
rdv40_spiffs_mount();
|
||||||
for (int i = 0; i < 5; i++) {
|
for (int i = 0; i < 5; i++) {
|
||||||
b = (uint8_t) (id >> 8 * i & 0xff);
|
bt[4-i] = (uint8_t) (id >> 8 * i & 0xff);
|
||||||
ptr = &b;
|
}
|
||||||
Flash_WriteData(addr * 5 + 4 - i,ptr,1);
|
if (exists_in_spiffs(filename) == false){
|
||||||
|
rdv40_spiffs_write(filename, &bt[0], 5, RDV40_SPIFFS_SAFETY_NORMAL);
|
||||||
|
} else {
|
||||||
|
rdv40_spiffs_append(filename, &bt[0], 5, RDV40_SPIFFS_SAFETY_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -112,9 +122,10 @@ void RunMod() {
|
||||||
StandAloneMode();
|
StandAloneMode();
|
||||||
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
FpgaDownloadAndGo(FPGA_BITSTREAM_LF);
|
||||||
int selected = 0;
|
int selected = 0;
|
||||||
//state 0 - select slot,
|
//state 0 - select slot
|
||||||
// 1 - read tag to selected slot,
|
// 1 - read tag to selected slot,
|
||||||
// 2 - simulate tag from selected slot
|
// 2 - simulate tag from selected slot
|
||||||
|
// 3 - write to T5555 tag
|
||||||
uint8_t state = 0;
|
uint8_t state = 0;
|
||||||
slots_count = sizeof(low)/sizeof(low[0]);
|
slots_count = sizeof(low)/sizeof(low[0]);
|
||||||
bba = BigBuf_get_addr();
|
bba = BigBuf_get_addr();
|
||||||
|
@ -130,7 +141,7 @@ void RunMod() {
|
||||||
if (button_pressed == 1) {
|
if (button_pressed == 1) {
|
||||||
// Long press - switch to simulate mode
|
// Long press - switch to simulate mode
|
||||||
SpinUp(100);
|
SpinUp(100);
|
||||||
SpinOff(100);
|
LED_Slot(selected);
|
||||||
state = 2;
|
state = 2;
|
||||||
} else if (button_pressed < 0) {
|
} else if (button_pressed < 0) {
|
||||||
// Click - switch to next slot
|
// Click - switch to next slot
|
||||||
|
@ -139,13 +150,21 @@ void RunMod() {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
// Read mode. Click - exit to select mode
|
// Read mode.
|
||||||
CmdEM410xdemod(1, &high[selected], &low[selected], 0);
|
if (button_pressed > 0) {
|
||||||
FlashLEDs(100,5);
|
// Long press - switch to read mode
|
||||||
#ifdef WITH_FLASH
|
SpinUp(100);
|
||||||
SaveIDtoFlash(selected, low[selected]);
|
LED_Slot(selected);
|
||||||
#endif
|
state = 3;
|
||||||
state = 0;
|
} else if (button_pressed < 0) {
|
||||||
|
// Click - exit to select mode
|
||||||
|
CmdEM410xdemod(1, &high[selected], &low[selected], 0);
|
||||||
|
FlashLEDs(100,5);
|
||||||
|
#ifdef WITH_FLASH
|
||||||
|
SaveIDtoFlash(selected, low[selected]);
|
||||||
|
#endif
|
||||||
|
state = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
// Simulate mode
|
// Simulate mode
|
||||||
|
@ -155,7 +174,7 @@ void RunMod() {
|
||||||
LED_Slot(selected);
|
LED_Slot(selected);
|
||||||
state = 1;
|
state = 1;
|
||||||
} else if (button_pressed < 0) {
|
} else if (button_pressed < 0) {
|
||||||
// Click - start simulating. Click again to exit from simelate mode
|
// Click - start simulating. Click again to exit from simulate mode
|
||||||
LED_Slot(selected);
|
LED_Slot(selected);
|
||||||
ConstructEM410xEmulBuf(ReversQuads(low[selected]));
|
ConstructEM410xEmulBuf(ReversQuads(low[selected]));
|
||||||
FlashLEDs(100,5);
|
FlashLEDs(100,5);
|
||||||
|
@ -164,6 +183,20 @@ void RunMod() {
|
||||||
state = 0; // Switch to select mode
|
state = 0; // Switch to select mode
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
// Write tag mode
|
||||||
|
if (button_pressed > 0) {
|
||||||
|
// Long press - switch to select mode
|
||||||
|
SpinDown(100);
|
||||||
|
LED_Slot(selected);
|
||||||
|
state = 0;
|
||||||
|
} else if (button_pressed < 0) {
|
||||||
|
// Click - write ID to tag
|
||||||
|
WriteEM410x(0, (uint32_t) (low[selected] >> 32), (uint32_t) (low[selected] & 0xffffffff));
|
||||||
|
LED_Slot(selected);
|
||||||
|
state = 0; // Switch to select mode
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue