|
|
@@ -43,6 +43,11 @@ void evil_portal_scene_console_output_on_enter(void *context) {
|
|
|
"WIP.\ngithub.com/bigbrodude6119/flipper-zero-evil-portal\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"))) {
|
|
|
@@ -50,42 +55,34 @@ void evil_portal_scene_console_output_on_enter(void *context) {
|
|
|
furi_string_cat_str(app->text_box_store, help_msg);
|
|
|
app->text_box_store_strlen += strlen(help_msg);
|
|
|
write_logs(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("sethtml", app->selected_tx_string, strlen("sethtml"))) {
|
|
|
- // create a command queue
|
|
|
- // add sethtml
|
|
|
- // add setap
|
|
|
- // add start
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- // if (!app->sent_html) {
|
|
|
- // const char *help_msg = "Set HTML before\nstarting portal.\n\n";
|
|
|
- // furi_string_cat_str(app->text_box_store, help_msg);
|
|
|
- // app->text_box_store_strlen += strlen(help_msg);
|
|
|
- // } else if (!app->sent_ap) {
|
|
|
- // const char *help_msg = "Set ap name before\nstarting portal.\n\n";
|
|
|
- // furi_string_cat_str(app->text_box_store, help_msg);
|
|
|
- // app->text_box_store_strlen += strlen(help_msg);
|
|
|
- // }
|
|
|
-
|
|
|
- // app->command_queue[0] = "sethtml";
|
|
|
- app->command_queue[0] = "setap";
|
|
|
- // app->command_queue[1] = "start";
|
|
|
+ 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\nPress BACK to return\n";
|
|
|
+ furi_string_cat_str(app->text_box_store, msg);
|
|
|
+ app->text_box_store_strlen += strlen(msg);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- if (app->show_stopscan_tip) {
|
|
|
- const char *help_msg = "Press BACK to return\n";
|
|
|
- furi_string_cat_str(app->text_box_store, help_msg);
|
|
|
- app->text_box_store_strlen += strlen(help_msg);
|
|
|
+ if (0 == strncmp(RESET_CMD, app->selected_tx_string, strlen(RESET_CMD))) {
|
|
|
+ if (app->show_stopscan_tip) {
|
|
|
+ const char *msg = "Reseting portal\nPress BACK to return\n";
|
|
|
+ furi_string_cat_str(app->text_box_store, msg);
|
|
|
+ app->text_box_store_strlen += strlen(msg);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Set starting text - for "View Log", this will just be what was already in
|
|
|
- // the text box store
|
|
|
text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store));
|
|
|
|
|
|
scene_manager_set_scene_state(app->scene_manager,
|
|
|
@@ -95,16 +92,10 @@ void evil_portal_scene_console_output_on_enter(void *context) {
|
|
|
|
|
|
// Register callback to receive data
|
|
|
evil_portal_uart_set_handle_rx_data_cb(
|
|
|
- app->uart,
|
|
|
- evil_portal_console_output_handle_rx_data_cb); // setup callback for rx
|
|
|
- // thread
|
|
|
+ app->uart, evil_portal_console_output_handle_rx_data_cb);
|
|
|
|
|
|
- // Send command with CR+LF or newline '\n'
|
|
|
- // it is sent here
|
|
|
if (app->is_command && app->selected_tx_string) {
|
|
|
-
|
|
|
- // handle special commands here
|
|
|
- if (0 == strncmp("sethtml", app->selected_tx_string, strlen("sethtml"))) {
|
|
|
+ if (0 == strncmp(SET_HTML_CMD, app->selected_tx_string, strlen(SET_HTML_CMD))) {
|
|
|
evil_portal_read_index_html(context);
|
|
|
|
|
|
char *data = malloc(
|
|
|
@@ -122,32 +113,13 @@ void evil_portal_scene_console_output_on_enter(void *context) {
|
|
|
|
|
|
evil_portal_read_ap_name(context);
|
|
|
} else if (0 ==
|
|
|
- strncmp("setap", app->selected_tx_string, strlen("setap"))) {
|
|
|
-
|
|
|
- evil_portal_read_ap_name(context);
|
|
|
-
|
|
|
- char *data =
|
|
|
- malloc((size_t)(strlen((char *)app->ap_name) + strlen("setap=")));
|
|
|
- strcat(data, "setap=");
|
|
|
- strcat(data, (char *)app->ap_name);
|
|
|
-
|
|
|
- evil_portal_uart_tx((uint8_t *)(data), strlen(data));
|
|
|
- evil_portal_uart_tx((uint8_t *)("\n"), 1);
|
|
|
-
|
|
|
- app->sent_ap = true;
|
|
|
-
|
|
|
- free(data);
|
|
|
- free(app->ap_name);
|
|
|
- } else if (0 ==
|
|
|
- strncmp("reset", app->selected_tx_string, strlen("reset"))) {
|
|
|
+ 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 (0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
|
|
|
- // nothing to do
|
|
|
- } else {
|
|
|
+ } 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);
|