mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 13:23:51 -07:00
renamed std_read -> stdread
This commit is contained in:
parent
35a671d592
commit
098ca87c81
6 changed files with 19 additions and 31 deletions
|
@ -1126,8 +1126,8 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
em4x50_sim();
|
em4x50_sim();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_LF_EM4X50_STD_READ: {
|
case CMD_LF_EM4X50_STDREAD: {
|
||||||
em4x50_std_read();
|
em4x50_stdread();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_LF_EM4X50_ESET: {
|
case CMD_LF_EM4X50_ESET: {
|
||||||
|
|
|
@ -122,22 +122,6 @@ static void em4x50_setup_sim(void) {
|
||||||
AT91C_BASE_PIOA->PIO_ODR = GPIO_SSC_CLK;
|
AT91C_BASE_PIOA->PIO_ODR = GPIO_SSC_CLK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void emlGetMem(uint32_t *words, size_t nowords) {
|
|
||||||
|
|
||||||
// read <nowords> words from emulator memory
|
|
||||||
|
|
||||||
uint8_t *em4x50_mem = BigBuf_get_EM_addr();
|
|
||||||
|
|
||||||
for (int i = 0; i < EM4X50_NO_WORDS; i++) {
|
|
||||||
|
|
||||||
for (int j = 0; j < 4; j++)
|
|
||||||
words[i] |= (em4x50_mem[4 * i + j]) << ((3 - j) * 8);
|
|
||||||
|
|
||||||
// lsb is needed (given format is msb)
|
|
||||||
words[i] = reflect32(words[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// functions for "reader" use case
|
// functions for "reader" use case
|
||||||
|
|
||||||
static bool get_signalproperties(void) {
|
static bool get_signalproperties(void) {
|
||||||
|
@ -1346,6 +1330,7 @@ void em4x50_restore(em4x50_data_t *etd) {
|
||||||
int res = 0;
|
int res = 0;
|
||||||
int start_word = 0;
|
int start_word = 0;
|
||||||
uint8_t status = 0;
|
uint8_t status = 0;
|
||||||
|
uint8_t *em4x50_mem = BigBuf_get_EM_addr();
|
||||||
uint32_t addresses = 0x00001F01; // from fwr = 1 to lwr = 31 (0x1F)
|
uint32_t addresses = 0x00001F01; // from fwr = 1 to lwr = 31 (0x1F)
|
||||||
uint32_t words_client[EM4X50_NO_WORDS] = {0x0};
|
uint32_t words_client[EM4X50_NO_WORDS] = {0x0};
|
||||||
uint32_t words_read[EM4X50_NO_WORDS] = {0x0};
|
uint32_t words_read[EM4X50_NO_WORDS] = {0x0};
|
||||||
|
@ -1353,7 +1338,8 @@ void em4x50_restore(em4x50_data_t *etd) {
|
||||||
em4x50_setup_read();
|
em4x50_setup_read();
|
||||||
|
|
||||||
// read data from emulator memory
|
// read data from emulator memory
|
||||||
emlGetMem(words_client, EM4X50_NO_WORDS);
|
for (int i = 0; i < EM4X50_NO_WORDS; i++)
|
||||||
|
words_client[i] = reflect32(bytes_to_num(em4x50_mem + (i * 4), 4));
|
||||||
|
|
||||||
// set gHigh and gLow
|
// set gHigh and gLow
|
||||||
if (get_signalproperties() && find_em4x50_tag()) {
|
if (get_signalproperties() && find_em4x50_tag()) {
|
||||||
|
@ -1403,12 +1389,14 @@ void em4x50_sim(void) {
|
||||||
// simulate uploaded data in emulator memory
|
// simulate uploaded data in emulator memory
|
||||||
// (currently only a one-way communication is possible)
|
// (currently only a one-way communication is possible)
|
||||||
|
|
||||||
|
uint8_t *em4x50_mem = BigBuf_get_EM_addr();
|
||||||
uint32_t words[EM4X50_NO_WORDS] = {0x0};
|
uint32_t words[EM4X50_NO_WORDS] = {0x0};
|
||||||
|
|
||||||
em4x50_setup_sim();
|
em4x50_setup_sim();
|
||||||
|
|
||||||
// read data from emulator memory
|
// read data from emulator memory
|
||||||
emlGetMem(words, EM4X50_NO_WORDS);
|
for (int i = 0; i < EM4X50_NO_WORDS; i++)
|
||||||
|
words[i] = reflect32(bytes_to_num(em4x50_mem + (i * 4), 4));
|
||||||
|
|
||||||
// extract control data
|
// extract control data
|
||||||
int fwr = words[CONFIG_BLOCK] & 0xFF; // first word read
|
int fwr = words[CONFIG_BLOCK] & 0xFF; // first word read
|
||||||
|
@ -1437,7 +1425,7 @@ void em4x50_sim(void) {
|
||||||
reply_ng(CMD_LF_EM4X50_SIM, 1, 0, 0);
|
reply_ng(CMD_LF_EM4X50_SIM, 1, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void em4x50_std_read(void) {
|
void em4x50_stdread(void) {
|
||||||
|
|
||||||
// reads data that tag transmits "voluntarily" -> standard read mode
|
// reads data that tag transmits "voluntarily" -> standard read mode
|
||||||
|
|
||||||
|
@ -1452,5 +1440,5 @@ void em4x50_std_read(void) {
|
||||||
|
|
||||||
LOW(GPIO_SSC_DOUT);
|
LOW(GPIO_SSC_DOUT);
|
||||||
lf_finalize();
|
lf_finalize();
|
||||||
reply_ng(CMD_LF_EM4X50_STD_READ, now, (uint8_t *)words, 4 * now);
|
reply_ng(CMD_LF_EM4X50_STDREAD, now, (uint8_t *)words, 4 * now);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,6 @@ void em4x50_reset(void);
|
||||||
void em4x50_watch(void);
|
void em4x50_watch(void);
|
||||||
void em4x50_restore(em4x50_data_t *etd);
|
void em4x50_restore(em4x50_data_t *etd);
|
||||||
void em4x50_sim(void);
|
void em4x50_sim(void);
|
||||||
void em4x50_std_read(void);
|
void em4x50_stdread(void);
|
||||||
|
|
||||||
#endif /* EM4X50_H */
|
#endif /* EM4X50_H */
|
||||||
|
|
|
@ -663,7 +663,7 @@ static command_t CommandTable[] = {
|
||||||
{"4x50_watch", CmdEM4x50Watch, IfPm3EM4x50, "read EM4x50 continously"},
|
{"4x50_watch", CmdEM4x50Watch, IfPm3EM4x50, "read EM4x50 continously"},
|
||||||
{"4x50_restore",CmdEM4x50Restore, IfPm3EM4x50, "restore EM4x50 dump to tag"},
|
{"4x50_restore",CmdEM4x50Restore, IfPm3EM4x50, "restore EM4x50 dump to tag"},
|
||||||
{"4x50_sim", CmdEM4x50Sim, IfPm3EM4x50, "simulate single EM4x50 word (uid)"},
|
{"4x50_sim", CmdEM4x50Sim, IfPm3EM4x50, "simulate single EM4x50 word (uid)"},
|
||||||
{"4x50_std_read",CmdEM4x50StdRead, IfPm3EM4x50, "show standard read mode data of EM4x50 tag"},
|
{"4x50_stdread",CmdEM4x50StdRead, IfPm3EM4x50, "show standard read mode data of EM4x50 tag"},
|
||||||
{"4x50_eload", CmdEM4x50ELoad, IfPm3EM4x50, "load a binary dump into emulator memory"},
|
{"4x50_eload", CmdEM4x50ELoad, IfPm3EM4x50, "load a binary dump into emulator memory"},
|
||||||
{"4x50_esave", CmdEM4x50ESave, IfPm3EM4x50, "save emulator memory to file"},
|
{"4x50_esave", CmdEM4x50ESave, IfPm3EM4x50, "save emulator memory to file"},
|
||||||
{NULL, NULL, NULL, NULL}
|
{NULL, NULL, NULL, NULL}
|
||||||
|
|
|
@ -175,7 +175,7 @@ static int usage_lf_em4x50_sim(void) {
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
static int usage_lf_em4x50_std_read(void) {
|
static int usage_lf_em4x50_stdread(void) {
|
||||||
PrintAndLogEx(NORMAL, "Show standard read mode data of EM4x50 tag. Tag must be on antenna.");
|
PrintAndLogEx(NORMAL, "Show standard read mode data of EM4x50 tag. Tag must be on antenna.");
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(NORMAL, "Usage: lf em 4x50_std_read [h]");
|
PrintAndLogEx(NORMAL, "Usage: lf em 4x50_std_read [h]");
|
||||||
|
@ -1168,7 +1168,7 @@ int CmdEM4x50StdRead(const char *Cmd) {
|
||||||
switch (tolower(param_getchar(Cmd, cmdp))) {
|
switch (tolower(param_getchar(Cmd, cmdp))) {
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
return usage_lf_em4x50_std_read();
|
return usage_lf_em4x50_stdread();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
|
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
|
||||||
|
@ -1178,12 +1178,12 @@ int CmdEM4x50StdRead(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errors)
|
if (errors)
|
||||||
return usage_lf_em4x50_std_read();
|
return usage_lf_em4x50_stdread();
|
||||||
|
|
||||||
// start
|
// start
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommandNG(CMD_LF_EM4X50_STD_READ, 0, 0);
|
SendCommandNG(CMD_LF_EM4X50_STDREAD, 0, 0);
|
||||||
if (!WaitForResponseTimeout(CMD_LF_EM4X50_STD_READ, &resp, TIMEOUT)) {
|
if (!WaitForResponseTimeout(CMD_LF_EM4X50_STDREAD, &resp, TIMEOUT)) {
|
||||||
PrintAndLogEx(WARNING, "Timeout while waiting for reply.");
|
PrintAndLogEx(WARNING, "Timeout while waiting for reply.");
|
||||||
return PM3_ETIMEOUT;
|
return PM3_ETIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -514,7 +514,7 @@ typedef struct {
|
||||||
#define CMD_LF_EM4X50_WATCH 0x0248
|
#define CMD_LF_EM4X50_WATCH 0x0248
|
||||||
#define CMD_LF_EM4X50_RESTORE 0x0249
|
#define CMD_LF_EM4X50_RESTORE 0x0249
|
||||||
#define CMD_LF_EM4X50_SIM 0x0250
|
#define CMD_LF_EM4X50_SIM 0x0250
|
||||||
#define CMD_LF_EM4X50_STD_READ 0x0251
|
#define CMD_LF_EM4X50_STDREAD 0x0251
|
||||||
#define CMD_LF_EM4X50_ESET 0x0252
|
#define CMD_LF_EM4X50_ESET 0x0252
|
||||||
// Sampling configuration for LF reader/sniffer
|
// Sampling configuration for LF reader/sniffer
|
||||||
#define CMD_LF_SAMPLING_SET_CONFIG 0x021D
|
#define CMD_LF_SAMPLING_SET_CONFIG 0x021D
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue