Skip to content

Commit

Permalink
Merge pull request #407 from justcallmekoko/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
justcallmekoko authored Nov 26, 2023
2 parents e1a6fe8 + 48b09b7 commit f7992d6
Show file tree
Hide file tree
Showing 19 changed files with 72,018 additions and 69,388 deletions.
15 changes: 15 additions & 0 deletions esp32_marauder/EvilPortal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,26 @@
AsyncWebServer server(80);

EvilPortal::EvilPortal() {
}

void EvilPortal::setup() {
this->runServer = false;
this->name_received = false;
this->password_received = false;
this->has_html = false;
this->has_ap = false;

html_files = new LinkedList<String>();

html_files->add("Back");

#ifdef HAS_SD
if (sd_obj.supported) {
sd_obj.listDirToLinkedList(html_files, "/", "html");

Serial.println("Evil Portal Found " + (String)html_files->size() + " HTML files");
}
#endif
}

bool EvilPortal::begin(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_points) {
Expand Down
4 changes: 4 additions & 0 deletions esp32_marauder/EvilPortal.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,15 @@ class EvilPortal {
EvilPortal();

String target_html_name = "index.html";
uint8_t selected_html_index = 0;

bool using_serial_html;

LinkedList<String>* html_files;

String get_user_name();
String get_password();
void setup();
void addLog(String log, int len);
bool begin(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_points);
void main(uint8_t scan_mode);
Expand Down
165 changes: 162 additions & 3 deletions esp32_marauder/MenuFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,86 @@ MenuFunctions::MenuFunctions()
}
}
}

// 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("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(){
Expand Down Expand Up @@ -508,6 +588,7 @@ void MenuFunctions::main(uint32_t currentTime)
(wifi_scan_obj.currentScanMode == BT_ATTACK_SOUR_APPLE) ||
(wifi_scan_obj.currentScanMode == BT_ATTACK_SWIFTPAIR_SPAM) ||
(wifi_scan_obj.currentScanMode == BT_ATTACK_SPAM_ALL) ||
(wifi_scan_obj.currentScanMode == BT_ATTACK_SAMSUNG_SPAM) ||
(wifi_scan_obj.currentScanMode == BT_SCAN_WAR_DRIVE) ||
(wifi_scan_obj.currentScanMode == BT_SCAN_WAR_DRIVE_CONT) ||
(wifi_scan_obj.currentScanMode == BT_SCAN_SKIMMERS))
Expand Down Expand Up @@ -567,6 +648,7 @@ void MenuFunctions::main(uint32_t currentTime)
(wifi_scan_obj.currentScanMode == BT_ATTACK_SOUR_APPLE) ||
(wifi_scan_obj.currentScanMode == BT_ATTACK_SWIFTPAIR_SPAM) ||
(wifi_scan_obj.currentScanMode == BT_ATTACK_SPAM_ALL) ||
(wifi_scan_obj.currentScanMode == BT_ATTACK_SAMSUNG_SPAM) ||
(wifi_scan_obj.currentScanMode == BT_SCAN_WAR_DRIVE) ||
(wifi_scan_obj.currentScanMode == BT_SCAN_WAR_DRIVE_CONT) ||
(wifi_scan_obj.currentScanMode == BT_SCAN_SKIMMERS) ||
Expand Down Expand Up @@ -1083,7 +1165,6 @@ void MenuFunctions::displaySetting(String key, Menu* menu, int index) {

}


// Function to build the menus
void MenuFunctions::RunSetup()
{
Expand Down Expand Up @@ -1122,6 +1203,9 @@ void MenuFunctions::RunSetup()
wifiGeneralMenu.list = new LinkedList<MenuNode>();
wifiAPMenu.list = new LinkedList<MenuNode>();

// WiFi HTML menu stuff
htmlMenu.list = new LinkedList<MenuNode>();

// Bluetooth menu stuff
bluetoothSnifferMenu.list = new LinkedList<MenuNode>();
bluetoothAttackMenu.list = new LinkedList<MenuNode>();
Expand Down Expand Up @@ -1155,6 +1239,7 @@ void MenuFunctions::RunSetup()
#ifdef HAS_GPS
gpsInfoMenu.name = "GPS Data";
#endif
htmlMenu.name = "EP HTML List";

// Build Main Menu
mainMenu.parentMenu = NULL;
Expand Down Expand Up @@ -1361,7 +1446,72 @@ void MenuFunctions::RunSetup()
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_RED);
addStationGFX();
});
this->addNodes(&wifiGeneralMenu, "Select EP HTML File", TFT_CYAN, NULL, KEYBOARD_ICO, [this](){
display_obj.clearScreen();
wifi_scan_obj.currentScanMode = LV_ADD_SSID;
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_RED);
selectEPHTMLGFX();
});
#else
this->addNodes(&wifiGeneralMenu, "Select EP HTML File", TFT_CYAN, NULL, KEYBOARD_ICO, [this](){
this->changeMenu(&htmlMenu);
#ifdef HAS_BUTTONS
#if !(defined(MARAUDER_V6) || defined(MARAUDER_V6_1))
while(true) {
if (d_btn.justPressed()) {
if (evil_portal_obj.selected_html_index > 0)
evil_portal_obj.selected_html_index--;
else
evil_portal_obj.selected_html_index = evil_portal_obj.html_files->size() - 1;

//Serial.println("Setting button text as " + evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index));
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});
this->buildButtons(&htmlMenu);
this->displayCurrentMenu();
}
#ifndef MARAUDER_M5STICKC
if (u_btn.justPressed()) {
if (evil_portal_obj.selected_html_index < evil_portal_obj.html_files->size() - 1)
evil_portal_obj.selected_html_index++;
else
evil_portal_obj.selected_html_index = 0;

//Serial.println("Setting button text as " + evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index));
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});
this->buildButtons(&htmlMenu, 0, evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index));
this->displayCurrentMenu();
}
#endif
if (c_btn.justPressed()) {
if (evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index) != "Back") {
evil_portal_obj.target_html_name = evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index);
Serial.println("Set Evil Portal HTML as " + evil_portal_obj.target_html_name);
evil_portal_obj.using_serial_html = false;
}
this->changeMenu(htmlMenu.parentMenu);
break;
}
}
#endif
#endif
});

htmlMenu.parentMenu = &wifiGeneralMenu;
this->addNodes(&htmlMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() {
this->changeMenu(htmlMenu.parentMenu);
});

/*int loopLimit = min(evil_portal_obj.html_files->size(), BUTTON_ARRAY_LEN);
for (int i = 0; i < loopLimit - 1; i++) {
this->addNodes(&htmlMenu, evil_portal_obj.html_files->get(i), TFT_CYAN, NULL, 0, [this, i]() {
evil_portal_obj.target_html_name = (String)evil_portal_obj.html_files->get(i);
Serial.println("Set Evil Portal HTML as " + evil_portal_obj.target_html_name);
evil_portal_obj.using_serial_html = false;
this->changeMenu(htmlMenu.parentMenu);
});
}*/

// Select APs on Mini
this->addNodes(&wifiGeneralMenu, text_table1[56], TFT_NAVY, NULL, KEYBOARD_ICO, [this](){
wifiAPMenu.list->clear();
Expand Down Expand Up @@ -1475,6 +1625,11 @@ void MenuFunctions::RunSetup()
this->drawStatusBar();
wifi_scan_obj.StartScan(BT_ATTACK_SWIFTPAIR_SPAM, TFT_CYAN);
});
this->addNodes(&bluetoothAttackMenu, "Samsung BLE Spam", TFT_RED, NULL, GENERAL_APPS, [this]() {
display_obj.clearScreen();
this->drawStatusBar();
wifi_scan_obj.StartScan(BT_ATTACK_SAMSUNG_SPAM, TFT_RED);
});
this->addNodes(&bluetoothAttackMenu, "BLE Spam All", TFT_MAGENTA, NULL, DEAUTH_SNIFF, [this]() {
display_obj.clearScreen();
this->drawStatusBar();
Expand Down Expand Up @@ -1629,9 +1784,10 @@ void MenuFunctions::addNodes(Menu * menu, String name, uint16_t color, Menu * ch
{
TFT_eSPI_Button new_button;
menu->list->add(MenuNode{name, false, color, place, &new_button, selected, callable});
//menu->list->add(MenuNode{name, false, color, place, selected, callable});
}

void MenuFunctions::buildButtons(Menu * menu, int starting_index)
void MenuFunctions::buildButtons(Menu * menu, int starting_index, String button_name)
{
if (menu->list != NULL)
{
Expand All @@ -1640,7 +1796,10 @@ void MenuFunctions::buildButtons(Menu * menu, int starting_index)
{
TFT_eSPI_Button new_button;
char buf[menu->list->get(starting_index + i).name.length() + 1] = {};
menu->list->get(starting_index + i).name.toCharArray(buf, menu->list->get(starting_index + i).name.length() + 1);
if (button_name != "")
menu->list->get(starting_index + i).name.toCharArray(buf, menu->list->get(starting_index + i).name.length() + 1);
else
button_name.toCharArray(buf, button_name.length() + 1);
display_obj.key[i].initButton(&display_obj.tft,
KEY_X + 0 * (KEY_W + KEY_SPACING_X),
KEY_Y + i * (KEY_H + KEY_SPACING_Y), // x, y, w, h, outline, fill, text
Expand Down
7 changes: 6 additions & 1 deletion esp32_marauder/MenuFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ PROGMEM static lv_color_t buf[LV_HOR_RES_MAX * 10];

PROGMEM static void ta_event_cb(lv_obj_t * ta, 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 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);
Expand Down Expand Up @@ -143,6 +144,9 @@ class MenuFunctions
Menu wifiGeneralMenu;
Menu wifiAPMenu;

// WiFi General Menu
Menu htmlMenu;

// Bluetooth menu stuff
Menu bluetoothSnifferMenu;
Menu bluetoothAttackMenu;
Expand Down Expand Up @@ -190,10 +194,11 @@ class MenuFunctions

void initLVGL();
void deinitLVGL();
void selectEPHTMLGFX();
void addSSIDGFX();
void addAPGFX();
void addStationGFX();
void buildButtons(Menu* menu, int starting_index = 0);
void buildButtons(Menu* menu, int starting_index = 0, String button_name = "");
void changeMenu(Menu* menu);
void drawStatusBar();
void displayCurrentMenu(uint8_t start_index = 0);
Expand Down
22 changes: 21 additions & 1 deletion esp32_marauder/SDInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,32 @@ File SDInterface::getFile(String path) {
}
}

void SDInterface::listDirToLinkedList(LinkedList<String>* file_names, String str_dir, String ext) {
if (this->supported) {
File dir = SD.open(str_dir);
while (true)
{
File entry = dir.openNextFile();
if (!entry)
{
break;
}
if (ext != "") {
String file_name = entry.name();
if (file_name.endsWith(ext)) {
file_names->add(file_name);
}
}
}
}
}

void SDInterface::listDir(String str_dir){
if (this->supported) {
File dir = SD.open(str_dir);
while (true)
{
File entry = dir.openNextFile();
File entry = dir.openNextFile();
if (! entry)
{
break;
Expand Down
1 change: 1 addition & 0 deletions esp32_marauder/SDInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class SDInterface {
bool initSD();

void listDir(String str_dir);
void listDirToLinkedList(LinkedList<String>* file_names, String str_dir = "/", String ext = "");
File getFile(String path);
void addPacket(uint8_t* buf, uint32_t len, bool log = false);
void openCapture(String file_name = "");
Expand Down
Loading

0 comments on commit f7992d6

Please sign in to comment.