Skip to content

Commit

Permalink
Merge pull request #484 from justcallmekoko/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
justcallmekoko committed Feb 16, 2024
2 parents c75bd6a + 8b53b56 commit e80fab8
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 11 deletions.
3 changes: 3 additions & 0 deletions esp32_marauder/EvilPortal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,13 @@ bool EvilPortal::setAP(LinkedList<ssid>* ssids, LinkedList<AccessPoint>* access_
}

void EvilPortal::startAP() {
const IPAddress AP_IP(172, 0, 0, 1);

Serial.print("starting ap ");
Serial.println(apName);

WiFi.mode(WIFI_AP);
WiFi.softAPConfig(AP_IP, AP_IP, IPAddress(255, 255, 255, 0));
WiFi.softAP(apName);

#ifdef HAS_SCREEN
Expand Down
19 changes: 15 additions & 4 deletions esp32_marauder/GpsInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ HardwareSerial Serial2(GPS_SERIAL_INDEX);

void GpsInterface::begin() {

#ifdef MARAUDER_MINI
/*#ifdef MARAUDER_MINI
pinMode(26, OUTPUT);
delay(1);
Expand All @@ -22,7 +22,7 @@ void GpsInterface::begin() {
Serial.println("Activated GPS");
delay(100);
#endif
#endif*/


Serial2.begin(9600, SERIAL_8N1, GPS_TX, GPS_RX);
Expand All @@ -34,11 +34,22 @@ void GpsInterface::begin() {

delay(3900);

MicroNMEA::sendSentence(Serial2, "$PSTMFORCESTANDBY,00006");

delay(100);

if (Serial2.available()) {
Serial.println("GPS Attached Successfully");
this->gps_enabled = true;
while (Serial2.available())
Serial2.read();
while (Serial2.available()) {
//Fetch the character one by one
char c = Serial2.read();
//Serial.print(c);
//Pass the character to the library
Serial.print(c);
nmea.process(c);
}
Serial.println(nmea.getSentence());
}
else {
this->gps_enabled = false;
Expand Down
139 changes: 136 additions & 3 deletions esp32_marauder/MenuFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1242,6 +1242,9 @@ void MenuFunctions::RunSetup()

// WiFi HTML menu stuff
htmlMenu.list = new LinkedList<MenuNode>();
#ifdef MARAUDER_MINI
miniKbMenu.list = new LinkedList<MenuNode>();
#endif

// Bluetooth menu stuff
bluetoothSnifferMenu.list = new LinkedList<MenuNode>();
Expand Down Expand Up @@ -1277,6 +1280,9 @@ void MenuFunctions::RunSetup()
gpsInfoMenu.name = "GPS Data";
#endif
htmlMenu.name = "EP HTML List";
#ifdef MARAUDER_MINI
miniKbMenu.name = "Mini Keyboard";
#endif

// Build Main Menu
mainMenu.parentMenu = NULL;
Expand Down Expand Up @@ -1457,6 +1463,12 @@ void MenuFunctions::RunSetup()
addSSIDGFX();
});
#endif
#ifdef MARAUDER_MINI
this->addNodes(&wifiGeneralMenu, text_table1[1], TFT_NAVY, NULL, KEYBOARD_ICO, [this](){
this->changeMenu(&miniKbMenu);
this->miniKeyboard(&miniKbMenu);
});
#endif
this->addNodes(&wifiGeneralMenu, text_table1[28], TFT_SILVER, NULL, CLEAR_ICO, [this]() {
this->changeMenu(&clearSSIDsMenu);
wifi_scan_obj.RunClearSSIDs();
Expand Down Expand Up @@ -1489,7 +1501,7 @@ void MenuFunctions::RunSetup()
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_RED);
selectEPHTMLGFX();
});
#else
#else // Mini EP HTML select
this->addNodes(&wifiGeneralMenu, "Select EP HTML File", TFT_CYAN, NULL, KEYBOARD_ICO, [this](){
this->changeMenu(&htmlMenu);
#ifdef HAS_BUTTONS
Expand All @@ -1501,7 +1513,6 @@ void MenuFunctions::RunSetup()
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();
Expand All @@ -1513,7 +1524,6 @@ void MenuFunctions::RunSetup()
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();
Expand All @@ -1533,6 +1543,11 @@ void MenuFunctions::RunSetup()
#endif
});

miniKbMenu.parentMenu = &wifiGeneralMenu;
this->addNodes(&miniKbMenu, "a", TFT_CYAN, NULL, 0, [this]() {
this->changeMenu(miniKbMenu.parentMenu);
});

htmlMenu.parentMenu = &wifiGeneralMenu;
this->addNodes(&htmlMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() {
this->changeMenu(htmlMenu.parentMenu);
Expand Down Expand Up @@ -1797,6 +1812,124 @@ void MenuFunctions::RunSetup()
this->initTime = millis();
}

#ifdef MARAUDER_MINI
void MenuFunctions::miniKeyboard(Menu * targetMenu) {
// Prepare a char array and reset temp SSID string
extern LinkedList<ssid>* ssids;

bool pressed = true;

wifi_scan_obj.current_mini_kb_ssid = "";

if (c_btn.isHeld()) {
while (!c_btn.justReleased())
delay(1);
}

int str_len = wifi_scan_obj.alfa.length() + 1;

char char_array[str_len];

wifi_scan_obj.alfa.toCharArray(char_array, str_len);

// Button loop until hold center button
#ifdef HAS_BUTTONS
#if !(defined(MARAUDER_V6) || defined(MARAUDER_V6_1))
while(true) {
#ifndef MARAUDER_M5STICKC
// Cycle char previous
if (l_btn.justPressed()) {
pressed = true;
if (this->mini_kb_index > 0)
this->mini_kb_index--;
else
this->mini_kb_index = str_len - 2;

targetMenu->list->set(0, MenuNode{String(char_array[this->mini_kb_index]).c_str(), false, TFT_CYAN, 0, NULL, true, NULL});
this->buildButtons(targetMenu);
//this->displayCurrentMenu();

}

// Add character
if (d_btn.justPressed()) {
pressed = true;
wifi_scan_obj.current_mini_kb_ssid.concat(String(char_array[this->mini_kb_index]).c_str());
while (!d_btn.justReleased())
delay(1);
}

// Remove character
if (u_btn.justPressed()) {
pressed = true;
wifi_scan_obj.current_mini_kb_ssid.remove(wifi_scan_obj.current_mini_kb_ssid.length() - 1);
while (!u_btn.justReleased())
delay(1);
}
#endif

// Cycle char next
if (r_btn.justPressed()) {
pressed = true;
if (this->mini_kb_index < str_len - 2)
this->mini_kb_index++;
else
this->mini_kb_index = 0;

targetMenu->list->set(0, MenuNode{String(char_array[this->mini_kb_index]).c_str(), false, TFT_CYAN, 0, NULL, true, NULL});
this->buildButtons(targetMenu, 0, String(char_array[this->mini_kb_index]).c_str());
//this->displayCurrentMenu();
}

// Add SSID
if (c_btn.justPressed()) {
while (!c_btn.justReleased()) {
c_btn.justPressed(); // Need to continue updating button hold status. My shitty library.

// Exit
if (c_btn.isHeld()) {
this->changeMenu(targetMenu->parentMenu);
return;
}
delay(1);
}
// If we have a string, add it to list of SSIDs
if (wifi_scan_obj.current_mini_kb_ssid != "") {
pressed = true;
ssid s = {wifi_scan_obj.current_mini_kb_ssid, random(1, 12), {random(256), random(256), random(256), random(256), random(256), random(256)}, false};
ssids->unshift(s);
wifi_scan_obj.current_mini_kb_ssid = "";
}
}

// Display info on screen
if (pressed) {
this->displayCurrentMenu();
display_obj.tft.setTextWrap(false);
display_obj.tft.fillRect(0, SCREEN_HEIGHT / 3, SCREEN_WIDTH, STATUS_BAR_WIDTH, TFT_BLACK);
display_obj.tft.fillRect(0, SCREEN_HEIGHT / 3 + TEXT_HEIGHT * 2, SCREEN_WIDTH, STATUS_BAR_WIDTH, TFT_BLACK);
display_obj.tft.setCursor(0, SCREEN_HEIGHT / 3);
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
display_obj.tft.println(wifi_scan_obj.current_mini_kb_ssid + "\n");
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);

display_obj.tft.println(ssids->get(0).essid);

display_obj.tft.setTextColor(TFT_ORANGE, TFT_BLACK);
display_obj.tft.println("U - Remove Char");
display_obj.tft.println("D - Add Char");
display_obj.tft.println("L - Previous Char");
display_obj.tft.println("R - Next Char");
display_obj.tft.println("C - Save");
display_obj.tft.println("C(Hold) - Exit");
pressed = false;
}
}
#endif
#endif
}
#endif

// Function to change menu
void MenuFunctions::changeMenu(Menu * menu)
{
Expand Down
5 changes: 5 additions & 0 deletions esp32_marauder/MenuFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ class MenuFunctions

uint32_t initTime = 0;
uint8_t menu_start_index = 0;
uint8_t mini_kb_index = 0;

// Main menu stuff
Menu mainMenu;
Expand Down Expand Up @@ -148,6 +149,7 @@ class MenuFunctions

// WiFi General Menu
Menu htmlMenu;
Menu miniKbMenu;

// Bluetooth menu stuff
Menu bluetoothSnifferMenu;
Expand All @@ -171,6 +173,9 @@ class MenuFunctions
void displaySetting(String key, Menu* menu, int index);
void buttonSelected(uint8_t b, int8_t x = -1);
void buttonNotSelected(uint8_t b, int8_t x = -1);
#ifdef MARAUDER_MINI
void miniKeyboard(Menu * targetMenu);
#endif

uint8_t updateTouch(uint16_t *x, uint16_t *y, uint16_t threshold = 600);

Expand Down
4 changes: 3 additions & 1 deletion esp32_marauder/WiFiScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ class WiFiScan

//String connected_network = "";
//const String alfa = "1234567890qwertyuiopasdfghjkklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM_";
const String alfa = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789-=[];',./`\\_+{}:\"<>?~|!@#$%^&*()";

const char* rick_roll[8] = {
"01 Never gonna give you up",
Expand Down Expand Up @@ -356,6 +355,9 @@ class WiFiScan
String dst_mac = "ff:ff:ff:ff:ff:ff";
byte src_mac[6] = {};

String current_mini_kb_ssid = "";

const String alfa = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789-=[];',./`\\_+{}:\"<>?~|!@#$%^&*()";

wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
wifi_config_t ap_config;
Expand Down
6 changes: 3 additions & 3 deletions esp32_marauder/configs.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

//// BOARD TARGETS
//#define MARAUDER_M5STICKC
//#define MARAUDER_MINI
#define MARAUDER_MINI
//#define MARAUDER_V4
#define MARAUDER_V6
//#define MARAUDER_V6
//#define MARAUDER_V6_1
//#define MARAUDER_KIT
//#define GENERIC_ESP32
Expand All @@ -20,7 +20,7 @@
//#define XIAO_ESP32_S3
//// END BOARD TARGETS

#define MARAUDER_VERSION "v0.13.7"
#define MARAUDER_VERSION "v0.13.8"

//// HARDWARE NAMES
#ifdef MARAUDER_M5STICKC
Expand Down
Binary file not shown.
Binary file not shown.
Binary file removed mechanical/Marauder-Mini/MarauderMini-Bottom v8.stl
Binary file not shown.

0 comments on commit e80fab8

Please sign in to comment.