@@ -222,6 +222,86 @@ MenuFunctions::MenuFunctions()
222222 }
223223 }
224224 }
225+
226+ // GFX Function to build a list showing all EP HTML Files
227+ void MenuFunctions::selectEPHTMLGFX () {
228+ extern EvilPortal evil_portal_obj;
229+
230+ lv_obj_t * list1 = lv_list_create (lv_scr_act (), NULL );
231+ lv_obj_set_size (list1, 160 , 200 );
232+ lv_obj_set_width (list1, LV_HOR_RES);
233+ lv_obj_align (list1, NULL , LV_ALIGN_CENTER, 0 , 0 );
234+
235+ lv_obj_t * list_btn;
236+
237+ lv_obj_t * label;
238+
239+ list_btn = lv_list_add_btn (list1, LV_SYMBOL_CLOSE, text09);
240+ lv_obj_set_event_cb (list_btn, html_list_cb);
241+
242+ for (int i = 1 ; i < evil_portal_obj.html_files ->size (); i++) {
243+ char buf[evil_portal_obj.html_files ->get (i).length () + 1 ] = {};
244+ evil_portal_obj.html_files ->get (i).toCharArray (buf, evil_portal_obj.html_files ->get (i).length () + 1 );
245+
246+ list_btn = lv_list_add_btn (list1, LV_SYMBOL_FILE, buf);
247+ lv_btn_set_checkable (list_btn, true );
248+ lv_obj_set_event_cb (list_btn, html_list_cb);
249+
250+ if (i == evil_portal_obj.selected_html_index )
251+ lv_btn_toggle (list_btn);
252+ }
253+ }
254+
255+ void html_list_cb (lv_obj_t * btn, lv_event_t event) {
256+ extern EvilPortal evil_portal_obj;
257+ extern MenuFunctions menu_function_obj;
258+
259+ String btn_text = lv_list_get_btn_text (btn);
260+ String display_string = " " ;
261+
262+ if (event == LV_EVENT_CLICKED) {
263+ if (btn_text != text09) {
264+ }
265+ else {
266+ Serial.println (" Exiting..." );
267+ lv_obj_del_async (lv_obj_get_parent (lv_obj_get_parent (btn)));
268+
269+ for (int i = 1 ; i < evil_portal_obj.html_files ->size (); i++) {
270+ if (i == evil_portal_obj.selected_html_index ) {
271+ Serial.println (" Selected: " + (String)evil_portal_obj.html_files ->get (i));
272+ }
273+ }
274+
275+ printf (" LV_EVENT_CANCEL\n " );
276+ menu_function_obj.deinitLVGL ();
277+ wifi_scan_obj.StartScan (WIFI_SCAN_OFF);
278+ display_obj.exit_draw = true ; // set everything back to normal
279+ }
280+ }
281+
282+ if (event == LV_EVENT_VALUE_CHANGED) {
283+ if (lv_btn_get_state (btn) == LV_BTN_STATE_CHECKED_RELEASED) {
284+ for (int i = 1 ; i < evil_portal_obj.html_files ->size (); i++) {
285+ if (evil_portal_obj.html_files ->get (i) == btn_text) {
286+ Serial.println (" Setting HTML: " + (String)evil_portal_obj.html_files ->get (i));
287+ evil_portal_obj.selected_html_index = i;
288+ evil_portal_obj.target_html_name = (String)evil_portal_obj.html_files ->get (i);
289+ }
290+ }
291+
292+ // Deselect buttons that were previously selected
293+ lv_obj_t * list = lv_obj_get_parent (btn);
294+
295+ lv_obj_t * next_btn = lv_obj_get_child (list, NULL );
296+ while (next_btn != NULL ) {
297+ if (next_btn != btn) {
298+ lv_btn_set_state (next_btn, LV_BTN_STATE_RELEASED);
299+ }
300+ next_btn = lv_obj_get_child (list, next_btn);
301+ }
302+ }
303+ }
304+ }
225305
226306 // GFX Function to build a list showing all APs scanned
227307 void MenuFunctions::addAPGFX (){
@@ -508,6 +588,7 @@ void MenuFunctions::main(uint32_t currentTime)
508588 (wifi_scan_obj.currentScanMode == BT_ATTACK_SOUR_APPLE) ||
509589 (wifi_scan_obj.currentScanMode == BT_ATTACK_SWIFTPAIR_SPAM) ||
510590 (wifi_scan_obj.currentScanMode == BT_ATTACK_SPAM_ALL) ||
591+ (wifi_scan_obj.currentScanMode == BT_ATTACK_SAMSUNG_SPAM) ||
511592 (wifi_scan_obj.currentScanMode == BT_SCAN_WAR_DRIVE) ||
512593 (wifi_scan_obj.currentScanMode == BT_SCAN_WAR_DRIVE_CONT) ||
513594 (wifi_scan_obj.currentScanMode == BT_SCAN_SKIMMERS))
@@ -567,6 +648,7 @@ void MenuFunctions::main(uint32_t currentTime)
567648 (wifi_scan_obj.currentScanMode == BT_ATTACK_SOUR_APPLE) ||
568649 (wifi_scan_obj.currentScanMode == BT_ATTACK_SWIFTPAIR_SPAM) ||
569650 (wifi_scan_obj.currentScanMode == BT_ATTACK_SPAM_ALL) ||
651+ (wifi_scan_obj.currentScanMode == BT_ATTACK_SAMSUNG_SPAM) ||
570652 (wifi_scan_obj.currentScanMode == BT_SCAN_WAR_DRIVE) ||
571653 (wifi_scan_obj.currentScanMode == BT_SCAN_WAR_DRIVE_CONT) ||
572654 (wifi_scan_obj.currentScanMode == BT_SCAN_SKIMMERS) ||
@@ -1083,7 +1165,6 @@ void MenuFunctions::displaySetting(String key, Menu* menu, int index) {
10831165
10841166}
10851167
1086-
10871168// Function to build the menus
10881169void MenuFunctions::RunSetup ()
10891170{
@@ -1122,6 +1203,9 @@ void MenuFunctions::RunSetup()
11221203 wifiGeneralMenu.list = new LinkedList<MenuNode>();
11231204 wifiAPMenu.list = new LinkedList<MenuNode>();
11241205
1206+ // WiFi HTML menu stuff
1207+ htmlMenu.list = new LinkedList<MenuNode>();
1208+
11251209 // Bluetooth menu stuff
11261210 bluetoothSnifferMenu.list = new LinkedList<MenuNode>();
11271211 bluetoothAttackMenu.list = new LinkedList<MenuNode>();
@@ -1155,6 +1239,7 @@ void MenuFunctions::RunSetup()
11551239 #ifdef HAS_GPS
11561240 gpsInfoMenu.name = " GPS Data" ;
11571241 #endif
1242+ htmlMenu.name = " EP HTML List" ;
11581243
11591244 // Build Main Menu
11601245 mainMenu.parentMenu = NULL ;
@@ -1361,7 +1446,72 @@ void MenuFunctions::RunSetup()
13611446 wifi_scan_obj.StartScan (LV_ADD_SSID, TFT_RED);
13621447 addStationGFX ();
13631448 });
1449+ this ->addNodes (&wifiGeneralMenu, " Select EP HTML File" , TFT_CYAN, NULL , KEYBOARD_ICO, [this ](){
1450+ display_obj.clearScreen ();
1451+ wifi_scan_obj.currentScanMode = LV_ADD_SSID;
1452+ wifi_scan_obj.StartScan (LV_ADD_SSID, TFT_RED);
1453+ selectEPHTMLGFX ();
1454+ });
13641455 #else
1456+ this ->addNodes (&wifiGeneralMenu, " Select EP HTML File" , TFT_CYAN, NULL , KEYBOARD_ICO, [this ](){
1457+ this ->changeMenu (&htmlMenu);
1458+ #ifdef HAS_BUTTONS
1459+ #if !(defined(MARAUDER_V6) || defined(MARAUDER_V6_1))
1460+ while (true ) {
1461+ if (d_btn.justPressed ()) {
1462+ if (evil_portal_obj.selected_html_index > 0 )
1463+ evil_portal_obj.selected_html_index --;
1464+ else
1465+ evil_portal_obj.selected_html_index = evil_portal_obj.html_files ->size () - 1 ;
1466+
1467+ // Serial.println("Setting button text as " + evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index));
1468+ this ->htmlMenu .list ->set (0 , MenuNode{evil_portal_obj.html_files ->get (evil_portal_obj.selected_html_index ), false , TFT_CYAN, 0 , NULL , true , NULL });
1469+ this ->buildButtons (&htmlMenu);
1470+ this ->displayCurrentMenu ();
1471+ }
1472+ #ifndef MARAUDER_M5STICKC
1473+ if (u_btn.justPressed ()) {
1474+ if (evil_portal_obj.selected_html_index < evil_portal_obj.html_files ->size () - 1 )
1475+ evil_portal_obj.selected_html_index ++;
1476+ else
1477+ evil_portal_obj.selected_html_index = 0 ;
1478+
1479+ // Serial.println("Setting button text as " + evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index));
1480+ this ->htmlMenu .list ->set (0 , MenuNode{evil_portal_obj.html_files ->get (evil_portal_obj.selected_html_index ), false , TFT_CYAN, 0 , NULL , true , NULL });
1481+ this ->buildButtons (&htmlMenu, 0 , evil_portal_obj.html_files ->get (evil_portal_obj.selected_html_index ));
1482+ this ->displayCurrentMenu ();
1483+ }
1484+ #endif
1485+ if (c_btn.justPressed ()) {
1486+ if (evil_portal_obj.html_files ->get (evil_portal_obj.selected_html_index ) != " Back" ) {
1487+ evil_portal_obj.target_html_name = evil_portal_obj.html_files ->get (evil_portal_obj.selected_html_index );
1488+ Serial.println (" Set Evil Portal HTML as " + evil_portal_obj.target_html_name );
1489+ evil_portal_obj.using_serial_html = false ;
1490+ }
1491+ this ->changeMenu (htmlMenu.parentMenu );
1492+ break ;
1493+ }
1494+ }
1495+ #endif
1496+ #endif
1497+ });
1498+
1499+ htmlMenu.parentMenu = &wifiGeneralMenu;
1500+ this ->addNodes (&htmlMenu, text09, TFT_LIGHTGREY, NULL , 0 , [this ]() {
1501+ this ->changeMenu (htmlMenu.parentMenu );
1502+ });
1503+
1504+ /* int loopLimit = min(evil_portal_obj.html_files->size(), BUTTON_ARRAY_LEN);
1505+
1506+ for (int i = 0; i < loopLimit - 1; i++) {
1507+ this->addNodes(&htmlMenu, evil_portal_obj.html_files->get(i), TFT_CYAN, NULL, 0, [this, i]() {
1508+ evil_portal_obj.target_html_name = (String)evil_portal_obj.html_files->get(i);
1509+ Serial.println("Set Evil Portal HTML as " + evil_portal_obj.target_html_name);
1510+ evil_portal_obj.using_serial_html = false;
1511+ this->changeMenu(htmlMenu.parentMenu);
1512+ });
1513+ }*/
1514+
13651515 // Select APs on Mini
13661516 this ->addNodes (&wifiGeneralMenu, text_table1[56 ], TFT_NAVY, NULL , KEYBOARD_ICO, [this ](){
13671517 wifiAPMenu.list ->clear ();
@@ -1475,6 +1625,11 @@ void MenuFunctions::RunSetup()
14751625 this ->drawStatusBar ();
14761626 wifi_scan_obj.StartScan (BT_ATTACK_SWIFTPAIR_SPAM, TFT_CYAN);
14771627 });
1628+ this ->addNodes (&bluetoothAttackMenu, " Samsung BLE Spam" , TFT_RED, NULL , GENERAL_APPS, [this ]() {
1629+ display_obj.clearScreen ();
1630+ this ->drawStatusBar ();
1631+ wifi_scan_obj.StartScan (BT_ATTACK_SAMSUNG_SPAM, TFT_RED);
1632+ });
14781633 this ->addNodes (&bluetoothAttackMenu, " BLE Spam All" , TFT_MAGENTA, NULL , DEAUTH_SNIFF, [this ]() {
14791634 display_obj.clearScreen ();
14801635 this ->drawStatusBar ();
@@ -1629,9 +1784,10 @@ void MenuFunctions::addNodes(Menu * menu, String name, uint16_t color, Menu * ch
16291784{
16301785 TFT_eSPI_Button new_button;
16311786 menu->list ->add (MenuNode{name, false , color, place, &new_button, selected, callable});
1787+ // menu->list->add(MenuNode{name, false, color, place, selected, callable});
16321788}
16331789
1634- void MenuFunctions::buildButtons (Menu * menu, int starting_index)
1790+ void MenuFunctions::buildButtons (Menu * menu, int starting_index, String button_name )
16351791{
16361792 if (menu->list != NULL )
16371793 {
@@ -1640,7 +1796,10 @@ void MenuFunctions::buildButtons(Menu * menu, int starting_index)
16401796 {
16411797 TFT_eSPI_Button new_button;
16421798 char buf[menu->list ->get (starting_index + i).name .length () + 1 ] = {};
1643- menu->list ->get (starting_index + i).name .toCharArray (buf, menu->list ->get (starting_index + i).name .length () + 1 );
1799+ if (button_name != " " )
1800+ menu->list ->get (starting_index + i).name .toCharArray (buf, menu->list ->get (starting_index + i).name .length () + 1 );
1801+ else
1802+ button_name.toCharArray (buf, button_name.length () + 1 );
16441803 display_obj.key [i].initButton (&display_obj.tft ,
16451804 KEY_X + 0 * (KEY_W + KEY_SPACING_X),
16461805 KEY_Y + i * (KEY_H + KEY_SPACING_Y), // x, y, w, h, outline, fill, text
0 commit comments