blackhat_app_i.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 script scan"
  26. #define RUN_CMD "bh scriptrun"
  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 TEST_INET "bh test_inet"
  40. #define GET_CMD "bh get"
  41. #define REBOOT_CMD "reboot"
  42. typedef enum { NO_ARGS = 0, INPUT_ARGS, TOGGLE_ARGS } InputArgs;
  43. typedef enum {
  44. FOCUS_CONSOLE_END = 0,
  45. FOCUS_CONSOLE_START,
  46. FOCUS_CONSOLE_TOGGLE
  47. } FocusConsole;
  48. #define MAX_OPTIONS (9)
  49. typedef struct {
  50. const char* item_string;
  51. char* options_menu[MAX_OPTIONS];
  52. int num_options_menu;
  53. char* selected_option;
  54. char* actual_command;
  55. bool text_input_req;
  56. } BlackhatItem;
  57. #define ENTER_NAME_LENGTH 25
  58. struct BlackhatApp {
  59. Gui* gui;
  60. ViewDispatcher* view_dispatcher;
  61. SceneManager* scene_manager;
  62. FuriString* text_box_store;
  63. // For custom scripts
  64. char* script_text;
  65. size_t script_text_ptr;
  66. int num_scripts;
  67. char* cmd[64];
  68. bool scanned;
  69. VariableItemList* script_item_list;
  70. size_t text_box_store_strlen;
  71. TextBox* text_box;
  72. VariableItemList* var_item_list;
  73. BlackhatUart* uart;
  74. TextInput* text_input;
  75. DialogsApp* dialogs;
  76. int selected_menu_index;
  77. int selected_option_index[NUM_MENU_ITEMS];
  78. char* selected_tx_string;
  79. const char* selected_option_item_text;
  80. char text_store[128];
  81. char text_input_ch[ENTER_NAME_LENGTH];
  82. bool text_input_req;
  83. bool is_script_scan;
  84. };
  85. typedef enum {
  86. BlackhatAppViewVarItemList,
  87. BlackhatAppViewScriptItemList,
  88. BlackhatAppViewConsoleOutput,
  89. BlackhatAppViewStartPortal,
  90. BlackhatAppViewTextInput,
  91. } BlackhatAppView;