updated nrf24 sniffer & mousejacker

This commit is contained in:
Sil 333033
2023-07-16 16:27:15 +02:00
parent caa1bc9253
commit 9f94f2aa82
7 changed files with 92 additions and 39 deletions

View File

@@ -517,4 +517,14 @@ uint8_t nrf24_find_channel(
}
return ch;
}
bool nrf24_check_connected(FuriHalSpiBusHandle* handle) {
uint8_t status = nrf24_status(handle);
if(status != 0x00) {
return true;
} else {
return false;
}
}

View File

@@ -361,6 +361,13 @@ void int32_to_bytes(uint32_t val, uint8_t* out, bool bigendian);
*/
uint32_t bytes_to_int32(uint8_t* bytes, bool bigendian);
/** Check if the nrf24 is connected
* @param handle - pointer to FuriHalSpiHandle
*
* @return true if connected, otherwise false
*/
bool nrf24_check_connected(FuriHalSpiBusHandle* handle);
#ifdef __cplusplus
}
#endif

View File

@@ -11,11 +11,11 @@
#define LOGITECH_MAX_CHANNEL 85
#define COUNT_THRESHOLD 2
#define DEFAULT_SAMPLE_TIME 8000
#define DEFAULT_SAMPLE_TIME 4000
#define MAX_ADDRS 100
#define MAX_CONFIRMED 32
#define NRFSNIFF_APP_PATH_FOLDER STORAGE_APP_DATA_PATH_PREFIX
#define NRFSNIFF_APP_PATH_FOLDER EXT_PATH("apps_data/nrf24sniff")
#define NRFSNIFF_APP_FILENAME "addresses.txt"
#define TAG "nrfsniff"
@@ -346,6 +346,10 @@ int32_t nrfsniff_app(void* p) {
storage_common_migrate(storage, EXT_PATH("nrfsniff"), NRFSNIFF_APP_PATH_FOLDER);
storage_common_mkdir(storage, NRFSNIFF_APP_PATH_FOLDER);
while(!furi_hal_speaker_acquire(100)) {
furi_delay_ms(100);
}
PluginEvent event;
for(bool processing = true; processing;) {
FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
@@ -390,13 +394,21 @@ int32_t nrfsniff_app(void* p) {
break;
case InputKeyOk:
// toggle sniffing
sniffing_state = !sniffing_state;
if(sniffing_state) {
clear_cache();
start_sniffing();
start = furi_get_tick();
} else
wrap_up(storage, notification);
if(nrf24_check_connected(nrf24_HANDLE)) {
sniffing_state = !sniffing_state;
if(sniffing_state) {
clear_cache();
start_sniffing();
start = furi_get_tick();
} else {
wrap_up(storage, notification);
}
} else {
furi_hal_speaker_start(100, 100);
furi_delay_ms(100);
furi_hal_speaker_stop();
}
break;
case InputKeyBack:
if(event.input.type == InputTypeLong) processing = false;
@@ -445,6 +457,7 @@ int32_t nrfsniff_app(void* p) {
target_rate = 8; // rate can be either 8 (2Mbps) or 0 (1Mbps)
sniffing_state = false;
nrf24_deinit();
furi_hal_speaker_release();
view_port_enabled_set(view_port, false);
gui_remove_view_port(gui, view_port);
furi_record_close(RECORD_GUI);