From 2ee9349d506a8c31a5f31c17fe3a34d21ff2ad2a Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Wed, 26 Jul 2023 03:48:19 +0200 Subject: [PATCH] Update apps pt2 + Add MAYHEM Evil Portal --- applications/external/airmouse/air_mouse.c | 1 - .../esp32cam_evilportal/application.fam | 15 + .../esp32cam_evilportal/evil_portal_app.c | 133 +++++++++ .../esp32cam_evilportal/evil_portal_app.h | 11 + .../esp32cam_evilportal/evil_portal_app_i.h | 61 ++++ .../evil_portal_custom_event.h | 8 + .../esp32cam_evilportal/evil_portal_uart.c | 149 ++++++++++ .../esp32cam_evilportal/evil_portal_uart.h | 14 + .../helpers/evil_portal_storage.c | 117 ++++++++ .../helpers/evil_portal_storage.h | 20 ++ .../icons/evil_portal_10px.png | Bin 0 -> 156 bytes .../scenes/evil_portal_scene.c | 30 ++ .../scenes/evil_portal_scene.h | 29 ++ .../scenes/evil_portal_scene_config.h | 2 + .../scenes/evil_portal_scene_console_output.c | 147 ++++++++++ .../scenes/evil_portal_scene_start.c | 130 ++++++++ .../esp32cam_morseflasher/application.fam | 1 + .../esp32cam_morseflasher/uart_terminal_app.c | 10 +- .../uart_terminal_app_i.h | 2 + .../uart_terminal_uart.c | 3 - .../external/evil_portal/evil_portal_app.c | 13 + applications/external/flipbip/application.fam | 4 +- applications/external/flipbip/flipbip.h | 2 +- .../external/flipbip/helpers/flipbip_file.c | 16 +- .../external/flipbip/helpers/flipbip_file.h | 7 +- .../external/flipbip/lib/crypto/rand.c | 25 +- .../flipbip/scenes/flipbip_scene_scene_1.c | 2 +- .../external/flipbip/views/flipbip_scene_1.c | 2 +- .../flipbip/views/flipbip_startscreen.c | 2 +- applications/external/multi_fuzzer/todo.md | 44 --- .../rubiks_cube_scrambler/application.fam | 2 +- .../rubiks_cube_scrambler.c | 1 + .../subghz_bruteforcer/application.fam | 1 + .../helpers/gui_top_buttons.h | 5 +- .../helpers/subbrute_worker.c | 38 ++- .../helpers/subbrute_worker.h | 9 +- .../scenes/subbrute_scene_setup_attack.c | 2 +- .../scenes/subbrute_scene_setup_extra.c | 277 ++++++++++++++++-- .../external/subghz_bruteforcer/subbrute.c | 11 + .../subghz_bruteforcer/subbrute_device.c | 2 +- .../external/subghz_bruteforcer/subbrute_i.h | 6 +- .../views/subbrute_attack_view.c | 10 +- .../views/subbrute_main_view.c | 4 + .../external/subghz_remote/application.fam | 2 +- .../subghz_remote/helpers/txrx/Readme.md | 4 + .../{subrem_10px.png => icon.png} | Bin applications/external/wiiec/wii_anal.c | 4 +- 47 files changed, 1249 insertions(+), 129 deletions(-) create mode 100644 applications/external/esp32cam_evilportal/application.fam create mode 100644 applications/external/esp32cam_evilportal/evil_portal_app.c create mode 100644 applications/external/esp32cam_evilportal/evil_portal_app.h create mode 100644 applications/external/esp32cam_evilportal/evil_portal_app_i.h create mode 100644 applications/external/esp32cam_evilportal/evil_portal_custom_event.h create mode 100644 applications/external/esp32cam_evilportal/evil_portal_uart.c create mode 100644 applications/external/esp32cam_evilportal/evil_portal_uart.h create mode 100644 applications/external/esp32cam_evilportal/helpers/evil_portal_storage.c create mode 100644 applications/external/esp32cam_evilportal/helpers/evil_portal_storage.h create mode 100644 applications/external/esp32cam_evilportal/icons/evil_portal_10px.png create mode 100644 applications/external/esp32cam_evilportal/scenes/evil_portal_scene.c create mode 100644 applications/external/esp32cam_evilportal/scenes/evil_portal_scene.h create mode 100644 applications/external/esp32cam_evilportal/scenes/evil_portal_scene_config.h create mode 100644 applications/external/esp32cam_evilportal/scenes/evil_portal_scene_console_output.c create mode 100644 applications/external/esp32cam_evilportal/scenes/evil_portal_scene_start.c delete mode 100644 applications/external/multi_fuzzer/todo.md create mode 100644 applications/external/subghz_remote/helpers/txrx/Readme.md rename applications/external/subghz_remote/{subrem_10px.png => icon.png} (100%) diff --git a/applications/external/airmouse/air_mouse.c b/applications/external/airmouse/air_mouse.c index 6723ed409..64b2274ab 100644 --- a/applications/external/airmouse/air_mouse.c +++ b/applications/external/airmouse/air_mouse.c @@ -2,7 +2,6 @@ #include #include - #include "tracking/imu/imu.h" #define TAG "AirMouseApp" diff --git a/applications/external/esp32cam_evilportal/application.fam b/applications/external/esp32cam_evilportal/application.fam new file mode 100644 index 000000000..190ae711a --- /dev/null +++ b/applications/external/esp32cam_evilportal/application.fam @@ -0,0 +1,15 @@ +App( + appid="mayhem_evil_portal", + name="[MAYHEM] Evil Portal", + apptype=FlipperAppType.EXTERNAL, + entry_point="evil_portal_app", + cdefines=["APP_EVIL_PORTAL"], + requires=["gui"], + stack_size=1 * 1024, + order=90, + fap_icon="icons/evil_portal_10px.png", + fap_category="GPIO", + fap_description="ESP32-CAM evil portal. When users try to connect to this access point they will be served a fake login screen. User credentials are sent to the Flipper and logged on the SD card. [Unplug the USB cable to test with Mayhem]", + fap_author="bigbrodude6119", + fap_weburl="https://github.com/bigbrodude6119/flipper-zero-evil-portal", +) diff --git a/applications/external/esp32cam_evilportal/evil_portal_app.c b/applications/external/esp32cam_evilportal/evil_portal_app.c new file mode 100644 index 000000000..c715b6de7 --- /dev/null +++ b/applications/external/esp32cam_evilportal/evil_portal_app.c @@ -0,0 +1,133 @@ +#include "evil_portal_app_i.h" +#include "helpers/evil_portal_storage.h" + +#include +#include + +static bool evil_portal_app_custom_event_callback(void* context, uint32_t event) { + furi_assert(context); + Evil_PortalApp* app = context; + return scene_manager_handle_custom_event(app->scene_manager, event); +} + +static bool evil_portal_app_back_event_callback(void* context) { + furi_assert(context); + Evil_PortalApp* app = context; + return scene_manager_handle_back_event(app->scene_manager); +} + +static void evil_portal_app_tick_event_callback(void* context) { + furi_assert(context); + Evil_PortalApp* app = context; + scene_manager_handle_tick_event(app->scene_manager); +} + +Evil_PortalApp* evil_portal_app_alloc() { + Evil_PortalApp* app = malloc(sizeof(Evil_PortalApp)); + + app->sent_html = false; + app->sent_ap = false; + app->sent_reset = false; + app->has_command_queue = false; + app->command_index = 0; + app->portal_logs = furi_string_alloc(); + + app->gui = furi_record_open(RECORD_GUI); + + app->view_dispatcher = view_dispatcher_alloc(); + app->scene_manager = scene_manager_alloc(&evil_portal_scene_handlers, app); + view_dispatcher_enable_queue(app->view_dispatcher); + view_dispatcher_set_event_callback_context(app->view_dispatcher, app); + + view_dispatcher_set_custom_event_callback( + app->view_dispatcher, evil_portal_app_custom_event_callback); + view_dispatcher_set_navigation_event_callback( + app->view_dispatcher, evil_portal_app_back_event_callback); + view_dispatcher_set_tick_event_callback( + app->view_dispatcher, evil_portal_app_tick_event_callback, 100); + + view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); + + app->var_item_list = variable_item_list_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, + Evil_PortalAppViewVarItemList, + variable_item_list_get_view(app->var_item_list)); + + for(int i = 0; i < NUM_MENU_ITEMS; ++i) { + app->selected_option_index[i] = 0; + } + + app->text_box = text_box_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, Evil_PortalAppViewConsoleOutput, text_box_get_view(app->text_box)); + app->text_box_store = furi_string_alloc(); + furi_string_reserve(app->text_box_store, EVIL_PORTAL_TEXT_BOX_STORE_SIZE); + + scene_manager_next_scene(app->scene_manager, Evil_PortalSceneStart); + + return app; +} + +void evil_portal_app_free(Evil_PortalApp* app) { + // save latest logs + if(furi_string_utf8_length(app->portal_logs) > 0) { + write_logs(app->portal_logs); + furi_string_free(app->portal_logs); + } + + // Send reset event to dev board + evil_portal_uart_tx((uint8_t*)(RESET_CMD), strlen(RESET_CMD)); + evil_portal_uart_tx((uint8_t*)("\n"), 1); + + furi_assert(app); + + // Views + view_dispatcher_remove_view(app->view_dispatcher, Evil_PortalAppViewVarItemList); + view_dispatcher_remove_view(app->view_dispatcher, Evil_PortalAppViewConsoleOutput); + + text_box_free(app->text_box); + furi_string_free(app->text_box_store); + + // View dispatcher + view_dispatcher_free(app->view_dispatcher); + scene_manager_free(app->scene_manager); + + evil_portal_uart_free(app->uart); + + // Close records + furi_record_close(RECORD_GUI); + + free(app); +} + +int32_t evil_portal_app(void* p) { + UNUSED(p); + + // Enable uart listener + furi_hal_console_disable(); + furi_hal_uart_set_br(UART_CH, BAUDRATE); // TODO: Clean this + //furi_hal_uart_set_irq_cb(FuriHalUartIdUSART1, evil_portal_uart_on_irq_cb, app); + + furi_hal_power_disable_external_3_3v(); + furi_hal_power_disable_otg(); + furi_delay_ms(200); + furi_hal_power_enable_external_3_3v(); + furi_hal_power_enable_otg(); + for(int i = 0; i < 2; i++) { + furi_delay_ms(500); + furi_hal_uart_tx(UART_CH, (uint8_t[1]){'e'}, 1); + } + furi_delay_ms(1); + Evil_PortalApp* evil_portal_app = evil_portal_app_alloc(); + + evil_portal_app->uart = evil_portal_uart_init(evil_portal_app); + + view_dispatcher_run(evil_portal_app->view_dispatcher); + + evil_portal_app_free(evil_portal_app); + + furi_hal_power_disable_otg(); + + return 0; +} diff --git a/applications/external/esp32cam_evilportal/evil_portal_app.h b/applications/external/esp32cam_evilportal/evil_portal_app.h new file mode 100644 index 000000000..65c047ea5 --- /dev/null +++ b/applications/external/esp32cam_evilportal/evil_portal_app.h @@ -0,0 +1,11 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct Evil_PortalApp Evil_PortalApp; + +#ifdef __cplusplus +} +#endif diff --git a/applications/external/esp32cam_evilportal/evil_portal_app_i.h b/applications/external/esp32cam_evilportal/evil_portal_app_i.h new file mode 100644 index 000000000..e0c3e36d1 --- /dev/null +++ b/applications/external/esp32cam_evilportal/evil_portal_app_i.h @@ -0,0 +1,61 @@ +#pragma once + +#include "evil_portal_app.h" +#include "evil_portal_custom_event.h" +#include "evil_portal_uart.h" +#include "scenes/evil_portal_scene.h" + +#include +#include +#include +#include +#include + +#define NUM_MENU_ITEMS (4) + +#define EVIL_PORTAL_TEXT_BOX_STORE_SIZE (4096) +#define UART_CH (FuriHalUartIdUSART1) +#define BAUDRATE (230400) + +#define SET_HTML_CMD "sethtml" +#define SET_AP_CMD "setap" +#define RESET_CMD "reset" + +struct Evil_PortalApp { + Gui* gui; + ViewDispatcher* view_dispatcher; + SceneManager* scene_manager; + + FuriString* portal_logs; + const char* command_queue[1]; + int command_index; + bool has_command_queue; + + FuriString* text_box_store; + size_t text_box_store_strlen; + TextBox* text_box; + + VariableItemList* var_item_list; + Evil_PortalUart* uart; + + int selected_menu_index; + int selected_option_index[NUM_MENU_ITEMS]; + const char* selected_tx_string; + bool is_command; + bool is_custom_tx_string; + bool focus_console_start; + bool show_stopscan_tip; + bool sent_ap; + bool sent_html; + bool sent_reset; + //int BAUDRATE; + + uint8_t* index_html; + uint8_t* ap_name; +}; + +typedef enum { + Evil_PortalAppViewVarItemList, + Evil_PortalAppViewConsoleOutput, + Evil_PortalAppViewStartPortal, +} Evil_PortalAppView; diff --git a/applications/external/esp32cam_evilportal/evil_portal_custom_event.h b/applications/external/esp32cam_evilportal/evil_portal_custom_event.h new file mode 100644 index 000000000..a566ca62e --- /dev/null +++ b/applications/external/esp32cam_evilportal/evil_portal_custom_event.h @@ -0,0 +1,8 @@ +#pragma once + +typedef enum { + Evil_PortalEventRefreshConsoleOutput = 0, + Evil_PortalEventStartConsole, + Evil_PortalEventStartKeyboard, + Evil_PortalEventStartPortal, +} Evil_PortalCustomEvent; diff --git a/applications/external/esp32cam_evilportal/evil_portal_uart.c b/applications/external/esp32cam_evilportal/evil_portal_uart.c new file mode 100644 index 000000000..5c1c104a7 --- /dev/null +++ b/applications/external/esp32cam_evilportal/evil_portal_uart.c @@ -0,0 +1,149 @@ +#include "evil_portal_app_i.h" +#include "evil_portal_uart.h" +#include "helpers/evil_portal_storage.h" + +struct Evil_PortalUart { + Evil_PortalApp* app; + FuriThread* rx_thread; + FuriStreamBuffer* rx_stream; + uint8_t rx_buf[RX_BUF_SIZE + 1]; + void (*handle_rx_data_cb)(uint8_t* buf, size_t len, void* context); +}; + +typedef enum { + WorkerEvtStop = (1 << 0), + WorkerEvtRxDone = (1 << 1), +} WorkerEvtFlags; + +void evil_portal_uart_set_handle_rx_data_cb( + Evil_PortalUart* uart, + void (*handle_rx_data_cb)(uint8_t* buf, size_t len, void* context)) { + furi_assert(uart); + uart->handle_rx_data_cb = handle_rx_data_cb; +} + +#define WORKER_ALL_RX_EVENTS (WorkerEvtStop | WorkerEvtRxDone) + +void evil_portal_uart_on_irq_cb(UartIrqEvent ev, uint8_t data, void* context) { + Evil_PortalUart* uart = (Evil_PortalUart*)context; + + if(ev == UartIrqEventRXNE) { + furi_stream_buffer_send(uart->rx_stream, &data, 1, 0); + furi_thread_flags_set(furi_thread_get_id(uart->rx_thread), WorkerEvtRxDone); + } +} + +static int32_t uart_worker(void* context) { + Evil_PortalUart* uart = (void*)context; + + while(1) { + uint32_t events = + furi_thread_flags_wait(WORKER_ALL_RX_EVENTS, FuriFlagWaitAny, FuriWaitForever); + furi_check((events & FuriFlagError) == 0); + if(events & WorkerEvtStop) break; + if(events & WorkerEvtRxDone) { + size_t len = furi_stream_buffer_receive(uart->rx_stream, uart->rx_buf, RX_BUF_SIZE, 0); + + if(len > 0) { + if(uart->handle_rx_data_cb) { + uart->handle_rx_data_cb(uart->rx_buf, len, uart->app); + + if(uart->app->has_command_queue) { + if(uart->app->command_index < 1) { + if(0 == strncmp( + SET_AP_CMD, + uart->app->command_queue[uart->app->command_index], + strlen(SET_AP_CMD))) { + FuriString* out_data = furi_string_alloc(); + + furi_string_cat(out_data, "setap="); + furi_string_cat(out_data, (char*)uart->app->ap_name); + + evil_portal_uart_tx( + (uint8_t*)(furi_string_get_cstr(out_data)), + strlen(furi_string_get_cstr(out_data))); + evil_portal_uart_tx((uint8_t*)("\n"), 1); + + uart->app->sent_ap = true; + + free(out_data); + free(uart->app->ap_name); + } + + uart->app->command_index = 0; + uart->app->has_command_queue = false; + uart->app->command_queue[0] = ""; + } + } + + if(uart->app->sent_reset == false) { + furi_string_cat(uart->app->portal_logs, (char*)uart->rx_buf); + } + + if(furi_string_utf8_length(uart->app->portal_logs) > 4000) { + write_logs(uart->app->portal_logs); + furi_string_reset(uart->app->portal_logs); + } + } else { + uart->rx_buf[len] = '\0'; + if(uart->app->sent_reset == false) { + furi_string_cat(uart->app->portal_logs, (char*)uart->rx_buf); + } + + if(furi_string_utf8_length(uart->app->portal_logs) > 4000) { + write_logs(uart->app->portal_logs); + furi_string_reset(uart->app->portal_logs); + } + } + } + } + } + + furi_stream_buffer_free(uart->rx_stream); + + return 0; +} + +void evil_portal_uart_tx(uint8_t* data, size_t len) { + furi_hal_uart_tx(UART_CH, data, len); +} + +Evil_PortalUart* evil_portal_uart_init(Evil_PortalApp* app) { + Evil_PortalUart* uart = malloc(sizeof(Evil_PortalUart)); + uart->app = app; + // Init all rx stream and thread early to avoid crashes + uart->rx_stream = furi_stream_buffer_alloc(RX_BUF_SIZE, 1); + uart->rx_thread = furi_thread_alloc(); + furi_thread_set_name(uart->rx_thread, "Evil_PortalUartRxThread"); + furi_thread_set_stack_size(uart->rx_thread, 1024); + furi_thread_set_context(uart->rx_thread, uart); + furi_thread_set_callback(uart->rx_thread, uart_worker); + + furi_thread_start(uart->rx_thread); + + /*furi_hal_console_disable(); + if (app->BAUDRATE == 0) { + app->BAUDRATE = 115200; + } + furi_hal_uart_set_br(UART_CH, app->BAUDRATE); + furi_hal_uart_set_irq_cb(UART_CH, evil_portal_uart_on_irq_cb, uart);*/ + + furi_hal_console_disable(); + furi_hal_uart_set_br(UART_CH, BAUDRATE); + furi_hal_uart_set_irq_cb(UART_CH, evil_portal_uart_on_irq_cb, uart); + + return uart; +} + +void evil_portal_uart_free(Evil_PortalUart* uart) { + furi_assert(uart); + + furi_thread_flags_set(furi_thread_get_id(uart->rx_thread), WorkerEvtStop); + furi_thread_join(uart->rx_thread); + furi_thread_free(uart->rx_thread); + + furi_hal_uart_set_irq_cb(UART_CH, NULL, NULL); + furi_hal_console_enable(); + + free(uart); +} diff --git a/applications/external/esp32cam_evilportal/evil_portal_uart.h b/applications/external/esp32cam_evilportal/evil_portal_uart.h new file mode 100644 index 000000000..d7980a8e2 --- /dev/null +++ b/applications/external/esp32cam_evilportal/evil_portal_uart.h @@ -0,0 +1,14 @@ +#pragma once + +#include "furi_hal.h" + +#define RX_BUF_SIZE (320) + +typedef struct Evil_PortalUart Evil_PortalUart; + +void evil_portal_uart_set_handle_rx_data_cb( + Evil_PortalUart* uart, + void (*handle_rx_data_cb)(uint8_t* buf, size_t len, void* context)); +void evil_portal_uart_tx(uint8_t* data, size_t len); +Evil_PortalUart* evil_portal_uart_init(Evil_PortalApp* app); +void evil_portal_uart_free(Evil_PortalUart* uart); diff --git a/applications/external/esp32cam_evilportal/helpers/evil_portal_storage.c b/applications/external/esp32cam_evilportal/helpers/evil_portal_storage.c new file mode 100644 index 000000000..b28c97afa --- /dev/null +++ b/applications/external/esp32cam_evilportal/helpers/evil_portal_storage.c @@ -0,0 +1,117 @@ +#include "evil_portal_storage.h" + +static Storage* evil_portal_open_storage() { + return furi_record_open(RECORD_STORAGE); +} + +static void evil_portal_close_storage() { + furi_record_close(RECORD_STORAGE); +} + +void evil_portal_read_index_html(void* context) { + Evil_PortalApp* app = context; + Storage* storage = evil_portal_open_storage(); + FileInfo fi; + + if(storage_common_stat(storage, EVIL_PORTAL_INDEX_SAVE_PATH, &fi) == FSE_OK) { + File* index_html = storage_file_alloc(storage); + if(storage_file_open( + index_html, EVIL_PORTAL_INDEX_SAVE_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) { + app->index_html = malloc((size_t)fi.size); + uint8_t* buf_ptr = app->index_html; + size_t read = 0; + while(read < fi.size) { + size_t to_read = fi.size - read; + if(to_read > UINT16_MAX) to_read = UINT16_MAX; + uint16_t now_read = storage_file_read(index_html, buf_ptr, (uint16_t)to_read); + read += now_read; + buf_ptr += now_read; + } + free(buf_ptr); + } + storage_file_close(index_html); + storage_file_free(index_html); + } else { + char* html_error = "Evil portal
Unable to read the html file.
" + "Is the SD Card set up correctly?
See instructions @ " + "github.com/bigbrodude6119/flipper-zero-evil-portal
" + "Under the 'Install pre-built app on the flipper' section."; + app->index_html = (uint8_t*)html_error; + } + + evil_portal_close_storage(); +} + +void evil_portal_read_ap_name(void* context) { + Evil_PortalApp* app = context; + Storage* storage = evil_portal_open_storage(); + FileInfo fi; + + if(storage_common_stat(storage, EVIL_PORTAL_AP_SAVE_PATH, &fi) == FSE_OK) { + File* ap_name = storage_file_alloc(storage); + if(storage_file_open(ap_name, EVIL_PORTAL_AP_SAVE_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) { + app->ap_name = malloc((size_t)fi.size); + uint8_t* buf_ptr = app->ap_name; + size_t read = 0; + while(read < fi.size) { + size_t to_read = fi.size - read; + if(to_read > UINT16_MAX) to_read = UINT16_MAX; + uint16_t now_read = storage_file_read(ap_name, buf_ptr, (uint16_t)to_read); + read += now_read; + buf_ptr += now_read; + } + free(buf_ptr); + } + storage_file_close(ap_name); + storage_file_free(ap_name); + } else { + char* app_default = "Evil Portal"; + app->ap_name = (uint8_t*)app_default; + } + evil_portal_close_storage(); +} + +char* sequential_file_resolve_path( + Storage* storage, + const char* dir, + const char* prefix, + const char* extension) { + if(storage == NULL || dir == NULL || prefix == NULL || extension == NULL) { + return NULL; + } + + char file_path[256]; + int file_index = 0; + + do { + if(snprintf( + file_path, sizeof(file_path), "%s/%s_%d.%s", dir, prefix, file_index, extension) < + 0) { + return NULL; + } + file_index++; + } while(storage_file_exists(storage, file_path)); + + return strdup(file_path); +} + +void write_logs(FuriString* portal_logs) { + Storage* storage = evil_portal_open_storage(); + + if(!storage_file_exists(storage, EVIL_PORTAL_LOG_SAVE_PATH)) { + storage_simply_mkdir(storage, EVIL_PORTAL_LOG_SAVE_PATH); + } + + char* seq_file_path = + sequential_file_resolve_path(storage, EVIL_PORTAL_LOG_SAVE_PATH, "log", "txt"); + + File* file = storage_file_alloc(storage); + + if(storage_file_open(file, seq_file_path, FSAM_WRITE, FSOM_CREATE_ALWAYS)) { + storage_file_write( + file, furi_string_get_cstr(portal_logs), furi_string_utf8_length(portal_logs)); + } + storage_file_close(file); + storage_file_free(file); + evil_portal_close_storage(); +} \ No newline at end of file diff --git a/applications/external/esp32cam_evilportal/helpers/evil_portal_storage.h b/applications/external/esp32cam_evilportal/helpers/evil_portal_storage.h new file mode 100644 index 000000000..286ecbd76 --- /dev/null +++ b/applications/external/esp32cam_evilportal/helpers/evil_portal_storage.h @@ -0,0 +1,20 @@ +#include "../evil_portal_app_i.h" +#include +#include +#include +#include +#include + +#define PORTAL_FILE_DIRECTORY_PATH EXT_PATH("apps_data/evil_portal") +#define EVIL_PORTAL_INDEX_SAVE_PATH PORTAL_FILE_DIRECTORY_PATH "/index.html" +#define EVIL_PORTAL_AP_SAVE_PATH PORTAL_FILE_DIRECTORY_PATH "/ap.config.txt" +#define EVIL_PORTAL_LOG_SAVE_PATH PORTAL_FILE_DIRECTORY_PATH "/logs" + +void evil_portal_read_index_html(void* context); +void evil_portal_read_ap_name(void* context); +void write_logs(FuriString* portal_logs); +char* sequential_file_resolve_path( + Storage* storage, + const char* dir, + const char* prefix, + const char* extension); diff --git a/applications/external/esp32cam_evilportal/icons/evil_portal_10px.png b/applications/external/esp32cam_evilportal/icons/evil_portal_10px.png new file mode 100644 index 0000000000000000000000000000000000000000..eed8789a405660a0fe46df99fd734b403bdf852b GIT binary patch literal 156 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4F%}28J29*~C-V}>3GsAs4ABUl z+JBJufB^^d+rRD0jJP;FF0J}G;dr5$iSgkomB+W2350#{V4RS^yxf$@zBlSi2E)xl zx8-leVi~vpWxBs8bgAs**2O<&M14qJbbQX$9}GQlf$yJm6xaaGXYh3Ob6Mw<(8Rz1 E0F6&L5dZ)H literal 0 HcmV?d00001 diff --git a/applications/external/esp32cam_evilportal/scenes/evil_portal_scene.c b/applications/external/esp32cam_evilportal/scenes/evil_portal_scene.c new file mode 100644 index 000000000..f6f06d8cc --- /dev/null +++ b/applications/external/esp32cam_evilportal/scenes/evil_portal_scene.c @@ -0,0 +1,30 @@ +#include "evil_portal_scene.h" + +// Generate scene on_enter handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, +void (*const evil_portal_scene_on_enter_handlers[])(void*) = { +#include "evil_portal_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_event handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, +bool (*const evil_portal_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = { +#include "evil_portal_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_exit handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, +void (*const evil_portal_scene_on_exit_handlers[])(void* context) = { +#include "evil_portal_scene_config.h" +}; +#undef ADD_SCENE + +// Initialize scene handlers configuration structure +const SceneManagerHandlers evil_portal_scene_handlers = { + .on_enter_handlers = evil_portal_scene_on_enter_handlers, + .on_event_handlers = evil_portal_scene_on_event_handlers, + .on_exit_handlers = evil_portal_scene_on_exit_handlers, + .scene_num = Evil_PortalSceneNum, +}; diff --git a/applications/external/esp32cam_evilportal/scenes/evil_portal_scene.h b/applications/external/esp32cam_evilportal/scenes/evil_portal_scene.h new file mode 100644 index 000000000..8468f9157 --- /dev/null +++ b/applications/external/esp32cam_evilportal/scenes/evil_portal_scene.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +// Generate scene id and total number +#define ADD_SCENE(prefix, name, id) Evil_PortalScene##id, +typedef enum { +#include "evil_portal_scene_config.h" + Evil_PortalSceneNum, +} Evil_PortalScene; +#undef ADD_SCENE + +extern const SceneManagerHandlers evil_portal_scene_handlers; + +// Generate scene on_enter handlers declaration +#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); +#include "evil_portal_scene_config.h" +#undef ADD_SCENE + +// Generate scene on_event handlers declaration +#define ADD_SCENE(prefix, name, id) \ + bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); +#include "evil_portal_scene_config.h" +#undef ADD_SCENE + +// Generate scene on_exit handlers declaration +#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); +#include "evil_portal_scene_config.h" +#undef ADD_SCENE diff --git a/applications/external/esp32cam_evilportal/scenes/evil_portal_scene_config.h b/applications/external/esp32cam_evilportal/scenes/evil_portal_scene_config.h new file mode 100644 index 000000000..94b09ae46 --- /dev/null +++ b/applications/external/esp32cam_evilportal/scenes/evil_portal_scene_config.h @@ -0,0 +1,2 @@ +ADD_SCENE(evil_portal, start, Start) +ADD_SCENE(evil_portal, console_output, ConsoleOutput) diff --git a/applications/external/esp32cam_evilportal/scenes/evil_portal_scene_console_output.c b/applications/external/esp32cam_evilportal/scenes/evil_portal_scene_console_output.c new file mode 100644 index 000000000..0447e2727 --- /dev/null +++ b/applications/external/esp32cam_evilportal/scenes/evil_portal_scene_console_output.c @@ -0,0 +1,147 @@ +#include "../evil_portal_app_i.h" +#include "../helpers/evil_portal_storage.h" + +void evil_portal_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, void* context) { + furi_assert(context); + Evil_PortalApp* app = context; + + // If text box store gets too big, then truncate it + app->text_box_store_strlen += len; + if(app->text_box_store_strlen >= EVIL_PORTAL_TEXT_BOX_STORE_SIZE - 1) { + furi_string_right(app->text_box_store, app->text_box_store_strlen / 2); + app->text_box_store_strlen = furi_string_size(app->text_box_store) + len; + } + + // Null-terminate buf and append to text box store + buf[len] = '\0'; + furi_string_cat_printf(app->text_box_store, "%s", buf); + + view_dispatcher_send_custom_event(app->view_dispatcher, Evil_PortalEventRefreshConsoleOutput); +} + +void evil_portal_scene_console_output_on_enter(void* context) { + Evil_PortalApp* app = context; + + TextBox* text_box = app->text_box; + text_box_reset(app->text_box); + text_box_set_font(text_box, TextBoxFontText); + if(app->focus_console_start) { + text_box_set_focus(text_box, TextBoxFocusStart); + } else { + text_box_set_focus(text_box, TextBoxFocusEnd); + } + + if(app->is_command) { + furi_string_reset(app->text_box_store); + app->text_box_store_strlen = 0; + app->sent_reset = false; + + if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) { + const char* help_msg = "BLUE = Waiting\nGREEN = Good\nRED = Bad\n\nThis project is a " + "WIP.\ngithub.com/bigbrodude6119/flipper-zero-evil-portal\n\n" + "Version 0.0.2\n\n"; + furi_string_cat_str(app->text_box_store, help_msg); + app->text_box_store_strlen += strlen(help_msg); + if(app->show_stopscan_tip) { + const char* msg = "Press BACK to return\n"; + furi_string_cat_str(app->text_box_store, msg); + app->text_box_store_strlen += strlen(msg); + } + } + + if(0 == strncmp("savelogs", app->selected_tx_string, strlen("savelogs"))) { + const char* help_msg = "Logs saved.\n\n"; + furi_string_cat_str(app->text_box_store, help_msg); + app->text_box_store_strlen += strlen(help_msg); + write_logs(app->portal_logs); + furi_string_reset(app->portal_logs); + if(app->show_stopscan_tip) { + const char* msg = "Press BACK to return\n"; + furi_string_cat_str(app->text_box_store, msg); + app->text_box_store_strlen += strlen(msg); + } + } + + if(0 == strncmp(SET_HTML_CMD, app->selected_tx_string, strlen(SET_HTML_CMD))) { + app->command_queue[0] = SET_AP_CMD; + app->has_command_queue = true; + app->command_index = 0; + if(app->show_stopscan_tip) { + const char* msg = "Starting portal\nIf no response press\nBACK to return\n"; + furi_string_cat_str(app->text_box_store, msg); + app->text_box_store_strlen += strlen(msg); + } + } + + if(0 == strncmp(RESET_CMD, app->selected_tx_string, strlen(RESET_CMD))) { + app->sent_reset = true; + if(app->show_stopscan_tip) { + const char* msg = "Reseting portal\nPress BACK to return\n\n\n\n"; + furi_string_cat_str(app->text_box_store, msg); + app->text_box_store_strlen += strlen(msg); + } + } + } + + text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store)); + + scene_manager_set_scene_state(app->scene_manager, Evil_PortalSceneConsoleOutput, 0); + view_dispatcher_switch_to_view(app->view_dispatcher, Evil_PortalAppViewConsoleOutput); + + // Register callback to receive data + evil_portal_uart_set_handle_rx_data_cb( + app->uart, evil_portal_console_output_handle_rx_data_cb); + + if(app->is_command && app->selected_tx_string) { + if(0 == strncmp(SET_HTML_CMD, app->selected_tx_string, strlen(SET_HTML_CMD))) { + evil_portal_read_index_html(context); + + FuriString* data = furi_string_alloc(); + furi_string_cat(data, "sethtml="); + furi_string_cat(data, (char*)app->index_html); + + evil_portal_uart_tx( + (uint8_t*)(furi_string_get_cstr(data)), strlen(furi_string_get_cstr(data))); + evil_portal_uart_tx((uint8_t*)("\n"), 1); + + app->sent_html = true; + + free(data); + free(app->index_html); + + evil_portal_read_ap_name(context); + } else if(0 == strncmp(RESET_CMD, app->selected_tx_string, strlen(RESET_CMD))) { + app->sent_html = false; + app->sent_ap = false; + evil_portal_uart_tx( + (uint8_t*)(app->selected_tx_string), strlen(app->selected_tx_string)); + evil_portal_uart_tx((uint8_t*)("\n"), 1); + } else if(1 == strncmp("help", app->selected_tx_string, strlen("help"))) { + evil_portal_uart_tx( + (uint8_t*)(app->selected_tx_string), strlen(app->selected_tx_string)); + evil_portal_uart_tx((uint8_t*)("\n"), 1); + } + } +} + +bool evil_portal_scene_console_output_on_event(void* context, SceneManagerEvent event) { + Evil_PortalApp* app = context; + + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store)); + consumed = true; + } else if(event.type == SceneManagerEventTypeTick) { + consumed = true; + } + + return consumed; +} + +void evil_portal_scene_console_output_on_exit(void* context) { + Evil_PortalApp* app = context; + + // Unregister rx callback + evil_portal_uart_set_handle_rx_data_cb(app->uart, NULL); +} diff --git a/applications/external/esp32cam_evilportal/scenes/evil_portal_scene_start.c b/applications/external/esp32cam_evilportal/scenes/evil_portal_scene_start.c new file mode 100644 index 000000000..7f7200fcb --- /dev/null +++ b/applications/external/esp32cam_evilportal/scenes/evil_portal_scene_start.c @@ -0,0 +1,130 @@ +#include "../evil_portal_app_i.h" + +// For each command, define whether additional arguments are needed +// (enabling text input to fill them out), and whether the console +// text box should focus at the start of the output or the end +typedef enum { NO_ARGS = 0, INPUT_ARGS, TOGGLE_ARGS } InputArgs; + +typedef enum { FOCUS_CONSOLE_END = 0, FOCUS_CONSOLE_START, FOCUS_CONSOLE_TOGGLE } FocusConsole; + +#define SHOW_STOPSCAN_TIP (true) +#define NO_TIP (false) + +#define MAX_OPTIONS (9) +typedef struct { + const char* item_string; + const char* options_menu[MAX_OPTIONS]; + int num_options_menu; + const char* actual_commands[MAX_OPTIONS]; + InputArgs needs_keyboard; + FocusConsole focus_console; + bool show_stopscan_tip; +} Evil_PortalItem; + +// NUM_MENU_ITEMS defined in evil_portal_app_i.h - if you add an entry here, +// increment it! +const Evil_PortalItem items[NUM_MENU_ITEMS] = { + // send command + {"Start portal", {""}, 1, {SET_HTML_CMD}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP}, + + // stop portal + {"Stop portal", {""}, 1, {RESET_CMD}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP}, + + // console + {"Save logs", {""}, 1, {"savelogs"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP}, + + // help + {"Help", {""}, 1, {"help"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP}, +}; + +static void evil_portal_scene_start_var_list_enter_callback(void* context, uint32_t index) { + furi_assert(context); + Evil_PortalApp* app = context; + + furi_assert(index < NUM_MENU_ITEMS); + const Evil_PortalItem* item = &items[index]; + + const int selected_option_index = app->selected_option_index[index]; + furi_assert(selected_option_index < item->num_options_menu); + app->selected_tx_string = item->actual_commands[selected_option_index]; + app->is_command = true; + app->is_custom_tx_string = false; + app->selected_menu_index = index; + app->focus_console_start = (item->focus_console == FOCUS_CONSOLE_TOGGLE) ? + (selected_option_index == 0) : + item->focus_console; + app->show_stopscan_tip = item->show_stopscan_tip; + + view_dispatcher_send_custom_event(app->view_dispatcher, Evil_PortalEventStartConsole); +} + +static void evil_portal_scene_start_var_list_change_callback(VariableItem* item) { + furi_assert(item); + + Evil_PortalApp* app = variable_item_get_context(item); + furi_assert(app); + + const Evil_PortalItem* menu_item = &items[app->selected_menu_index]; + uint8_t item_index = variable_item_get_current_value_index(item); + furi_assert(item_index < menu_item->num_options_menu); + variable_item_set_current_value_text(item, menu_item->options_menu[item_index]); + app->selected_option_index[app->selected_menu_index] = item_index; +} + +void evil_portal_scene_start_on_enter(void* context) { + Evil_PortalApp* app = context; + VariableItemList* var_item_list = app->var_item_list; + + variable_item_list_set_enter_callback( + var_item_list, evil_portal_scene_start_var_list_enter_callback, app); + + VariableItem* item; + for(int i = 0; i < NUM_MENU_ITEMS; ++i) { + item = variable_item_list_add( + var_item_list, + items[i].item_string, + items[i].num_options_menu, + evil_portal_scene_start_var_list_change_callback, + app); + variable_item_set_current_value_index(item, app->selected_option_index[i]); + variable_item_set_current_value_text( + item, items[i].options_menu[app->selected_option_index[i]]); + } + + variable_item_list_set_selected_item( + var_item_list, scene_manager_get_scene_state(app->scene_manager, Evil_PortalSceneStart)); + + view_dispatcher_switch_to_view(app->view_dispatcher, Evil_PortalAppViewVarItemList); +} + +bool evil_portal_scene_start_on_event(void* context, SceneManagerEvent event) { + UNUSED(context); + Evil_PortalApp* app = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == Evil_PortalEventStartPortal) { + scene_manager_set_scene_state( + app->scene_manager, Evil_PortalSceneStart, app->selected_menu_index); + scene_manager_next_scene(app->scene_manager, Evil_PortalAppViewStartPortal); + } else if(event.event == Evil_PortalEventStartKeyboard) { + scene_manager_set_scene_state( + app->scene_manager, Evil_PortalSceneStart, app->selected_menu_index); + } else if(event.event == Evil_PortalEventStartConsole) { + scene_manager_set_scene_state( + app->scene_manager, Evil_PortalSceneStart, app->selected_menu_index); + scene_manager_next_scene(app->scene_manager, Evil_PortalAppViewConsoleOutput); + } + consumed = true; + } else if(event.type == SceneManagerEventTypeTick) { + app->selected_menu_index = variable_item_list_get_selected_item_index(app->var_item_list); + consumed = true; + } + + return consumed; +} + +void evil_portal_scene_start_on_exit(void* context) { + Evil_PortalApp* app = context; + variable_item_list_reset(app->var_item_list); +} diff --git a/applications/external/esp32cam_morseflasher/application.fam b/applications/external/esp32cam_morseflasher/application.fam index af60d8de7..037e63c81 100644 --- a/applications/external/esp32cam_morseflasher/application.fam +++ b/applications/external/esp32cam_morseflasher/application.fam @@ -7,6 +7,7 @@ App( requires=["gui"], stack_size=1 * 1024, order=90, + fap_icon_assets="assets", fap_icon="icon.png", fap_category="GPIO", fap_description="ESP32-CAM app to stream a message in morse using the powerful flashlight. [Unplug the USB cable to test with Mayhem]", diff --git a/applications/external/esp32cam_morseflasher/uart_terminal_app.c b/applications/external/esp32cam_morseflasher/uart_terminal_app.c index 04267039f..37d047d19 100644 --- a/applications/external/esp32cam_morseflasher/uart_terminal_app.c +++ b/applications/external/esp32cam_morseflasher/uart_terminal_app.c @@ -90,6 +90,12 @@ void uart_terminal_app_free(UART_TerminalApp* app) { int32_t uart_terminal_app(void* p) { UNUSED(p); + + // Enable uart listener + furi_hal_console_disable(); + furi_hal_uart_set_br(UART_CH, BAUDRATE); // TODO: Clean this + //furi_hal_uart_set_irq_cb(FuriHalUartIdUSART1, uart_echo_on_irq_cb, app); + furi_hal_power_disable_external_3_3v(); furi_hal_power_disable_otg(); furi_delay_ms(200); @@ -97,7 +103,7 @@ int32_t uart_terminal_app(void* p) { furi_hal_power_enable_otg(); for(int i = 0; i < 2; i++) { furi_delay_ms(500); - furi_hal_uart_tx(FuriHalUartIdUSART1, (uint8_t[1]){'.'}, 1); + furi_hal_uart_tx(UART_CH, (uint8_t[1]){'.'}, 1); } furi_delay_ms(1); UART_TerminalApp* uart_terminal_app = uart_terminal_app_alloc(); @@ -107,6 +113,8 @@ int32_t uart_terminal_app(void* p) { view_dispatcher_run(uart_terminal_app->view_dispatcher); uart_terminal_app_free(uart_terminal_app); + furi_hal_power_disable_otg(); + return 0; } diff --git a/applications/external/esp32cam_morseflasher/uart_terminal_app_i.h b/applications/external/esp32cam_morseflasher/uart_terminal_app_i.h index 6d9b20608..3f3323587 100644 --- a/applications/external/esp32cam_morseflasher/uart_terminal_app_i.h +++ b/applications/external/esp32cam_morseflasher/uart_terminal_app_i.h @@ -16,6 +16,8 @@ #define UART_TERMINAL_TEXT_BOX_STORE_SIZE (4096) #define UART_TERMINAL_TEXT_INPUT_STORE_SIZE (512) +#define UART_CH (FuriHalUartIdUSART1) +#define BAUDRATE (230400) struct UART_TerminalApp { Gui* gui; diff --git a/applications/external/esp32cam_morseflasher/uart_terminal_uart.c b/applications/external/esp32cam_morseflasher/uart_terminal_uart.c index 53faa9aea..504fac7cd 100644 --- a/applications/external/esp32cam_morseflasher/uart_terminal_uart.c +++ b/applications/external/esp32cam_morseflasher/uart_terminal_uart.c @@ -1,9 +1,6 @@ #include "uart_terminal_app_i.h" #include "uart_terminal_uart.h" -#define UART_CH (FuriHalUartIdUSART1) -#define BAUDRATE (230400) - struct UART_TerminalUart { UART_TerminalApp* app; FuriThread* rx_thread; diff --git a/applications/external/evil_portal/evil_portal_app.c b/applications/external/evil_portal/evil_portal_app.c index ee9b373d0..4f985e72c 100644 --- a/applications/external/evil_portal/evil_portal_app.c +++ b/applications/external/evil_portal/evil_portal_app.c @@ -105,6 +105,15 @@ void evil_portal_app_free(Evil_PortalApp* app) { int32_t evil_portal_app(void* p) { UNUSED(p); + + // Enable 5v on startup + uint8_t attempts = 0; + while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) { + furi_hal_power_enable_otg(); + furi_delay_ms(10); + } + furi_delay_ms(200); + Evil_PortalApp* evil_portal_app = evil_portal_app_alloc(); evil_portal_app->uart = evil_portal_uart_init(evil_portal_app); @@ -113,5 +122,9 @@ int32_t evil_portal_app(void* p) { evil_portal_app_free(evil_portal_app); + if(furi_hal_power_is_otg_enabled()) { + furi_hal_power_disable_otg(); + } + return 0; } diff --git a/applications/external/flipbip/application.fam b/applications/external/flipbip/application.fam index 0c17d5787..135b717e9 100644 --- a/applications/external/flipbip/application.fam +++ b/applications/external/flipbip/application.fam @@ -10,13 +10,15 @@ App( order=10, fap_icon="flipbip_10px.png", fap_icon_assets="icons", + fap_icon_assets_symbol="flipbip", fap_private_libs=[ Lib( name="crypto", ), ], fap_category="Tools", - fap_description="Crypto toolkit for Flipper", fap_author="Struan Clark (xtruan)", fap_weburl="https://github.com/xtruan/FlipBIP", + fap_version=(1, 11), + fap_description="Crypto wallet tools for Flipper", ) diff --git a/applications/external/flipbip/flipbip.h b/applications/external/flipbip/flipbip.h index 527807011..9df002aaa 100644 --- a/applications/external/flipbip/flipbip.h +++ b/applications/external/flipbip/flipbip.h @@ -15,7 +15,7 @@ #include "views/flipbip_startscreen.h" #include "views/flipbip_scene_1.h" -#define FLIPBIP_VERSION "v1.0.0" +#define FLIPBIP_VERSION "v1.11.0" #define COIN_BTC 0 #define COIN_DOGE 3 diff --git a/applications/external/flipbip/helpers/flipbip_file.c b/applications/external/flipbip/helpers/flipbip_file.c index fd389e48e..f3f0ab590 100644 --- a/applications/external/flipbip/helpers/flipbip_file.c +++ b/applications/external/flipbip/helpers/flipbip_file.c @@ -32,7 +32,11 @@ const char* FILE_HSTR = "fb01"; const char* FILE_K1 = "fb0131d5cf688221c109163908ebe51debb46227c6cc8b37641910833222772a" "baefe6d9ceb651842260e0d1e05e3b90d15e7d5ffaaabc0207bf200a117793a2"; -bool flipbip_load_file(char* settings, const FlipBipFile file_type, const char* file_name) { +bool flipbip_load_file( + char* settings, + size_t slen, + const FlipBipFile file_type, + const char* file_name) { bool ret = false; const char* path; if(file_type == FlipBipFileKey) { @@ -52,10 +56,12 @@ bool flipbip_load_file(char* settings, const FlipBipFile file_type, const char* File* settings_file = storage_file_alloc(fs_api); if(storage_file_open(settings_file, path, FSAM_READ, FSOM_OPEN_EXISTING)) { char chr; - int i = 0; + size_t i = 0; while((storage_file_read(settings_file, &chr, 1) == 1) && !storage_file_eof(settings_file) && !isspace(chr)) { - settings[i] = chr; + if(i < slen) { + settings[i] = chr; + } i++; } ret = true; @@ -193,7 +199,7 @@ bool flipbip_load_file_secure(char* settings) { memzero(data, dlen); // load k2 from file - if(!flipbip_load_file(data, FlipBipFileKey, NULL)) return false; + if(!flipbip_load_file(data, dlen, FlipBipFileKey, NULL)) return false; // check header if(data[0] != FILE_HSTR[0] || data[1] != FILE_HSTR[1] || data[2] != FILE_HSTR[2] || @@ -219,7 +225,7 @@ bool flipbip_load_file_secure(char* settings) { data -= FILE_HLEN; // load data from file - if(!flipbip_load_file(data, FlipBipFileDat, NULL)) return false; + if(!flipbip_load_file(data, dlen, FlipBipFileDat, NULL)) return false; // check header if(data[0] != FILE_HSTR[0] || data[1] != FILE_HSTR[1] || data[2] != FILE_HSTR[2] || diff --git a/applications/external/flipbip/helpers/flipbip_file.h b/applications/external/flipbip/helpers/flipbip_file.h index c19f70dc5..3ef76dd84 100644 --- a/applications/external/flipbip/helpers/flipbip_file.h +++ b/applications/external/flipbip/helpers/flipbip_file.h @@ -1,4 +1,5 @@ #include +#include typedef enum { FlipBipFileDat, @@ -7,7 +8,11 @@ typedef enum { } FlipBipFile; bool flipbip_has_file(const FlipBipFile file_type, const char* file_name, const bool remove); -bool flipbip_load_file(char* settings, const FlipBipFile file_type, const char* file_name); +bool flipbip_load_file( + char* settings, + size_t slen, + const FlipBipFile file_type, + const char* file_name); bool flipbip_save_file( const char* settings, const FlipBipFile file_type, diff --git a/applications/external/flipbip/lib/crypto/rand.c b/applications/external/flipbip/lib/crypto/rand.c index 67a97876d..a10858734 100644 --- a/applications/external/flipbip/lib/crypto/rand.c +++ b/applications/external/flipbip/lib/crypto/rand.c @@ -52,8 +52,7 @@ void random_buffer(uint8_t* buf, size_t len) { #else /* PLATFORM INDEPENDENT */ -#pragma message( \ - "NOT SUITABLE FOR PRODUCTION USE! Replace random32() function with your own secure code.") +#pragma message("NOT SUITABLE FOR PRODUCTION USE! Replace random32() function with your own secure code.") // The following code is not supposed to be used in a production environment. // It's included only to make the library testable. @@ -69,20 +68,20 @@ void random_buffer(uint8_t* buf, size_t len) { // uint32_t random32(void) { - // Linear congruential generator from Numerical Recipes - // https://en.wikipedia.org/wiki/Linear_congruential_generator - seed = 1664525 * seed + 1013904223; - return seed; + // Linear congruential generator from Numerical Recipes + // https://en.wikipedia.org/wiki/Linear_congruential_generator + seed = 1664525 * seed + 1013904223; + return seed; } -void __attribute__((weak)) random_buffer(uint8_t* buf, size_t len) { - uint32_t r = 0; - for(size_t i = 0; i < len; i++) { - if(i % 4 == 0) { - r = random32(); - } - buf[i] = (r >> ((i % 4) * 8)) & 0xFF; +void __attribute__((weak)) random_buffer(uint8_t *buf, size_t len) { + uint32_t r = 0; + for (size_t i = 0; i < len; i++) { + if (i % 4 == 0) { + r = random32(); } + buf[i] = (r >> ((i % 4) * 8)) & 0xFF; + } } #endif /* FLIPPER_HAL_RANDOM */ diff --git a/applications/external/flipbip/scenes/flipbip_scene_scene_1.c b/applications/external/flipbip/scenes/flipbip_scene_scene_1.c index 2f0201443..6f4064cd4 100644 --- a/applications/external/flipbip/scenes/flipbip_scene_scene_1.c +++ b/applications/external/flipbip/scenes/flipbip_scene_scene_1.c @@ -47,4 +47,4 @@ bool flipbip_scene_scene_1_on_event(void* context, SceneManagerEvent event) { void flipbip_scene_scene_1_on_exit(void* context) { FlipBip* app = context; UNUSED(app); -} +} \ No newline at end of file diff --git a/applications/external/flipbip/views/flipbip_scene_1.c b/applications/external/flipbip/views/flipbip_scene_1.c index f57fe4830..d36cad496 100644 --- a/applications/external/flipbip/views/flipbip_scene_1.c +++ b/applications/external/flipbip/views/flipbip_scene_1.c @@ -7,7 +7,7 @@ #include #include #include "flipbip_icons.h" -#include "assets_icons.h" +#include #include "../helpers/flipbip_haptic.h" #include "../helpers/flipbip_led.h" #include "../helpers/flipbip_string.h" diff --git a/applications/external/flipbip/views/flipbip_startscreen.c b/applications/external/flipbip/views/flipbip_startscreen.c index f2b69c084..0a4bebb57 100644 --- a/applications/external/flipbip/views/flipbip_startscreen.c +++ b/applications/external/flipbip/views/flipbip_startscreen.c @@ -4,7 +4,7 @@ #include #include #include "flipbip_icons.h" -#include "assets_icons.h" +#include struct FlipBipStartscreen { View* view; diff --git a/applications/external/multi_fuzzer/todo.md b/applications/external/multi_fuzzer/todo.md deleted file mode 100644 index 4e3b0e17d..000000000 --- a/applications/external/multi_fuzzer/todo.md +++ /dev/null @@ -1,44 +0,0 @@ -## Working Improvement - -#### Quality of life - -- [ ] Make the "Load File" independent of the current protocol -- [x] Add pause - - [ ] Switching UIDs if possible -- [x] Led and sound Notification - - [x] Led - - [x] Vibro - - [ ] Sound? -- [x] Error Notification - - [x] Custom UIDs dict loading - - [x] Key file loading - - [ ] Anything else - -#### App functionality - -- [x] Add `BFCustomerID` attack - - [x] Add the ability to select index -- [ ] Save key logic - -## Code Improvement - -- [ ] GUI - - [x] Rewrite `gui_const` logic - - [x] Icon in dialog - - [x] Description and buttons in `field_editor` view - - [ ] Protocol carousel in `main_menu` - - [x] prototype - - [x] Add the ability to edit emulation time and downtime separately - - [x] Decide on the display -- [x] UID - - [x] Simplify the storage and exchange of `uids.data` `uid.data_size` in `views` - - [x] Using `FuzzerPayload` to store the uid - - [x] `UID_MAX_SIZE` -- [x] Add pause - - [x] Fix `Custom dict` attack when ended -- [ ] Pause V2 - - [ ] Save logic - - [ ] Switching UIDs if possible -- [ ] Worker - - [ ] Use `prtocol_id` instead of protocol name - - [x] this can be simplified `fuzzer_proto_items` \ No newline at end of file diff --git a/applications/external/rubiks_cube_scrambler/application.fam b/applications/external/rubiks_cube_scrambler/application.fam index 7193ae302..1d51ecdd5 100644 --- a/applications/external/rubiks_cube_scrambler/application.fam +++ b/applications/external/rubiks_cube_scrambler/application.fam @@ -19,6 +19,6 @@ App( fap_icon="cube.png", fap_author="@RaZeSloth", fap_weburl="https://github.com/RaZeSloth/flipperzero-rubiks-cube-scrambler", - fap_version="1.0", + fap_version="1.1", fap_description="App generates random moves to scramble a Rubik's cube.", ) diff --git a/applications/external/rubiks_cube_scrambler/rubiks_cube_scrambler.c b/applications/external/rubiks_cube_scrambler/rubiks_cube_scrambler.c index c4ceae4ab..64031bfbe 100644 --- a/applications/external/rubiks_cube_scrambler/rubiks_cube_scrambler.c +++ b/applications/external/rubiks_cube_scrambler/rubiks_cube_scrambler.c @@ -100,6 +100,7 @@ int32_t rubiks_cube_scrambler_main(void* p) { if(event.key == InputKeyBack) { break; } + view_port_update(view_port); } furi_message_queue_free(event_queue); diff --git a/applications/external/subghz_bruteforcer/application.fam b/applications/external/subghz_bruteforcer/application.fam index 6a3fdef3f..713520a2c 100644 --- a/applications/external/subghz_bruteforcer/application.fam +++ b/applications/external/subghz_bruteforcer/application.fam @@ -8,4 +8,5 @@ App( order=11, fap_icon="subbrute_10px.png", fap_category="Sub-GHz", + fap_icon_assets="images", ) diff --git a/applications/external/subghz_bruteforcer/helpers/gui_top_buttons.h b/applications/external/subghz_bruteforcer/helpers/gui_top_buttons.h index b5ca507b7..8a98d3b66 100644 --- a/applications/external/subghz_bruteforcer/helpers/gui_top_buttons.h +++ b/applications/external/subghz_bruteforcer/helpers/gui_top_buttons.h @@ -1,10 +1,11 @@ #pragma once +#include "subghz_bruteforcer_icons.h" +#include #include #include #include #include -#include /** * Thanks to the author of metronome @@ -18,4 +19,4 @@ void elements_button_top_left(Canvas* canvas, const char* str); * @param canvas * @param str */ -void elements_button_top_right(Canvas* canvas, const char* str); \ No newline at end of file +void elements_button_top_right(Canvas* canvas, const char* str); diff --git a/applications/external/subghz_bruteforcer/helpers/subbrute_worker.c b/applications/external/subghz_bruteforcer/helpers/subbrute_worker.c index fb17e15a6..a2f3d8d05 100644 --- a/applications/external/subghz_bruteforcer/helpers/subbrute_worker.c +++ b/applications/external/subghz_bruteforcer/helpers/subbrute_worker.c @@ -3,7 +3,7 @@ #include #include #include -#include +#include #define TAG "SubBruteWorker" #define SUBBRUTE_TX_TIMEOUT 6 @@ -453,18 +453,38 @@ uint8_t subbrute_worker_get_timeout(SubBruteWorker* instance) { return instance->tx_timeout_ms; } -void subbrute_worker_timeout_inc(SubBruteWorker* instance) { - if(instance->tx_timeout_ms < 255) { - instance->tx_timeout_ms++; - } +void subbrute_worker_set_timeout(SubBruteWorker* instance, uint8_t timeout) { + instance->tx_timeout_ms = timeout; } -void subbrute_worker_timeout_dec(SubBruteWorker* instance) { - if(instance->tx_timeout_ms > 0) { - instance->tx_timeout_ms--; - } +uint8_t subbrute_worker_get_repeats(SubBruteWorker* instance) { + return instance->repeat; } +void subbrute_worker_set_repeats(SubBruteWorker* instance, uint8_t repeats) { + instance->repeat = repeats; +} + +uint32_t subbrute_worker_get_te(SubBruteWorker* instance) { + return instance->te; +} + +void subbrute_worker_set_te(SubBruteWorker* instance, uint32_t te) { + instance->te = te; +} + +// void subbrute_worker_timeout_inc(SubBruteWorker* instance) { +// if(instance->tx_timeout_ms < 255) { +// instance->tx_timeout_ms++; +// } +// } + +// void subbrute_worker_timeout_dec(SubBruteWorker* instance) { +// if(instance->tx_timeout_ms > 0) { +// instance->tx_timeout_ms--; +// } +// } + bool subbrute_worker_is_tx_allowed(SubBruteWorker* instance, uint32_t value) { furi_assert(instance); bool res = false; diff --git a/applications/external/subghz_bruteforcer/helpers/subbrute_worker.h b/applications/external/subghz_bruteforcer/helpers/subbrute_worker.h index ef3a5eba8..c5b04f991 100644 --- a/applications/external/subghz_bruteforcer/helpers/subbrute_worker.h +++ b/applications/external/subghz_bruteforcer/helpers/subbrute_worker.h @@ -43,9 +43,14 @@ void subbrute_worker_set_callback( void* context); uint8_t subbrute_worker_get_timeout(SubBruteWorker* instance); +void subbrute_worker_set_timeout(SubBruteWorker* instance, uint8_t timeout); +uint8_t subbrute_worker_get_repeats(SubBruteWorker* instance); +void subbrute_worker_set_repeats(SubBruteWorker* instance, uint8_t repeats); +uint32_t subbrute_worker_get_te(SubBruteWorker* instance); +void subbrute_worker_set_te(SubBruteWorker* instance, uint32_t te); -void subbrute_worker_timeout_inc(SubBruteWorker* instance); +// void subbrute_worker_timeout_inc(SubBruteWorker* instance); -void subbrute_worker_timeout_dec(SubBruteWorker* instance); +// void subbrute_worker_timeout_dec(SubBruteWorker* instance); bool subbrute_worker_is_tx_allowed(SubBruteWorker* instance, uint32_t value); \ No newline at end of file diff --git a/applications/external/subghz_bruteforcer/scenes/subbrute_scene_setup_attack.c b/applications/external/subghz_bruteforcer/scenes/subbrute_scene_setup_attack.c index 5aa5e840a..3977ba5c9 100644 --- a/applications/external/subghz_bruteforcer/scenes/subbrute_scene_setup_attack.c +++ b/applications/external/subghz_bruteforcer/scenes/subbrute_scene_setup_attack.c @@ -46,7 +46,7 @@ void subbrute_scene_setup_attack_on_enter(void* context) { instance->device->max_value, instance->device->current_step, false, - instance->device->extra_repeats); + subbrute_worker_get_repeats(instance->worker)); instance->current_view = SubBruteViewAttack; subbrute_attack_view_set_callback(view, subbrute_scene_setup_attack_callback, instance); diff --git a/applications/external/subghz_bruteforcer/scenes/subbrute_scene_setup_extra.c b/applications/external/subghz_bruteforcer/scenes/subbrute_scene_setup_extra.c index c798e055b..a4f14aa26 100644 --- a/applications/external/subghz_bruteforcer/scenes/subbrute_scene_setup_extra.c +++ b/applications/external/subghz_bruteforcer/scenes/subbrute_scene_setup_extra.c @@ -3,43 +3,260 @@ #define TAG "SubBruteSceneLoadFile" -void setup_extra_widget_callback(GuiButtonType result, InputType type, void* context); +#define MIN_TD 0 +#define MAX_TD 255 +#define MIN_REP 1 +#define MAX_REP 100 +#define MIN_TE 100 +#define MAX_TE 600 -static void setup_extra_widget_draw(void* context) { - furi_assert(context); - SubBruteState* instance = context; +enum SubBruteVarListIndex { + SubBruteVarListIndexTimeDelay, + SubBruteVarListIndexRepeat_or_OnExtra, + SubBruteVarListIndexTe, +}; - Widget* widget = instance->widget; +static void setup_extra_enter_callback(void* context, uint32_t index); - widget_add_button_element( - widget, GuiButtonTypeLeft, "-TD", setup_extra_widget_callback, instance); - widget_add_button_element( - widget, GuiButtonTypeRight, "TD+", setup_extra_widget_callback, instance); +static void setup_extra_td_callback(VariableItem* item) { + furi_assert(item); + SubBruteState* instance = variable_item_get_context(item); + furi_assert(instance); + char buf[6]; - char str[20]; - snprintf(&str[0], 20, "%d", subbrute_worker_get_timeout(instance->worker)); + const uint8_t index = variable_item_get_current_value_index(item); + uint8_t val = subbrute_worker_get_timeout(instance->worker); - widget_add_string_element( - instance->widget, 64, 15, AlignCenter, AlignCenter, FontPrimary, "Time Delay"); - - widget_add_string_element( - instance->widget, 64, 32, AlignCenter, AlignCenter, FontBigNumbers, &str[0]); + if(index == 0) { + if(val > MIN_TD) { + val--; + subbrute_worker_set_timeout(instance->worker, val); + snprintf(&buf[0], 5, "%d", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MIN_TD) { + variable_item_set_current_value_index(item, 0); + } + } + } else if(index == 2) { + if(val < MAX_TD) { + val++; + subbrute_worker_set_timeout(instance->worker, val); + snprintf(&buf[0], 5, "%d", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MAX_TD) { + variable_item_set_current_value_index(item, 2); + } + } + } else if(index == 1) { + if(val == MIN_TD) { + val++; + subbrute_worker_set_timeout(instance->worker, val); + snprintf(&buf[0], 5, "%d", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MAX_TD) { + variable_item_set_current_value_index(item, 2); + } + } else if(val == MAX_TD) { + val--; + subbrute_worker_set_timeout(instance->worker, val); + snprintf(&buf[0], 5, "%d", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MIN_TD) { + variable_item_set_current_value_index(item, 0); + } + } + } } -void setup_extra_widget_callback(GuiButtonType result, InputType type, void* context) { +static void setup_extra_rep_callback(VariableItem* item) { + furi_assert(item); + SubBruteState* instance = variable_item_get_context(item); + furi_assert(instance); + char buf[6]; + + const uint8_t index = variable_item_get_current_value_index(item); + uint8_t val = subbrute_worker_get_repeats(instance->worker); + + if(index == 0) { + if(val > MIN_REP) { + val--; + subbrute_worker_set_repeats(instance->worker, val); + snprintf(&buf[0], 5, "%d", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MIN_REP) { + variable_item_set_current_value_index(item, 0); + } + } + } else if(index == 2) { + if(val < MAX_REP) { + val++; + subbrute_worker_set_repeats(instance->worker, val); + snprintf(&buf[0], 5, "%d", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MAX_REP) { + variable_item_set_current_value_index(item, 2); + } + } + } else if(index == 1) { + if(val == MIN_REP) { + val++; + subbrute_worker_set_repeats(instance->worker, val); + snprintf(&buf[0], 5, "%d", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MAX_REP) { + variable_item_set_current_value_index(item, 2); + } + } else if(val == MAX_REP) { + val--; + subbrute_worker_set_repeats(instance->worker, val); + snprintf(&buf[0], 5, "%d", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MIN_REP) { + variable_item_set_current_value_index(item, 0); + } + } + } +} + +static void setup_extra_te_callback(VariableItem* item) { + furi_assert(item); + SubBruteState* instance = variable_item_get_context(item); + furi_assert(instance); + char buf[6]; + + const uint8_t index = variable_item_get_current_value_index(item); + uint32_t val = subbrute_worker_get_te(instance->worker); + + if(index == 0) { + if(val > MIN_TE) { + val--; + subbrute_worker_set_te(instance->worker, val); + snprintf(&buf[0], 5, "%ld", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MIN_TE) { + variable_item_set_current_value_index(item, 0); + } + } + } else if(index == 2) { + if(val < MAX_TE) { + val++; + subbrute_worker_set_te(instance->worker, val); + snprintf(&buf[0], 5, "%ld", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MAX_TE) { + variable_item_set_current_value_index(item, 2); + } + } + } else if(index == 1) { + if(val == MIN_TE) { + val++; + subbrute_worker_set_te(instance->worker, val); + snprintf(&buf[0], 5, "%ld", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MAX_TE) { + variable_item_set_current_value_index(item, 2); + } + } else if(val == MAX_TE) { + val--; + subbrute_worker_set_te(instance->worker, val); + snprintf(&buf[0], 5, "%ld", val); + variable_item_set_current_value_text(item, &buf[0]); + variable_item_set_current_value_index(item, 1); + if(val == MIN_TE) { + variable_item_set_current_value_index(item, 0); + } + } + } +} + +static void subbrute_scene_setup_extra_init_var_list(SubBruteState* instance, bool on_extra) { + furi_assert(instance); + char str[6]; + VariableItem* item; + static bool extra = false; + if(on_extra) { + extra = true; + } + + VariableItemList* var_list = instance->var_list; + + variable_item_list_reset(var_list); + + item = variable_item_list_add(var_list, "TimeDelay", 3, setup_extra_td_callback, instance); + snprintf(&str[0], 5, "%d", subbrute_worker_get_timeout(instance->worker)); + variable_item_set_current_value_text(item, &str[0]); + switch(subbrute_worker_get_timeout(instance->worker)) { + case MIN_TD: + variable_item_set_current_value_index(item, 0); + break; + case MAX_TD: + variable_item_set_current_value_index(item, 2); + break; + + default: + variable_item_set_current_value_index(item, 1); + break; + } + + if(extra) { + item = variable_item_list_add(var_list, "Repeats", 3, setup_extra_rep_callback, instance); + snprintf(&str[0], 5, "%d", subbrute_worker_get_repeats(instance->worker)); + variable_item_set_current_value_text(item, &str[0]); + switch(subbrute_worker_get_repeats(instance->worker)) { + case MIN_REP: + variable_item_set_current_value_index(item, 0); + break; + case MAX_REP: + variable_item_set_current_value_index(item, 2); + break; + + default: + variable_item_set_current_value_index(item, 1); + break; + } + const uint32_t te = subbrute_worker_get_te(instance->worker); + if(te != 0) { + item = variable_item_list_add(var_list, "Te", 3, setup_extra_te_callback, instance); + snprintf(&str[0], 5, "%ld", te); + variable_item_set_current_value_text(item, &str[0]); + switch(te) { + case MIN_TE: + variable_item_set_current_value_index(item, 0); + break; + case MAX_TE: + variable_item_set_current_value_index(item, 2); + break; + + default: + variable_item_set_current_value_index(item, 1); + break; + } + } + } else { + item = variable_item_list_add(var_list, "Show Extra", 0, NULL, NULL); + } + + variable_item_list_set_enter_callback(var_list, setup_extra_enter_callback, instance); + view_dispatcher_switch_to_view(instance->view_dispatcher, SubBruteViewVarList); +} + +static void setup_extra_enter_callback(void* context, uint32_t index) { furi_assert(context); SubBruteState* instance = context; - if((result == GuiButtonTypeLeft) && ((type == InputTypeShort) || (type == InputTypeRepeat))) { - widget_reset(instance->widget); - subbrute_worker_timeout_dec(instance->worker); - setup_extra_widget_draw(instance); - } else if( - (result == GuiButtonTypeRight) && - ((type == InputTypeShort) || (type == InputTypeRepeat))) { - widget_reset(instance->widget); - subbrute_worker_timeout_inc(instance->worker); - setup_extra_widget_draw(instance); + if(index == SubBruteVarListIndexRepeat_or_OnExtra) { + subbrute_scene_setup_extra_init_var_list(instance, true); } } @@ -47,16 +264,14 @@ void subbrute_scene_setup_extra_on_enter(void* context) { furi_assert(context); SubBruteState* instance = context; - setup_extra_widget_draw(instance); - - view_dispatcher_switch_to_view(instance->view_dispatcher, SubBruteViewWidget); + subbrute_scene_setup_extra_init_var_list(instance, false); } void subbrute_scene_setup_extra_on_exit(void* context) { furi_assert(context); SubBruteState* instance = context; - widget_reset(instance->widget); + variable_item_list_reset(instance->var_list); } bool subbrute_scene_setup_extra_on_event(void* context, SceneManagerEvent event) { diff --git a/applications/external/subghz_bruteforcer/subbrute.c b/applications/external/subghz_bruteforcer/subbrute.c index 75506f2c2..65e3616ce 100644 --- a/applications/external/subghz_bruteforcer/subbrute.c +++ b/applications/external/subghz_bruteforcer/subbrute.c @@ -76,6 +76,13 @@ SubBruteState* subbrute_alloc() { view_dispatcher_add_view( instance->view_dispatcher, SubBruteViewWidget, widget_get_view(instance->widget)); + // VarList + instance->var_list = variable_item_list_alloc(); + view_dispatcher_add_view( + instance->view_dispatcher, + SubBruteViewVarList, + variable_item_list_get_view(instance->var_list)); + // Popup instance->popup = popup_alloc(); view_dispatcher_add_view( @@ -145,6 +152,10 @@ void subbrute_free(SubBruteState* instance) { view_dispatcher_remove_view(instance->view_dispatcher, SubBruteViewWidget); widget_free(instance->widget); + // VarList + view_dispatcher_remove_view(instance->view_dispatcher, SubBruteViewVarList); + variable_item_list_free(instance->var_list); + // Popup view_dispatcher_remove_view(instance->view_dispatcher, SubBruteViewPopup); popup_free(instance->popup); diff --git a/applications/external/subghz_bruteforcer/subbrute_device.c b/applications/external/subghz_bruteforcer/subbrute_device.c index 01ed74b36..48d4e4bc4 100644 --- a/applications/external/subghz_bruteforcer/subbrute_device.c +++ b/applications/external/subghz_bruteforcer/subbrute_device.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include #define TAG "SubBruteDevice" diff --git a/applications/external/subghz_bruteforcer/subbrute_i.h b/applications/external/subghz_bruteforcer/subbrute_i.h index 6f8f3ac09..bab48dc20 100644 --- a/applications/external/subghz_bruteforcer/subbrute_i.h +++ b/applications/external/subghz_bruteforcer/subbrute_i.h @@ -15,7 +15,9 @@ #include #include #include +#include +#include "subghz_bruteforcer_icons.h" #include #include @@ -29,7 +31,7 @@ #include "views/subbrute_attack_view.h" #include "views/subbrute_main_view.h" -#define SUBBRUTEFORCER_VER "Sub-GHz BruteForcer 3.6" +#define SUBBRUTEFORCER_VER "Sub-GHz BruteForcer 3.7" #ifdef FURI_DEBUG //#define SUBBRUTE_FAST_TRACK false @@ -44,6 +46,7 @@ typedef enum { SubBruteViewPopup, SubBruteViewWidget, SubBruteViewStack, + SubBruteViewVarList, } SubBruteView; struct SubBruteState { @@ -55,6 +58,7 @@ struct SubBruteState { TextInput* text_input; Popup* popup; Widget* widget; + VariableItemList* var_list; DialogsApp* dialogs; const SubGhzDevice* radio_device; diff --git a/applications/external/subghz_bruteforcer/views/subbrute_attack_view.c b/applications/external/subghz_bruteforcer/views/subbrute_attack_view.c index c05fb8084..2e5a73de7 100644 --- a/applications/external/subghz_bruteforcer/views/subbrute_attack_view.c +++ b/applications/external/subghz_bruteforcer/views/subbrute_attack_view.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #define TAG "SubBruteAttackView" @@ -19,7 +19,7 @@ struct SubBruteAttackView { uint64_t max_value; uint64_t current_step; bool is_attacking; - uint8_t extra_repeats; + // uint8_t extra_repeats; }; typedef struct { @@ -226,7 +226,7 @@ void subbrute_attack_view_init_values( instance->max_value = max_value; instance->current_step = current_step; instance->is_attacking = is_attacking; - instance->extra_repeats = extra_repeats; + // instance->extra_repeats = extra_repeats; with_view_model( instance->view, @@ -308,7 +308,7 @@ void subbrute_attack_view_draw(Canvas* canvas, void* context) { buffer, sizeof(buffer), "x%d", - model->extra_repeats + subbrute_protocol_repeats_count(model->attack_type)); + model->extra_repeats); // + subbrute_protocol_repeats_count(model->attack_type)); canvas_draw_str_aligned(canvas, 60, 6, AlignCenter, AlignCenter, buffer); elements_button_left(canvas, "-1"); @@ -335,7 +335,7 @@ void subbrute_attack_view_draw(Canvas* canvas, void* context) { buffer, sizeof(buffer), "x%d", - model->extra_repeats + subbrute_protocol_repeats_count(model->attack_type)); + model->extra_repeats); // + subbrute_protocol_repeats_count(model->attack_type)); canvas_draw_str(canvas, 4, y - 8, buffer); canvas_draw_str(canvas, 4, y - 1, "repeats"); diff --git a/applications/external/subghz_bruteforcer/views/subbrute_main_view.c b/applications/external/subghz_bruteforcer/views/subbrute_main_view.c index 925188db1..921ed6b6e 100644 --- a/applications/external/subghz_bruteforcer/views/subbrute_main_view.c +++ b/applications/external/subghz_bruteforcer/views/subbrute_main_view.c @@ -174,7 +174,11 @@ void subbrute_main_view_draw(Canvas* canvas, SubBruteMainViewModel* model) { subbrute_protocol_name(position)); if(model->extra_repeats > 0) { +#ifdef FW_ORIGIN_Official + canvas_set_font(canvas, FontSecondary); +#else canvas_set_font(canvas, FontBatteryPercent); +#endif char buffer[10]; snprintf( buffer, diff --git a/applications/external/subghz_remote/application.fam b/applications/external/subghz_remote/application.fam index b175f8c8d..7eee1369f 100644 --- a/applications/external/subghz_remote/application.fam +++ b/applications/external/subghz_remote/application.fam @@ -5,7 +5,7 @@ App( entry_point="subghz_remote_app", stack_size=2 * 1024, order=11, - fap_icon="subrem_10px.png", + fap_icon="icon.png", fap_description="SubGhz Remote, uses up to 5 .sub files", fap_category="Sub-GHz", ) diff --git a/applications/external/subghz_remote/helpers/txrx/Readme.md b/applications/external/subghz_remote/helpers/txrx/Readme.md new file mode 100644 index 000000000..918160198 --- /dev/null +++ b/applications/external/subghz_remote/helpers/txrx/Readme.md @@ -0,0 +1,4 @@ +This is part of the official `SubGhz` app from [flipperzero-firmware](https://github.com/flipperdevices/flipperzero-firmware/tree/3217f286f03da119398586daf94c0723d28b872a/applications/main/subghz) + +With changes from [unleashed-firmware +](https://github.com/DarkFlippers/unleashed-firmware/tree/3eac6ccd48a3851cf5d63bf7899b387a293e5319/applications/main/subghz) \ No newline at end of file diff --git a/applications/external/subghz_remote/subrem_10px.png b/applications/external/subghz_remote/icon.png similarity index 100% rename from applications/external/subghz_remote/subrem_10px.png rename to applications/external/subghz_remote/icon.png diff --git a/applications/external/wiiec/wii_anal.c b/applications/external/wiiec/wii_anal.c index 5882dd60b..2a8270fd4 100644 --- a/applications/external/wiiec/wii_anal.c +++ b/applications/external/wiiec/wii_anal.c @@ -387,7 +387,7 @@ int32_t wii_ec_anal(void) { // ==================== Main event loop ==================== if(state->run) do { - bool redraw = false; + //bool redraw = false; FuriStatus status = FuriStatusErrorTimeout; // Wait for a message @@ -474,7 +474,7 @@ int32_t wii_ec_anal(void) { } // *** Update the GUI screen via the viewport *** - if(redraw) view_port_update(vpp); + view_port_update(vpp); // *** Try to release the plugin state variables *** if(furi_mutex_release(state->mutex) != FuriStatusOk) {