diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index fc67f07..21b9a1a 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -110,402 +110,6 @@ MenuFunctions::MenuFunctions() void setting_dropdown_cb(lv_obj_t * obj, lv_event_t event) { } - - // GFX Function to build a list showing all Stations scanned - void MenuFunctions::addStationGFX(){ - extern LinkedList* stations; - extern LinkedList* access_points; - extern WiFiScan wifi_scan_obj; - - lv_obj_t * list1 = lv_list_create(lv_scr_act(), NULL); - lv_obj_set_size(list1, 160, 200); - lv_obj_set_width(list1, LV_HOR_RES); - lv_obj_align(list1, NULL, LV_ALIGN_CENTER, 0, 0); - - lv_obj_t * list_btn; - - lv_obj_t * label; - - list_btn = lv_list_add_btn(list1, LV_SYMBOL_CLOSE, text09); - lv_obj_set_event_cb(list_btn, station_list_cb); - - char addr[] = "00:00:00:00:00:00"; - for (int x = 0; x < access_points->size(); x++) { - AccessPoint cur_ap = access_points->get(x); - - // Add non clickable button for AP - String full_label = "AP: " + cur_ap.essid; - char buf[full_label.length() + 1] = {}; - full_label.toCharArray(buf, full_label.length() + 1); - list_btn = lv_list_add_btn(list1, NULL, buf); - lv_btn_set_checkable(list_btn, false); - - int cur_ap_sta_len = access_points->get(x).stations->size(); - for (int y = 0; y < cur_ap_sta_len; y++) { - Station cur_sta = stations->get(cur_ap.stations->get(y)); - // Convert uint8_t MAC to char array - wifi_scan_obj.getMAC(addr, cur_sta.mac, 0); - - list_btn = lv_list_add_btn(list1, LV_SYMBOL_WIFI, addr); - lv_btn_set_checkable(list_btn, true); - lv_obj_set_event_cb(list_btn, station_list_cb); - - if (cur_sta.selected) - lv_btn_toggle(list_btn); - } - } - } - - // Function to work with list of Stations - void station_list_cb(lv_obj_t * btn, lv_event_t event) { - extern LinkedList* stations; - extern MenuFunctions menu_function_obj; - extern WiFiScan wifi_scan_obj; - - String btn_text = lv_list_get_btn_text(btn); - String display_string = ""; - char addr[] = "00:00:00:00:00:00"; - - if (event == LV_EVENT_CLICKED) { - if (btn_text != text09) { - } - else { - Serial.println(F("Exiting...")); - lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn))); - - for (int i = 0; i < stations->size(); i++) { - if (stations->get(i).selected) { - wifi_scan_obj.getMAC(addr, stations->get(i).mac, 0); - Serial.print(F("Selected: ")); - Serial.println(addr); - } - } - - printf("LV_EVENT_CANCEL\n"); - menu_function_obj.deinitLVGL(); - wifi_scan_obj.StartScan(WIFI_SCAN_OFF); - display_obj.exit_draw = true; // set everything back to normal - } - } - - if (event == LV_EVENT_VALUE_CHANGED) { - if (lv_btn_get_state(btn) == LV_BTN_STATE_CHECKED_RELEASED) { - for (int i = 0; i < stations->size(); i++) { - wifi_scan_obj.getMAC(addr, stations->get(i).mac, 0); - if (strcmp(addr, btn_text.c_str()) == 0) { - Serial.print(F("Adding Station: ")); - Serial.println(addr); - Station sta = stations->get(i); - sta.selected = true; - stations->set(i, sta); - } - } - } - else { - for (int i = 0; i < stations->size(); i++) { - wifi_scan_obj.getMAC(addr, stations->get(i).mac, 0); - if (strcmp(addr, btn_text.c_str()) == 0) { - Serial.print(F("Removing Station: ")); - Serial.println(addr); - Station sta = stations->get(i); - sta.selected = false; - stations->set(i, sta); - } - } - } - } - } - - // GFX Function to build a list showing all EP HTML Files - void MenuFunctions::selectEPHTMLGFX() { - extern EvilPortal evil_portal_obj; - - lv_obj_t * list1 = lv_list_create(lv_scr_act(), NULL); - lv_obj_set_size(list1, 160, 200); - lv_obj_set_width(list1, LV_HOR_RES); - lv_obj_align(list1, NULL, LV_ALIGN_CENTER, 0, 0); - - lv_obj_t * list_btn; - - lv_obj_t * label; - - list_btn = lv_list_add_btn(list1, LV_SYMBOL_CLOSE, text09); - lv_obj_set_event_cb(list_btn, html_list_cb); - - for (int i = 1; i < evil_portal_obj.html_files->size(); i++) { - char buf[evil_portal_obj.html_files->get(i).length() + 1] = {}; - evil_portal_obj.html_files->get(i).toCharArray(buf, evil_portal_obj.html_files->get(i).length() + 1); - - list_btn = lv_list_add_btn(list1, LV_SYMBOL_FILE, buf); - lv_btn_set_checkable(list_btn, true); - lv_obj_set_event_cb(list_btn, html_list_cb); - - if (i == evil_portal_obj.selected_html_index) - lv_btn_toggle(list_btn); - } - } - - void html_list_cb(lv_obj_t * btn, lv_event_t event) { - extern EvilPortal evil_portal_obj; - extern MenuFunctions menu_function_obj; - - String btn_text = lv_list_get_btn_text(btn); - String display_string = ""; - - if (event == LV_EVENT_CLICKED) { - if (btn_text != text09) { - } - else { - Serial.println(F("Exiting...")); - lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn))); - - for (int i = 1; i < evil_portal_obj.html_files->size(); i++) { - if (i == evil_portal_obj.selected_html_index) { - Serial.println("Selected: " + (String)evil_portal_obj.html_files->get(i)); - } - } - - printf("LV_EVENT_CANCEL\n"); - menu_function_obj.deinitLVGL(); - wifi_scan_obj.StartScan(WIFI_SCAN_OFF); - display_obj.exit_draw = true; // set everything back to normal - } - } - - if (event == LV_EVENT_VALUE_CHANGED) { - if (lv_btn_get_state(btn) == LV_BTN_STATE_CHECKED_RELEASED) { - for (int i = 1; i < evil_portal_obj.html_files->size(); i++) { - if (evil_portal_obj.html_files->get(i) == btn_text) { - Serial.println("Setting HTML: " + (String)evil_portal_obj.html_files->get(i)); - evil_portal_obj.selected_html_index = i; - evil_portal_obj.target_html_name = (String)evil_portal_obj.html_files->get(i); - } - } - - // Deselect buttons that were previously selected - lv_obj_t * list = lv_obj_get_parent(btn); - - lv_obj_t * next_btn = lv_obj_get_child(list, NULL); - while (next_btn != NULL) { - if (next_btn != btn) { - lv_btn_set_state(next_btn, LV_BTN_STATE_RELEASED); - } - next_btn = lv_obj_get_child(list, next_btn); - } - } - } - } - - // GFX Function to build a list showing all APs scanned - void MenuFunctions::addAPGFX(String type){ - extern WiFiScan wifi_scan_obj; - extern LinkedList* access_points; - extern LinkedList* airtags; - - lv_obj_t * list1 = lv_list_create(lv_scr_act(), NULL); - lv_obj_set_size(list1, 160, 200); - lv_obj_set_width(list1, LV_HOR_RES); - lv_obj_align(list1, NULL, LV_ALIGN_CENTER, 0, 0); - - lv_obj_t * list_btn; - - lv_obj_t * label; - - list_btn = lv_list_add_btn(list1, LV_SYMBOL_CLOSE, text09); - lv_obj_set_event_cb(list_btn, ap_list_cb); - - if ((type == "AP") || (type == "AP Info")) { - for (int i = 0; i < access_points->size(); i++) { - char buf[access_points->get(i).essid.length() + 1] = {}; - access_points->get(i).essid.toCharArray(buf, access_points->get(i).essid.length() + 1); - - list_btn = lv_list_add_btn(list1, LV_SYMBOL_WIFI, buf); - lv_btn_set_checkable(list_btn, true); - if (type == "AP") - lv_obj_set_event_cb(list_btn, ap_list_cb); - else if (type == "AP Info") - lv_obj_set_event_cb(list_btn, ap_info_list_cb); - - if (access_points->get(i).selected) - lv_btn_toggle(list_btn); - } - } - else if (type == "Airtag") { - for (int i = 0; i < airtags->size(); i++) { - char buf[airtags->get(i).mac.length() + 1] = {}; - airtags->get(i).mac.toCharArray(buf, airtags->get(i).mac.length() + 1); - - list_btn = lv_list_add_btn(list1, LV_SYMBOL_BLUETOOTH, buf); - lv_btn_set_checkable(list_btn, true); - lv_obj_set_event_cb(list_btn, at_list_cb); - - //if (airtags->get(i).selected) - // lv_btn_toggle(list_btn); - } - } - } - - void at_list_cb(lv_obj_t * btn, lv_event_t event) { - extern MenuFunctions menu_function_obj; - extern WiFiScan wifi_scan_obj; - extern LinkedList* airtags; - extern Display display_obj; - - String btn_text = lv_list_get_btn_text(btn); - String display_string = ""; - - // Button is clicked - if (event == LV_EVENT_CLICKED) { - if (btn_text != text09) { - } - // It's the back button - else { - Serial.println(F("Exiting...")); - lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn))); - - for (int i = 0; i < airtags->size(); i++) { - if (airtags->get(i).selected) { - Serial.println("Selected: " + (String)airtags->get(i).mac); - } - } - - printf("LV_EVENT_CANCEL\n"); - menu_function_obj.deinitLVGL(); - wifi_scan_obj.StartScan(WIFI_SCAN_OFF); - display_obj.exit_draw = true; // set everything back to normal - } - } - - if (event == LV_EVENT_VALUE_CHANGED) { - if (lv_btn_get_state(btn) == LV_BTN_STATE_CHECKED_RELEASED) { - bool do_that_thang = false; - for (int i = 0; i < airtags->size(); i++) { - if (airtags->get(i).mac == btn_text) { - Serial.println("Selecting Airtag: " + (String)airtags->get(i).mac); - AirTag at = airtags->get(i); - at.selected = true; - airtags->set(i, at); - do_that_thang = true; - } - else { - AirTag at = airtags->get(i); - at.selected = false; - airtags->set(i, at); - } - } - // Start spoofing airtag - if (do_that_thang) { - menu_function_obj.deinitLVGL(); - lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn))); - wifi_scan_obj.StartScan(WIFI_SCAN_OFF); - display_obj.clearScreen(); - menu_function_obj.orientDisplay(); - display_obj.clearScreen(); - menu_function_obj.drawStatusBar(); - wifi_scan_obj.StartScan(BT_SPOOF_AIRTAG, TFT_WHITE); - } - } - else { - for (int i = 0; i < airtags->size(); i++) { - if (airtags->get(i).mac == btn_text) { - Serial.println("Deselecting Airtag: " + (String)airtags->get(i).mac); - AirTag at = airtags->get(i); - at.selected = false; - airtags->set(i, at); - } - } - } - } - } - - void ap_list_cb(lv_obj_t * btn, lv_event_t event) { - extern LinkedList* access_points; - extern MenuFunctions menu_function_obj; - extern WiFiScan wifi_scan_obj; - - String btn_text = lv_list_get_btn_text(btn); - String display_string = ""; - - if (event == LV_EVENT_CLICKED) { - if (btn_text != text09) { - } - else { - Serial.println(F("Exiting...")); - lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn))); - - for (int i = 0; i < access_points->size(); i++) { - if (access_points->get(i).selected) { - Serial.println("Selected: " + (String)access_points->get(i).essid); - } - } - - printf("LV_EVENT_CANCEL\n"); - menu_function_obj.deinitLVGL(); - wifi_scan_obj.StartScan(WIFI_SCAN_OFF); - display_obj.exit_draw = true; // set everything back to normal - } - } - - if (event == LV_EVENT_VALUE_CHANGED) { - if (lv_btn_get_state(btn) == LV_BTN_STATE_CHECKED_RELEASED) { - for (int i = 0; i < access_points->size(); i++) { - if (access_points->get(i).essid == btn_text) { - Serial.println("Adding AP: " + (String)access_points->get(i).essid); - AccessPoint ap = access_points->get(i); - ap.selected = true; - access_points->set(i, ap); - } - } - } - else { - for (int i = 0; i < access_points->size(); i++) { - if (access_points->get(i).essid == btn_text) { - Serial.println("Removing AP: " + (String)access_points->get(i).essid); - AccessPoint ap = access_points->get(i); - ap.selected = false; - access_points->set(i, ap); - } - } - } - } - } - - void ap_info_list_cb(lv_obj_t * btn, lv_event_t event) { - extern LinkedList* access_points; - extern MenuFunctions menu_function_obj; - extern WiFiScan wifi_scan_obj; - - String btn_text = lv_list_get_btn_text(btn); - String display_string = ""; - - // Exit function - if (event == LV_EVENT_CLICKED) { - if (btn_text != text09) { - for (int i = 0; i < access_points->size(); i++) { - if (access_points->get(i).essid == btn_text) { - lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn))); - - printf("LV_EVENT_CANCEL\n"); - menu_function_obj.deinitLVGL(); - wifi_scan_obj.StartScan(WIFI_SCAN_OFF); - //display_obj.exit_draw = true; // set everything back to normal - menu_function_obj.orientDisplay(); - menu_function_obj.changeMenu(&menu_function_obj.apInfoMenu); - wifi_scan_obj.RunAPInfo(i); - } - } - } - else { - Serial.println(F("Exiting...")); - lv_obj_del_async(lv_obj_get_parent(lv_obj_get_parent(btn))); - - printf("LV_EVENT_CANCEL\n"); - menu_function_obj.deinitLVGL(); - wifi_scan_obj.StartScan(WIFI_SCAN_OFF); - display_obj.exit_draw = true; // set everything back to normal - } - } - } void MenuFunctions::addSSIDGFX(){ extern LinkedList* ssids; @@ -2364,7 +1968,7 @@ void MenuFunctions::RunSetup() this->drawStatusBar(); wifi_scan_obj.StartScan(WIFI_SCAN_TARGET_AP, TFT_MAGENTA); });*/ - this->addNodes(&wifiSnifferMenu, "Scan All", TFTLIME, NULL, BEACON_SNIFF, [this]() { + this->addNodes(&wifiSnifferMenu, "Scan AP/STA", TFTLIME, NULL, BEACON_SNIFF, [this]() { display_obj.clearScreen(); this->drawStatusBar(); wifi_scan_obj.StartScan(WIFI_SCAN_AP_STA, 0x97e0); @@ -3228,16 +2832,16 @@ void MenuFunctions::RunSetup() wifi_scan_obj.StartScan(BT_ATTACK_SPAM_ALL, TFT_MAGENTA); }); - #ifdef HAS_ILI9341 + /*#ifdef HAS_ILI9341 this->addNodes(&bluetoothAttackMenu, "Spoof Airtag", TFTWHITE, NULL, ATTACKS, [this](){ display_obj.clearScreen(); wifi_scan_obj.currentScanMode = LV_ADD_SSID; wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_WHITE); addAPGFX("Airtag"); }); - #endif + #endif*/ - #ifndef HAS_ILI9341 + //#ifndef HAS_ILI9341 #ifdef HAS_BT // Select Airtag on Mini this->addNodes(&bluetoothAttackMenu, "Spoof Airtag", TFTWHITE, NULL, ATTACKS, [this](){ @@ -3288,7 +2892,7 @@ void MenuFunctions::RunSetup() }); #endif - #endif + //#endif // Device menu deviceMenu.parentMenu = &mainMenu; diff --git a/esp32_marauder/MenuFunctions.h b/esp32_marauder/MenuFunctions.h index 133373e..7816dc5 100644 --- a/esp32_marauder/MenuFunctions.h +++ b/esp32_marauder/MenuFunctions.h @@ -105,11 +105,6 @@ PROGMEM static void ta_event_cb(lv_obj_t * ta, lv_event_t event); PROGMEM static void join_wifi_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event); PROGMEM static void start_ap_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event); PROGMEM static void add_ssid_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event); -PROGMEM static void html_list_cb(lv_obj_t * btn, lv_event_t event); -PROGMEM static void ap_list_cb(lv_obj_t * btn, lv_event_t event); -PROGMEM static void ap_info_list_cb(lv_obj_t * btn, lv_event_t event); -PROGMEM static void at_list_cb(lv_obj_t * btn, lv_event_t event); -PROGMEM static void station_list_cb(lv_obj_t * btn, lv_event_t event); PROGMEM static void setting_dropdown_cb(lv_obj_t * btn, lv_event_t event); // lvgl stuff @@ -120,16 +115,6 @@ struct Menu; // Individual Nodes of a menu -/*struct MenuNode { - String name; - bool command; - uint16_t color; - uint8_t icon; - TFT_eSPI_Button* button; - bool selected; - std::function callable; -};*/ - struct MenuNode { String name; bool command; @@ -300,11 +285,8 @@ class MenuFunctions void setGraphScale(float scale); void initLVGL(); void deinitLVGL(); - void selectEPHTMLGFX(); void updateStatusBar(); void addSSIDGFX(); - void addAPGFX(String type = "AP"); - void addStationGFX(); void buildButtons(Menu* menu, int starting_index = 0, String button_name = ""); void changeMenu(Menu* menu, bool simple_change = false); void drawStatusBar(); diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp index 297033a..544585b 100644 --- a/esp32_marauder/WiFiScan.cpp +++ b/esp32_marauder/WiFiScan.cpp @@ -6941,7 +6941,7 @@ void WiFiScan::beaconSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type #endif } } - else if ((snifferPacket->payload[0] == 0x40) && (buf == 0)) { + else if (snifferPacket->payload[0] == 0x40) { if (wifi_scan_obj.currentScanMode == WIFI_SCAN_PROBE) { String probe_req_essid; diff --git a/esp32_marauder/configs.h b/esp32_marauder/configs.h index ef070c1..ccd4ba2 100644 --- a/esp32_marauder/configs.h +++ b/esp32_marauder/configs.h @@ -2283,7 +2283,7 @@ //// EVIL PORTAL STUFF #ifdef HAS_PSRAM - #define MAX_HTML_SIZE 20000 + #define MAX_HTML_SIZE 30000 #else #define MAX_HTML_SIZE 11400 #endif @@ -2293,7 +2293,7 @@ //// GPS STUFF #ifdef HAS_GPS #ifdef HAS_PSRAM - #define mac_history_len 100 + #define mac_history_len 500 #else #define mac_history_len 100 #endif