blackhat_app_i.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #pragma once
  2. #include <dialogs/dialogs.h>
  3. #include <dolphin/dolphin.h>
  4. #include <furi.h>
  5. #include <gui/gui.h>
  6. #include <gui/modules/loading.h>
  7. #include <gui/modules/text_box.h>
  8. #include <gui/modules/text_input.h>
  9. #include <gui/modules/variable_item_list.h>
  10. #include <gui/scene_manager.h>
  11. #include <gui/view_dispatcher.h>
  12. #include <gui/view_stack.h>
  13. #include <input/input.h>
  14. #include <notification/notification.h>
  15. #include <notification/notification_messages.h>
  16. #include <stdio.h>
  17. #include "blackhat_app.h"
  18. #include "blackhat_custom_event.h"
  19. #include "blackhat_uart.h"
  20. #include "scenes/blackhat_scene.h"
  21. #define NUM_MENU_ITEMS (18)
  22. #define BLACKHAT_TEXT_BOX_STORE_SIZE (4096)
  23. #define UART_CH FuriHalSerialIdUsart
  24. #define SHELL_CMD "whoami"
  25. #define SCAN_CMD "bh scripts"
  26. #define RUN_CMD "bh scripts run"
  27. #define WIFI_CON_CMD "bh wifi connect"
  28. #define SET_INET_SSID_CMD "bh set SSID"
  29. #define SET_INET_PWD_CMD "bh set PASS"
  30. #define SET_AP_SSID_CMD "bh set AP_SSID"
  31. #define LIST_AP_CMD "bh wifi list"
  32. #define DEV_CMD "bh wifi dev"
  33. #define START_AP_CMD "bh wifi ap"
  34. #define START_KISMET_CMD "bh kismet"
  35. #define GET_IP_CMD "bh wifi ip"
  36. #define START_SSH_CMD "bh ssh"
  37. #define ST_EVIL_TWIN_CMD "bh evil_twin"
  38. #define ST_EVIL_PORT_CMD "bh evil_portal"
  39. #define ST_RAT_CMD "bh rat_driver"
  40. #define GET_CMD "bh get"
  41. #define REBOOT_CMD "reboot"
  42. #define HELP_CMD "cat /mnt/help.txt"
  43. typedef enum { NO_ARGS = 0, INPUT_ARGS, TOGGLE_ARGS } InputArgs;
  44. typedef enum {
  45. FOCUS_CONSOLE_END = 0,
  46. FOCUS_CONSOLE_START,
  47. FOCUS_CONSOLE_TOGGLE
  48. } FocusConsole;
  49. #define MAX_OPTIONS (9)
  50. typedef struct {
  51. const char* item_string;
  52. char* options_menu[MAX_OPTIONS];
  53. int num_options_menu;
  54. char* selected_option;
  55. char* actual_command;
  56. bool text_input_req;
  57. } BlackhatItem;
  58. #define ENTER_NAME_LENGTH 25
  59. struct BlackhatApp {
  60. Gui* gui;
  61. ViewDispatcher* view_dispatcher;
  62. SceneManager* scene_manager;
  63. FuriString* text_box_store;
  64. // For custom scripts
  65. char* script_text;
  66. size_t script_text_ptr;
  67. int num_scripts;
  68. char* cmd[64];
  69. bool scanned;
  70. VariableItemList* script_item_list;
  71. size_t text_box_store_strlen;
  72. TextBox* text_box;
  73. VariableItemList* var_item_list;
  74. BlackhatUart* uart;
  75. TextInput* text_input;
  76. DialogsApp* dialogs;
  77. int selected_menu_index;
  78. int selected_option_index[NUM_MENU_ITEMS];
  79. char* selected_tx_string;
  80. const char* selected_option_item_text;
  81. char text_store[128];
  82. char text_input_ch[ENTER_NAME_LENGTH];
  83. bool text_input_req;
  84. bool is_script_scan;
  85. };
  86. typedef enum {
  87. BlackhatAppViewVarItemList,
  88. BlackhatAppViewScriptItemList,
  89. BlackhatAppViewConsoleOutput,
  90. BlackhatAppViewStartPortal,
  91. BlackhatAppViewTextInput,
  92. } BlackhatAppView;