Merge branch 'master' into bruteforce-smart-mode

This commit is contained in:
PhaseLoop 2024-01-13 16:53:05 +00:00
commit 8e0e8e2240
1273 changed files with 74746 additions and 17013 deletions

View file

@ -634,7 +634,7 @@ static int login(uint32_t password) {
}
// searching for password using chosen bruteforce algorithm
static bool brute(em4x50_data_t *etd, uint32_t *pwd) {
static bool brute(const em4x50_data_t *etd, uint32_t *pwd) {
generator_context_t ctx;
bool pwd_found = false;
@ -698,7 +698,7 @@ static bool brute(em4x50_data_t *etd, uint32_t *pwd) {
}
// login into EM4x50
void em4x50_login(uint32_t *password, bool ledcontrol) {
void em4x50_login(const uint32_t *password, bool ledcontrol) {
em4x50_setup_read();
int status = PM3_EFAILED;
@ -717,7 +717,7 @@ void em4x50_login(uint32_t *password, bool ledcontrol) {
}
// invoke password search
void em4x50_brute(em4x50_data_t *etd, bool ledcontrol) {
void em4x50_brute(const em4x50_data_t *etd, bool ledcontrol) {
em4x50_setup_read();
bool bsuccess = false;
@ -737,7 +737,7 @@ void em4x50_brute(em4x50_data_t *etd, bool ledcontrol) {
}
// check passwords from dictionary content in flash memory
void em4x50_chk(uint8_t *filename, bool ledcontrol) {
void em4x50_chk(const char *filename, bool ledcontrol) {
int status = PM3_EFAILED;
uint32_t pwd = 0x0;
@ -747,11 +747,11 @@ void em4x50_chk(uint8_t *filename, bool ledcontrol) {
int changed = rdv40_spiffs_lazy_mount();
uint16_t pwd_count = 0;
uint32_t size = size_in_spiffs((char *)filename);
uint32_t size = size_in_spiffs(filename);
pwd_count = size / 4;
uint8_t *pwds = BigBuf_malloc(size);
rdv40_spiffs_read_as_filetype((char *)filename, pwds, size, RDV40_SPIFFS_SAFETY_SAFE);
rdv40_spiffs_read_as_filetype(filename, pwds, size, RDV40_SPIFFS_SAFETY_SAFE);
if (changed)
rdv40_spiffs_lazy_unmount();
@ -877,7 +877,7 @@ static int selective_read(uint32_t addresses, uint32_t *words) {
}
// reads by using "selective read mode" -> bidirectional communication
void em4x50_read(em4x50_data_t *etd, bool ledcontrol) {
void em4x50_read(const em4x50_data_t *etd, bool ledcontrol) {
int status = PM3_EFAILED;
uint32_t words[EM4X50_NO_WORDS] = {0x0};
@ -910,7 +910,7 @@ void em4x50_read(em4x50_data_t *etd, bool ledcontrol) {
}
// collects as much information as possible via selective read mode
void em4x50_info(em4x50_data_t *etd, bool ledcontrol) {
void em4x50_info(const em4x50_data_t *etd, bool ledcontrol) {
int status = PM3_EFAILED;
uint32_t words[EM4X50_NO_WORDS] = {0x0};
@ -1057,7 +1057,7 @@ static int write_password(uint32_t password, uint32_t new_password) {
// write operation process for EM4x50 tag,
// single word is written to given address, verified by selective read operation
// wrong password -> return with PM3_EFAILED
void em4x50_write(em4x50_data_t *etd, bool ledcontrol) {
void em4x50_write(const em4x50_data_t *etd, bool ledcontrol) {
int status = PM3_EFAILED;
uint32_t words[EM4X50_NO_WORDS] = {0x0};
@ -1117,7 +1117,7 @@ void em4x50_write(em4x50_data_t *etd, bool ledcontrol) {
}
// simple change of password
void em4x50_writepwd(em4x50_data_t *etd, bool ledcontrol) {
void em4x50_writepwd(const em4x50_data_t *etd, bool ledcontrol) {
int status = PM3_EFAILED;
em4x50_setup_read();
@ -1362,7 +1362,7 @@ static bool em4x50_sim_read_word(uint32_t *word) {
}
// check if reader requests receive mode (rm) by sending two zeros
static int check_rm_request(uint32_t *tag, bool ledcontrol) {
static int check_rm_request(const uint32_t *tag, bool ledcontrol) {
// look for first zero
int bit = em4x50_sim_read_bit();
@ -1391,7 +1391,7 @@ static int check_rm_request(uint32_t *tag, bool ledcontrol) {
}
// send single listen window in simulation mode
static int em4x50_sim_send_listen_window(uint32_t *tag, bool ledcontrol) {
static int em4x50_sim_send_listen_window(const uint32_t *tag, bool ledcontrol) {
SHORT_COIL();
wait_cycles(EM4X50_T_TAG_HALF_PERIOD);
@ -1464,7 +1464,7 @@ static void em4x50_sim_send_nak(void) {
}
// standard read mode process (simulation mode)
static int em4x50_sim_handle_standard_read_command(uint32_t *tag, bool ledcontrol) {
static int em4x50_sim_handle_standard_read_command(const uint32_t *tag, bool ledcontrol) {
// extract control data
int fwr = reflect32(tag[EM4X50_CONTROL]) & 0xFF; // first word read
@ -1504,7 +1504,7 @@ static int em4x50_sim_handle_standard_read_command(uint32_t *tag, bool ledcontro
}
// selective read mode process (simulation mode)
static int em4x50_sim_handle_selective_read_command(uint32_t *tag, bool ledcontrol) {
static int em4x50_sim_handle_selective_read_command(const uint32_t *tag, bool ledcontrol) {
// read password
uint32_t address = 0;
@ -1559,7 +1559,7 @@ static int em4x50_sim_handle_selective_read_command(uint32_t *tag, bool ledcontr
}
// login process (simulation mode)
static int em4x50_sim_handle_login_command(uint32_t *tag, bool ledcontrol) {
static int em4x50_sim_handle_login_command(const uint32_t *tag, bool ledcontrol) {
// read password
uint32_t password = 0;
@ -1585,7 +1585,7 @@ static int em4x50_sim_handle_login_command(uint32_t *tag, bool ledcontrol) {
}
// reset process (simulation mode)
static int em4x50_sim_handle_reset_command(uint32_t *tag, bool ledcontrol) {
static int em4x50_sim_handle_reset_command(const uint32_t *tag, bool ledcontrol) {
// processing pause time (corresponds to a "1" bit)
em4x50_sim_send_bit(1);
@ -1810,7 +1810,7 @@ void em4x50_handle_commands(int *command, uint32_t *tag, bool ledcontrol) {
// simulate uploaded data in emulator memory
// LED C -> reader command has been detected
// LED D -> operations that require authentication are possible
void em4x50_sim(uint32_t *password, bool ledcontrol) {
void em4x50_sim(const uint32_t *password, bool ledcontrol) {
int command = PM3_ENODATA;