blackhat_app_i.h 2.2 KB

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