Преглед изворни кода

Format with ./fbt format, as suggested by @xMasterX

0xchocolate пре 3 година
родитељ
комит
6742f81818

+ 14 - 11
applications/wifi_marauder_companion/scenes/wifi_marauder_scene_console_output.c

@@ -1,12 +1,12 @@
 #include "../wifi_marauder_app_i.h"
 #include "../wifi_marauder_app_i.h"
 
 
-void wifi_marauder_console_output_handle_rx_data_cb(uint8_t *buf, size_t len, void* context) {
+void wifi_marauder_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, void* context) {
     furi_assert(context);
     furi_assert(context);
     WifiMarauderApp* app = context;
     WifiMarauderApp* app = context;
 
 
     // If text box store gets too big, then truncate it
     // If text box store gets too big, then truncate it
     app->text_box_store_strlen += len;
     app->text_box_store_strlen += len;
-    if (app->text_box_store_strlen >= WIFI_MARAUDER_TEXT_BOX_STORE_SIZE - 1) {
+    if(app->text_box_store_strlen >= WIFI_MARAUDER_TEXT_BOX_STORE_SIZE - 1) {
         string_right(app->text_box_store, app->text_box_store_strlen / 2);
         string_right(app->text_box_store, app->text_box_store_strlen / 2);
         app->text_box_store_strlen = string_size(app->text_box_store) + len;
         app->text_box_store_strlen = string_size(app->text_box_store) + len;
     }
     }
@@ -24,21 +24,22 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
     TextBox* text_box = app->text_box;
     TextBox* text_box = app->text_box;
     text_box_reset(app->text_box);
     text_box_reset(app->text_box);
     text_box_set_font(text_box, TextBoxFontText);
     text_box_set_font(text_box, TextBoxFontText);
-    if (app->focus_console_start) {
+    if(app->focus_console_start) {
         text_box_set_focus(text_box, TextBoxFocusStart);
         text_box_set_focus(text_box, TextBoxFocusStart);
     } else {
     } else {
         text_box_set_focus(text_box, TextBoxFocusEnd);
         text_box_set_focus(text_box, TextBoxFocusEnd);
     }
     }
-    if (app->is_command) {
+    if(app->is_command) {
         string_reset(app->text_box_store);
         string_reset(app->text_box_store);
         app->text_box_store_strlen = 0;
         app->text_box_store_strlen = 0;
-        if (0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
-            const char* help_msg = "For app support/feedback,\nreach out to me:\n@cococode#6011 (discord)\n0xchocolate (github)\n";
+        if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
+            const char* help_msg =
+                "For app support/feedback,\nreach out to me:\n@cococode#6011 (discord)\n0xchocolate (github)\n";
             string_cat_str(app->text_box_store, help_msg);
             string_cat_str(app->text_box_store, help_msg);
             app->text_box_store_strlen += strlen(help_msg);
             app->text_box_store_strlen += strlen(help_msg);
         }
         }
 
 
-        if (app->show_stopscan_tip) {
+        if(app->show_stopscan_tip) {
             const char* help_msg = "Press BACK to send stopscan\n";
             const char* help_msg = "Press BACK to send stopscan\n";
             string_cat_str(app->text_box_store, help_msg);
             string_cat_str(app->text_box_store, help_msg);
             app->text_box_store_strlen += strlen(help_msg);
             app->text_box_store_strlen += strlen(help_msg);
@@ -52,11 +53,13 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
     view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewConsoleOutput);
     view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewConsoleOutput);
 
 
     // Register callback to receive data
     // Register callback to receive data
-    wifi_marauder_uart_set_handle_rx_data_cb(app->uart, wifi_marauder_console_output_handle_rx_data_cb); // setup callback for rx thread
+    wifi_marauder_uart_set_handle_rx_data_cb(
+        app->uart, wifi_marauder_console_output_handle_rx_data_cb); // setup callback for rx thread
 
 
     // Send command with newline '\n'
     // Send command with newline '\n'
-    if (app->is_command && app->selected_tx_string) {
-        wifi_marauder_uart_tx((uint8_t*)(app->selected_tx_string), strlen(app->selected_tx_string));
+    if(app->is_command && app->selected_tx_string) {
+        wifi_marauder_uart_tx(
+            (uint8_t*)(app->selected_tx_string), strlen(app->selected_tx_string));
         wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
         wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
     }
     }
 }
 }
@@ -83,7 +86,7 @@ void wifi_marauder_scene_console_output_on_exit(void* context) {
     wifi_marauder_uart_set_handle_rx_data_cb(app->uart, NULL);
     wifi_marauder_uart_set_handle_rx_data_cb(app->uart, NULL);
 
 
     // Automatically stop the scan when exiting view
     // Automatically stop the scan when exiting view
-    if (app->is_command) {
+    if(app->is_command) {
         wifi_marauder_uart_tx((uint8_t*)("stopscan\n"), strlen("stopscan\n"));
         wifi_marauder_uart_tx((uint8_t*)("stopscan\n"), strlen("stopscan\n"));
     }
     }
 }
 }

+ 93 - 38
applications/wifi_marauder_companion/scenes/wifi_marauder_scene_start.c

@@ -3,17 +3,9 @@
 // For each command, define whether additional arguments are needed
 // For each command, define whether additional arguments are needed
 // (enabling text input to fill them out), and whether the console
 // (enabling text input to fill them out), and whether the console
 // text box should focus at the start of the output or the end
 // 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;
+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 SHOW_STOPSCAN_TIP (true)
 #define NO_TIP (false)
 #define NO_TIP (false)
@@ -31,24 +23,76 @@ typedef struct {
 
 
 // NUM_MENU_ITEMS defined in wifi_marauder_app_i.h - if you add an entry here, increment it!
 // NUM_MENU_ITEMS defined in wifi_marauder_app_i.h - if you add an entry here, increment it!
 const WifiMarauderItem items[NUM_MENU_ITEMS] = {
 const WifiMarauderItem items[NUM_MENU_ITEMS] = {
-    { "View Log from", {"start", "end"}, 2, {"", ""}, NO_ARGS, FOCUS_CONSOLE_TOGGLE, NO_TIP },
-    { "Scan AP", {""}, 1, {"scanap"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP },
-    { "SSID", {"add random", "add name", "remove"}, 3, {"ssid -a -g", "ssid -a -n", "ssid -r"}, INPUT_ARGS, FOCUS_CONSOLE_START, NO_TIP },
-    { "List", {"ap", "ssid"}, 2, {"list -a", "list -s"}, NO_ARGS, FOCUS_CONSOLE_START, NO_TIP },
-    { "Select", {"ap", "ssid"}, 2, {"select -a", "select -s"}, INPUT_ARGS, FOCUS_CONSOLE_END, NO_TIP },
-    { "Clear List", {"ap", "ssid"}, 2, {"clearlist -a", "clearlist -s"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP },
-    { "Attack", {"deauth", "probe", "rickroll"}, 3, {"attack -t deauth", "attack -t probe", "attack -t rickroll"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP },
-    { "Beacon Spam", {"ap list", "ssid list", "random"}, 3, {"attack -t beacon -a", "attack -t beacon -l", "attack -t beacon -r"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP },
-    { "Sniff", {"beacon", "deauth", "esp", "pmkid", "pwn"}, 5, {"sniffbeacon", "sniffdeauth", "sniffesp", "sniffpmkid", "sniffpwn"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP },
-    { "Sniff PMKID on channel", {""}, 1, {"sniffpmkid -c"}, INPUT_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP },
-    { "Channel", {"get", "set"}, 2, {"channel", "channel -s"}, TOGGLE_ARGS, FOCUS_CONSOLE_END, NO_TIP },
-    { "Settings", {"display", "restore", "ForcePMKID", "ForceProbe", "SavePCAP", "other"}, 6, {"settings", "settings -r", "settings -s ForcePMKID enable", "settings -s ForceProbe enable", "settings -s SavePCAP enable", "settings -s"}, TOGGLE_ARGS, FOCUS_CONSOLE_START, NO_TIP },
-    { "Update", {""}, 1, {"update -w"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP },
-    { "Reboot", {""}, 1, {"reboot"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP },
-    { "Help", {""}, 1, {"help"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP },
+    {"View Log from", {"start", "end"}, 2, {"", ""}, NO_ARGS, FOCUS_CONSOLE_TOGGLE, NO_TIP},
+    {"Scan AP", {""}, 1, {"scanap"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP},
+    {"SSID",
+     {"add random", "add name", "remove"},
+     3,
+     {"ssid -a -g", "ssid -a -n", "ssid -r"},
+     INPUT_ARGS,
+     FOCUS_CONSOLE_START,
+     NO_TIP},
+    {"List", {"ap", "ssid"}, 2, {"list -a", "list -s"}, NO_ARGS, FOCUS_CONSOLE_START, NO_TIP},
+    {"Select", {"ap", "ssid"}, 2, {"select -a", "select -s"}, INPUT_ARGS, FOCUS_CONSOLE_END, NO_TIP},
+    {"Clear List",
+     {"ap", "ssid"},
+     2,
+     {"clearlist -a", "clearlist -s"},
+     NO_ARGS,
+     FOCUS_CONSOLE_END,
+     NO_TIP},
+    {"Attack",
+     {"deauth", "probe", "rickroll"},
+     3,
+     {"attack -t deauth", "attack -t probe", "attack -t rickroll"},
+     NO_ARGS,
+     FOCUS_CONSOLE_END,
+     SHOW_STOPSCAN_TIP},
+    {"Beacon Spam",
+     {"ap list", "ssid list", "random"},
+     3,
+     {"attack -t beacon -a", "attack -t beacon -l", "attack -t beacon -r"},
+     NO_ARGS,
+     FOCUS_CONSOLE_END,
+     SHOW_STOPSCAN_TIP},
+    {"Sniff",
+     {"beacon", "deauth", "esp", "pmkid", "pwn"},
+     5,
+     {"sniffbeacon", "sniffdeauth", "sniffesp", "sniffpmkid", "sniffpwn"},
+     NO_ARGS,
+     FOCUS_CONSOLE_END,
+     SHOW_STOPSCAN_TIP},
+    {"Sniff PMKID on channel",
+     {""},
+     1,
+     {"sniffpmkid -c"},
+     INPUT_ARGS,
+     FOCUS_CONSOLE_END,
+     SHOW_STOPSCAN_TIP},
+    {"Channel",
+     {"get", "set"},
+     2,
+     {"channel", "channel -s"},
+     TOGGLE_ARGS,
+     FOCUS_CONSOLE_END,
+     NO_TIP},
+    {"Settings",
+     {"display", "restore", "ForcePMKID", "ForceProbe", "SavePCAP", "other"},
+     6,
+     {"settings",
+      "settings -r",
+      "settings -s ForcePMKID enable",
+      "settings -s ForceProbe enable",
+      "settings -s SavePCAP enable",
+      "settings -s"},
+     TOGGLE_ARGS,
+     FOCUS_CONSOLE_START,
+     NO_TIP},
+    {"Update", {""}, 1, {"update -w"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP},
+    {"Reboot", {""}, 1, {"reboot"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP},
+    {"Help", {""}, 1, {"help"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP},
 };
 };
 
 
-
 static void wifi_marauder_scene_start_var_list_enter_callback(void* context, uint32_t index) {
 static void wifi_marauder_scene_start_var_list_enter_callback(void* context, uint32_t index) {
     furi_assert(context);
     furi_assert(context);
     WifiMarauderApp* app = context;
     WifiMarauderApp* app = context;
@@ -62,11 +106,14 @@ static void wifi_marauder_scene_start_var_list_enter_callback(void* context, uin
     app->is_command = (1 <= index);
     app->is_command = (1 <= index);
     app->is_custom_tx_string = false;
     app->is_custom_tx_string = false;
     app->selected_menu_index = index;
     app->selected_menu_index = index;
-    app->focus_console_start = (item->focus_console == FOCUS_CONSOLE_TOGGLE) ? (selected_option_index == 0) : item->focus_console;
+    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;
     app->show_stopscan_tip = item->show_stopscan_tip;
 
 
-    bool needs_keyboard = (item->needs_keyboard == TOGGLE_ARGS) ? (selected_option_index != 0) : item->needs_keyboard;
-    if (needs_keyboard) {
+    bool needs_keyboard = (item->needs_keyboard == TOGGLE_ARGS) ? (selected_option_index != 0) :
+                                                                  item->needs_keyboard;
+    if(needs_keyboard) {
         view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartKeyboard);
         view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartKeyboard);
     } else {
     } else {
         view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartConsole);
         view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartConsole);
@@ -94,10 +141,16 @@ void wifi_marauder_scene_start_on_enter(void* context) {
         var_item_list, wifi_marauder_scene_start_var_list_enter_callback, app);
         var_item_list, wifi_marauder_scene_start_var_list_enter_callback, app);
 
 
     VariableItem* item;
     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, wifi_marauder_scene_start_var_list_change_callback, app);
+    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,
+            wifi_marauder_scene_start_var_list_change_callback,
+            app);
         variable_item_set_current_value_index(item, app->selected_option_index[i]);
         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_set_current_value_text(
+            item, items[i].options_menu[app->selected_option_index[i]]);
     }
     }
 
 
     variable_item_list_set_selected_item(
     variable_item_list_set_selected_item(
@@ -112,15 +165,17 @@ bool wifi_marauder_scene_start_on_event(void* context, SceneManagerEvent event)
     bool consumed = false;
     bool consumed = false;
 
 
     if(event.type == SceneManagerEventTypeCustom) {
     if(event.type == SceneManagerEventTypeCustom) {
-        if (event.event == WifiMarauderEventStartKeyboard) {
-            scene_manager_set_scene_state(app->scene_manager, WifiMarauderSceneStart, app->selected_menu_index);
+        if(event.event == WifiMarauderEventStartKeyboard) {
+            scene_manager_set_scene_state(
+                app->scene_manager, WifiMarauderSceneStart, app->selected_menu_index);
             scene_manager_next_scene(app->scene_manager, WifiMarauderAppViewTextInput);
             scene_manager_next_scene(app->scene_manager, WifiMarauderAppViewTextInput);
-        } else if (event.event == WifiMarauderEventStartConsole) {
-            scene_manager_set_scene_state(app->scene_manager, WifiMarauderSceneStart, app->selected_menu_index);
+        } else if(event.event == WifiMarauderEventStartConsole) {
+            scene_manager_set_scene_state(
+                app->scene_manager, WifiMarauderSceneStart, app->selected_menu_index);
             scene_manager_next_scene(app->scene_manager, WifiMarauderAppViewConsoleOutput);
             scene_manager_next_scene(app->scene_manager, WifiMarauderAppViewConsoleOutput);
         }
         }
         consumed = true;
         consumed = true;
-    } else if (event.type == SceneManagerEventTypeTick) {
+    } else if(event.type == SceneManagerEventTypeTick) {
         app->selected_menu_index = variable_item_list_get_selected_item_index(app->var_item_list);
         app->selected_menu_index = variable_item_list_get_selected_item_index(app->var_item_list);
         consumed = true;
         consumed = true;
     }
     }

+ 16 - 11
applications/wifi_marauder_companion/scenes/wifi_marauder_scene_text_input.c

@@ -1,6 +1,5 @@
 #include "../wifi_marauder_app_i.h"
 #include "../wifi_marauder_app_i.h"
 
 
-
 void wifi_marauder_scene_text_input_callback(void* context) {
 void wifi_marauder_scene_text_input_callback(void* context) {
     WifiMarauderApp* app = context;
     WifiMarauderApp* app = context;
 
 
@@ -10,7 +9,7 @@ void wifi_marauder_scene_text_input_callback(void* context) {
 void wifi_marauder_scene_text_input_on_enter(void* context) {
 void wifi_marauder_scene_text_input_on_enter(void* context) {
     WifiMarauderApp* app = context;
     WifiMarauderApp* app = context;
 
 
-    if (false == app->is_custom_tx_string) {
+    if(false == app->is_custom_tx_string) {
         // Fill text input with selected string so that user can add to it
         // Fill text input with selected string so that user can add to it
         size_t length = strlen(app->selected_tx_string);
         size_t length = strlen(app->selected_tx_string);
         furi_assert(length < WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE);
         furi_assert(length < WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE);
@@ -19,27 +18,33 @@ void wifi_marauder_scene_text_input_on_enter(void* context) {
 
 
         // Add space - because flipper keyboard currently doesn't have a space
         // Add space - because flipper keyboard currently doesn't have a space
         app->text_input_store[length] = ' ';
         app->text_input_store[length] = ' ';
-        app->text_input_store[length+1] = '\0';
+        app->text_input_store[length + 1] = '\0';
         app->is_custom_tx_string = true;
         app->is_custom_tx_string = true;
     }
     }
 
 
     // Setup view
     // Setup view
     TextInput* text_input = app->text_input;
     TextInput* text_input = app->text_input;
     // Add help message to header
     // Add help message to header
-    if (0 == strncmp("ssid -a -g", app->selected_tx_string, strlen("ssid -a -g"))) {
+    if(0 == strncmp("ssid -a -g", app->selected_tx_string, strlen("ssid -a -g"))) {
         text_input_set_header_text(text_input, "Enter # SSIDs to generate");
         text_input_set_header_text(text_input, "Enter # SSIDs to generate");
-    } else if (0 == strncmp("ssid -a -n", app->selected_tx_string, strlen("ssid -a -n"))) {
+    } else if(0 == strncmp("ssid -a -n", app->selected_tx_string, strlen("ssid -a -n"))) {
         text_input_set_header_text(text_input, "Enter SSID name to add");
         text_input_set_header_text(text_input, "Enter SSID name to add");
-    } else if (0 == strncmp("ssid -r", app->selected_tx_string, strlen("ssid -r"))) {
+    } else if(0 == strncmp("ssid -r", app->selected_tx_string, strlen("ssid -r"))) {
         text_input_set_header_text(text_input, "Remove target from SSID list");
         text_input_set_header_text(text_input, "Remove target from SSID list");
-    } else if (0 == strncmp("select -a", app->selected_tx_string, strlen("select -a"))) {
+    } else if(0 == strncmp("select -a", app->selected_tx_string, strlen("select -a"))) {
         text_input_set_header_text(text_input, "Add target from AP list");
         text_input_set_header_text(text_input, "Add target from AP list");
-    } else if (0 == strncmp("select -s", app->selected_tx_string, strlen("select -s"))) {
+    } else if(0 == strncmp("select -s", app->selected_tx_string, strlen("select -s"))) {
         text_input_set_header_text(text_input, "Add target from SSID list");
         text_input_set_header_text(text_input, "Add target from SSID list");
     } else {
     } else {
         text_input_set_header_text(text_input, "Add command arguments");
         text_input_set_header_text(text_input, "Add command arguments");
     }
     }
-    text_input_set_result_callback(text_input, wifi_marauder_scene_text_input_callback, app, app->text_input_store, WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE, false);
+    text_input_set_result_callback(
+        text_input,
+        wifi_marauder_scene_text_input_callback,
+        app,
+        app->text_input_store,
+        WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE,
+        false);
 
 
     view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewTextInput);
     view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewTextInput);
 }
 }
@@ -48,8 +53,8 @@ bool wifi_marauder_scene_text_input_on_event(void* context, SceneManagerEvent ev
     WifiMarauderApp* app = context;
     WifiMarauderApp* app = context;
     bool consumed = false;
     bool consumed = false;
 
 
-    if (event.type == SceneManagerEventTypeCustom) {
-        if (event.event == WifiMarauderEventStartConsole) {
+    if(event.type == SceneManagerEventTypeCustom) {
+        if(event.event == WifiMarauderEventStartConsole) {
             // Point to custom string to send
             // Point to custom string to send
             app->selected_tx_string = app->text_input_store;
             app->selected_tx_string = app->text_input_store;
             scene_manager_next_scene(app->scene_manager, WifiMarauderAppViewConsoleOutput);
             scene_manager_next_scene(app->scene_manager, WifiMarauderAppViewConsoleOutput);

+ 7 - 5
applications/wifi_marauder_companion/wifi_marauder_app.c

@@ -24,7 +24,7 @@ static void wifi_marauder_app_tick_event_callback(void* context) {
 WifiMarauderApp* wifi_marauder_app_alloc() {
 WifiMarauderApp* wifi_marauder_app_alloc() {
     WifiMarauderApp* app = malloc(sizeof(WifiMarauderApp));
     WifiMarauderApp* app = malloc(sizeof(WifiMarauderApp));
 
 
-    app->gui = furi_record_open("gui");
+    app->gui = furi_record_open(RECORD_GUI);
 
 
     app->view_dispatcher = view_dispatcher_alloc();
     app->view_dispatcher = view_dispatcher_alloc();
     app->scene_manager = scene_manager_alloc(&wifi_marauder_scene_handlers, app);
     app->scene_manager = scene_manager_alloc(&wifi_marauder_scene_handlers, app);
@@ -46,17 +46,19 @@ WifiMarauderApp* wifi_marauder_app_alloc() {
         WifiMarauderAppViewVarItemList,
         WifiMarauderAppViewVarItemList,
         variable_item_list_get_view(app->var_item_list));
         variable_item_list_get_view(app->var_item_list));
 
 
-    for (int i = 0; i < NUM_MENU_ITEMS; ++i) {
+    for(int i = 0; i < NUM_MENU_ITEMS; ++i) {
         app->selected_option_index[i] = 0;
         app->selected_option_index[i] = 0;
     }
     }
 
 
     app->text_box = text_box_alloc();
     app->text_box = text_box_alloc();
-    view_dispatcher_add_view(app->view_dispatcher, WifiMarauderAppViewConsoleOutput, text_box_get_view(app->text_box));
+    view_dispatcher_add_view(
+        app->view_dispatcher, WifiMarauderAppViewConsoleOutput, text_box_get_view(app->text_box));
     string_init(app->text_box_store);
     string_init(app->text_box_store);
     string_reserve(app->text_box_store, WIFI_MARAUDER_TEXT_BOX_STORE_SIZE);
     string_reserve(app->text_box_store, WIFI_MARAUDER_TEXT_BOX_STORE_SIZE);
 
 
     app->text_input = text_input_alloc();
     app->text_input = text_input_alloc();
-    view_dispatcher_add_view(app->view_dispatcher, WifiMarauderAppViewTextInput, text_input_get_view(app->text_input));
+    view_dispatcher_add_view(
+        app->view_dispatcher, WifiMarauderAppViewTextInput, text_input_get_view(app->text_input));
 
 
     scene_manager_next_scene(app->scene_manager, WifiMarauderSceneStart);
     scene_manager_next_scene(app->scene_manager, WifiMarauderSceneStart);
 
 
@@ -81,7 +83,7 @@ void wifi_marauder_app_free(WifiMarauderApp* app) {
     wifi_marauder_uart_free(app->uart);
     wifi_marauder_uart_free(app->uart);
 
 
     // Close records
     // Close records
-    furi_record_close("gui");
+    furi_record_close(RECORD_GUI);
 
 
     free(app);
     free(app);
 }
 }

+ 9 - 8
applications/wifi_marauder_companion/wifi_marauder_uart.c

@@ -10,8 +10,8 @@ struct WifiMarauderUart {
     WifiMarauderApp* app;
     WifiMarauderApp* app;
     FuriThread* rx_thread;
     FuriThread* rx_thread;
     StreamBufferHandle_t rx_stream;
     StreamBufferHandle_t rx_stream;
-    uint8_t rx_buf[RX_BUF_SIZE+1];
-    void (*handle_rx_data_cb)(uint8_t *buf, size_t len, void* context);
+    uint8_t rx_buf[RX_BUF_SIZE + 1];
+    void (*handle_rx_data_cb)(uint8_t* buf, size_t len, void* context);
 };
 };
 
 
 typedef enum {
 typedef enum {
@@ -19,7 +19,9 @@ typedef enum {
     WorkerEvtRxDone = (1 << 1),
     WorkerEvtRxDone = (1 << 1),
 } WorkerEvtFlags;
 } WorkerEvtFlags;
 
 
-void wifi_marauder_uart_set_handle_rx_data_cb(WifiMarauderUart* uart, void (*handle_rx_data_cb)(uint8_t *buf, size_t len, void* context)) {
+void wifi_marauder_uart_set_handle_rx_data_cb(
+    WifiMarauderUart* uart,
+    void (*handle_rx_data_cb)(uint8_t* buf, size_t len, void* context)) {
     furi_assert(uart);
     furi_assert(uart);
     uart->handle_rx_data_cb = handle_rx_data_cb;
     uart->handle_rx_data_cb = handle_rx_data_cb;
 }
 }
@@ -48,10 +50,9 @@ static int32_t uart_worker(void* context) {
         furi_check((events & FuriFlagError) == 0);
         furi_check((events & FuriFlagError) == 0);
         if(events & WorkerEvtStop) break;
         if(events & WorkerEvtStop) break;
         if(events & WorkerEvtRxDone) {
         if(events & WorkerEvtRxDone) {
-            size_t len =
-                xStreamBufferReceive(uart->rx_stream, uart->rx_buf, RX_BUF_SIZE, 0);
+            size_t len = xStreamBufferReceive(uart->rx_stream, uart->rx_buf, RX_BUF_SIZE, 0);
             if(len > 0) {
             if(len > 0) {
-                if (uart->handle_rx_data_cb) uart->handle_rx_data_cb(uart->rx_buf, len, uart->app);
+                if(uart->handle_rx_data_cb) uart->handle_rx_data_cb(uart->rx_buf, len, uart->app);
             }
             }
         }
         }
     }
     }
@@ -61,12 +62,12 @@ static int32_t uart_worker(void* context) {
     return 0;
     return 0;
 }
 }
 
 
-void wifi_marauder_uart_tx(uint8_t *data, size_t len) {
+void wifi_marauder_uart_tx(uint8_t* data, size_t len) {
     furi_hal_uart_tx(UART_CH, data, len);
     furi_hal_uart_tx(UART_CH, data, len);
 }
 }
 
 
 WifiMarauderUart* wifi_marauder_uart_init(WifiMarauderApp* app) {
 WifiMarauderUart* wifi_marauder_uart_init(WifiMarauderApp* app) {
-    WifiMarauderUart *uart = malloc(sizeof(WifiMarauderUart));
+    WifiMarauderUart* uart = malloc(sizeof(WifiMarauderUart));
 
 
     furi_hal_console_disable();
     furi_hal_console_disable();
     furi_hal_uart_set_br(UART_CH, BAUDRATE);
     furi_hal_uart_set_br(UART_CH, BAUDRATE);

+ 4 - 2
applications/wifi_marauder_companion/wifi_marauder_uart.h

@@ -6,7 +6,9 @@
 
 
 typedef struct WifiMarauderUart WifiMarauderUart;
 typedef struct WifiMarauderUart WifiMarauderUart;
 
 
-void wifi_marauder_uart_set_handle_rx_data_cb(WifiMarauderUart* uart, void (*handle_rx_data_cb)(uint8_t *buf, size_t len, void* context));
-void wifi_marauder_uart_tx(uint8_t *data, size_t len);
+void wifi_marauder_uart_set_handle_rx_data_cb(
+    WifiMarauderUart* uart,
+    void (*handle_rx_data_cb)(uint8_t* buf, size_t len, void* context));
+void wifi_marauder_uart_tx(uint8_t* data, size_t len);
 WifiMarauderUart* wifi_marauder_uart_init(WifiMarauderApp* app);
 WifiMarauderUart* wifi_marauder_uart_init(WifiMarauderApp* app);
 void wifi_marauder_uart_free(WifiMarauderUart* uart);
 void wifi_marauder_uart_free(WifiMarauderUart* uart);