blackhat_app_i.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #pragma once
  2. #include <dialogs/dialogs.h>
  3. #include <gui/gui.h>
  4. #include <gui/modules/loading.h>
  5. #include <gui/modules/text_box.h>
  6. #include <gui/modules/text_input.h>
  7. #include <gui/modules/variable_item_list.h>
  8. #include <gui/scene_manager.h>
  9. #include <gui/view_dispatcher.h>
  10. #include <gui/view_stack.h>
  11. #include "blackhat_app.h"
  12. #include "blackhat_custom_event.h"
  13. #include "blackhat_uart.h"
  14. #include "scenes/blackhat_scene.h"
  15. #define NUM_MENU_ITEMS (15)
  16. #define BLACKHAT_TEXT_BOX_STORE_SIZE (4096)
  17. #define UART_CH FuriHalSerialIdUsart
  18. #define SHELL_CMD "whoami"
  19. #define WIFI_CON_CMD "bh wifi connect"
  20. #define SET_INET_SSID_CMD "bh set SSID"
  21. #define SET_INET_PWD_CMD "bh set PASS"
  22. #define SET_AP_SSID_CMD "bh set AP_SSID"
  23. #define LIST_AP_CMD "bh wifi list"
  24. #define DEV_CMD "bh wifi dev"
  25. #define START_AP_CMD "bh wifi ap"
  26. #define GET_IP_CMD "bh wifi ip"
  27. #define START_SSH_CMD "bh ssh"
  28. #define START_EVIL_TWIN "bh evil_twin"
  29. #define START_EVIL_PORT "bh evil_portal"
  30. #define START_RAT "bh evil_portal"
  31. #define GET_CMD "bh get"
  32. #define HELP_CMD "cat /mnt/help.txt"
  33. typedef enum { NO_ARGS = 0, INPUT_ARGS, TOGGLE_ARGS } InputArgs;
  34. typedef enum {
  35. FOCUS_CONSOLE_END = 0,
  36. FOCUS_CONSOLE_START,
  37. FOCUS_CONSOLE_TOGGLE
  38. } FocusConsole;
  39. #define MAX_OPTIONS (9)
  40. typedef struct {
  41. const char* item_string;
  42. char* options_menu[MAX_OPTIONS];
  43. int num_options_menu;
  44. char* selected_option;
  45. char* actual_command;
  46. bool text_input_req;
  47. } BlackhatItem;
  48. #define ENTER_NAME_LENGTH 25
  49. struct BlackhatApp {
  50. Gui* gui;
  51. ViewDispatcher* view_dispatcher;
  52. SceneManager* scene_manager;
  53. FuriString* text_box_store;
  54. size_t text_box_store_strlen;
  55. TextBox* text_box;
  56. VariableItemList* var_item_list;
  57. BlackhatUart* uart;
  58. TextInput* text_input;
  59. DialogsApp* dialogs;
  60. int selected_menu_index;
  61. int selected_option_index[NUM_MENU_ITEMS];
  62. char* selected_tx_string;
  63. const char* selected_option_item_text;
  64. char text_store[128];
  65. char text_input_ch[ENTER_NAME_LENGTH];
  66. bool text_input_req;
  67. };
  68. typedef enum {
  69. BlackhatAppViewVarItemList,
  70. BlackhatAppViewConsoleOutput,
  71. BlackhatAppViewStartPortal,
  72. BlackhatAppViewTextInput,
  73. } BlackhatAppView;