blackhat_app_i.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 (16)
  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 ST_EVIL_TWIN_CMD "bh evil_twin"
  29. #define ST_EVIL_PORT_CMD "bh evil_portal"
  30. #define ST_RAT_CMD "bh rat_driver"
  31. #define GET_CMD "bh get"
  32. #define REBOOT_CMD "reboot"
  33. #define HELP_CMD "cat /mnt/help.txt"
  34. typedef enum { NO_ARGS = 0, INPUT_ARGS, TOGGLE_ARGS } InputArgs;
  35. typedef enum {
  36. FOCUS_CONSOLE_END = 0,
  37. FOCUS_CONSOLE_START,
  38. FOCUS_CONSOLE_TOGGLE
  39. } FocusConsole;
  40. #define MAX_OPTIONS (9)
  41. typedef struct {
  42. const char* item_string;
  43. char* options_menu[MAX_OPTIONS];
  44. int num_options_menu;
  45. char* selected_option;
  46. char* actual_command;
  47. bool text_input_req;
  48. } BlackhatItem;
  49. #define ENTER_NAME_LENGTH 25
  50. struct BlackhatApp {
  51. Gui* gui;
  52. ViewDispatcher* view_dispatcher;
  53. SceneManager* scene_manager;
  54. FuriString* text_box_store;
  55. size_t text_box_store_strlen;
  56. TextBox* text_box;
  57. VariableItemList* var_item_list;
  58. BlackhatUart* uart;
  59. TextInput* text_input;
  60. DialogsApp* dialogs;
  61. int selected_menu_index;
  62. int selected_option_index[NUM_MENU_ITEMS];
  63. char* selected_tx_string;
  64. const char* selected_option_item_text;
  65. char text_store[128];
  66. char text_input_ch[ENTER_NAME_LENGTH];
  67. bool text_input_req;
  68. };
  69. typedef enum {
  70. BlackhatAppViewVarItemList,
  71. BlackhatAppViewConsoleOutput,
  72. BlackhatAppViewStartPortal,
  73. BlackhatAppViewTextInput,
  74. } BlackhatAppView;