Skip to content

Commit

Permalink
Remove title screen and add select stations for mini
Browse files Browse the repository at this point in the history
  • Loading branch information
justcallmekoko committed Jun 26, 2024
1 parent 9690c73 commit ccf0c1c
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 11 deletions.
8 changes: 5 additions & 3 deletions esp32_marauder/Assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ PROGMEM static const unsigned char menu_icons[][66] = {
0xE7, 0xE7, 0x0B, 0xD0, 0xFD, 0xBF, 0xFF, 0xFF}
};

#ifndef MARAUDER_MINI
/*#ifndef MARAUDER_MINI
static const uint8_t MarauderTitle[] PROGMEM = {
0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x60,
0x00, 0x60, 0x00, 0x00, 0xFF, 0xE1, 0x00, 0x22, 0x45, 0x78, 0x69, 0x66, 0x00, 0x00, 0x4D, 0x4D,
Expand Down Expand Up @@ -1057,7 +1057,7 @@ PROGMEM static const unsigned char menu_icons[][66] = {
0x28, 0xA2, 0x80, 0x0A, 0x28, 0xA2, 0x80, 0x0A, 0x28, 0xA2, 0x80, 0x0A, 0x28, 0xA2, 0x80, 0x0A,
0x28, 0xA2, 0x80, 0x0A, 0x28, 0xA2, 0x80, 0x0A, 0x28, 0xA2, 0x80, 0x0A, 0x28, 0xA2, 0x80, 0x0A,
0x28, 0xA2, 0x80, 0x0A, 0x28, 0xA2, 0x80, 0x3F, 0xFF, 0xD9};
/*static const uint8_t MarauderTitle[] PROGMEM = {
*//*static const uint8_t MarauderTitle[] PROGMEM = {
0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x60,
0x00, 0x60, 0x00, 0x00, 0xff, 0xe1, 0x00, 0x66, 0x45, 0x78, 0x69, 0x66, 0x00, 0x00, 0x4d, 0x4d,
0x00, 0x2a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x01, 0x1a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01,
Expand Down Expand Up @@ -1455,8 +1455,9 @@ PROGMEM static const unsigned char menu_icons[][66] = {
0xc4, 0x8b, 0x1c, 0x7b, 0xe4, 0x66, 0x6d, 0xaa, 0xbc, 0x05, 0xce, 0x00, 0xe0, 0x50, 0x07, 0x96,
0xd1, 0x45, 0x14, 0x00, 0x51, 0x45, 0x14, 0x00, 0x51, 0x45, 0x14, 0x01, 0xff, 0xd9
};*/
#endif
//#endif

/*
#ifdef MARAUDER_MINI
const uint8_t MarauderTitle[] PROGMEM = {
0xFF, 0xD8, 0xFF, 0xE0, 0x00, 0x10, 0x4A, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x01, 0x00, 0x60,
Expand Down Expand Up @@ -1832,5 +1833,6 @@ PROGMEM static const unsigned char menu_icons[][66] = {
0x28, 0x00, 0xA2, 0x80, 0x0A, 0x28, 0x03, 0xFF, 0xD9};
#endif
*/

#endif
2 changes: 2 additions & 0 deletions esp32_marauder/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ void Display::scrollAddress(uint16_t vsp) {


// JPEG_functions
/*
void Display::drawJpeg(const char *filename, int xpos, int ypos) {
// Open the named file (the Jpeg decoder library will close it after rendering image)
Expand Down Expand Up @@ -452,6 +453,7 @@ void Display::drawJpeg(const char *filename, int xpos, int ypos) {
// Serial.println(F("Jpeg file format not supported!"));
//}
}
*/

/*void Display::setupDraw() {
this->tft.drawLine(0, 0, 10, 0, TFT_MAGENTA);
Expand Down
2 changes: 1 addition & 1 deletion esp32_marauder/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class Display
void buildBanner(String msg, int xpos);
void clearScreen();
void displayBuffer(bool do_clear = false);
void drawJpeg(const char *filename, int xpos, int ypos);
//void drawJpeg(const char *filename, int xpos, int ypos);
void getTouchWhileFunction(bool pressed);
void initScrollValues(bool tte = false);
void jpegInfo();
Expand Down
128 changes: 123 additions & 5 deletions esp32_marauder/MenuFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,7 @@ void MenuFunctions::displaySetting(String key, Menu* menu, int index) {
void MenuFunctions::RunSetup()
{
extern LinkedList<AccessPoint>* access_points;
extern LinkedList<Station>* stations;

this->disable_touch = false;

Expand Down Expand Up @@ -1257,6 +1258,9 @@ void MenuFunctions::RunSetup()
wifiAttackMenu.list = new LinkedList<MenuNode>();
wifiGeneralMenu.list = new LinkedList<MenuNode>();
wifiAPMenu.list = new LinkedList<MenuNode>();
#ifndef HAS_ILI9341
wifiStationMenu.list = new LinkedList<MenuNode>();
#endif

// WiFi HTML menu stuff
htmlMenu.list = new LinkedList<MenuNode>();
Expand Down Expand Up @@ -1312,6 +1316,9 @@ void MenuFunctions::RunSetup()
clearSSIDsMenu.name = text_table1[28];
clearAPsMenu.name = text_table1[29];
wifiAPMenu.name = "Access Points";
#ifndef HAS_ILI9341
wifiStationMenu.name = "Select Stations";
#endif
#ifdef HAS_GPS
gpsInfoMenu.name = "GPS Data";
#endif
Expand Down Expand Up @@ -1533,12 +1540,14 @@ void MenuFunctions::RunSetup()
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_RED);
addAPGFX();
});
// Select Stations on OG
this->addNodes(&wifiGeneralMenu, text_table1[61], TFT_LIGHTGREY, NULL, KEYBOARD_ICO, [this](){
display_obj.clearScreen();
wifi_scan_obj.currentScanMode = LV_ADD_SSID;
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_RED);
addStationGFX();
});
// Select Evil Portal Files on OG
this->addNodes(&wifiGeneralMenu, "Select EP HTML File", TFT_CYAN, NULL, KEYBOARD_ICO, [this](){
display_obj.clearScreen();
wifi_scan_obj.currentScanMode = LV_ADD_SSID;
Expand Down Expand Up @@ -1621,11 +1630,11 @@ void MenuFunctions::RunSetup()
current_menu->list->set(i + 1, new_node);

// Change selection status of button key
if (new_ap.selected) {
this->buttonSelected(i + 1);
} else {
this->buttonNotSelected(i + 1);
}
//if (new_ap.selected) {
// this->buttonSelected(i + 1);
//} else {
// this->buttonNotSelected(i + 1);
//}
access_points->set(i, new_ap);
}, access_points->get(i).selected);
}
Expand All @@ -1636,6 +1645,115 @@ void MenuFunctions::RunSetup()
this->addNodes(&wifiAPMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() {
this->changeMenu(wifiAPMenu.parentMenu);
});

// Select Stations on Mini v1
/*
this->addNodes(&wifiGeneralMenu, "Select Stations", TFT_CYAN, NULL, KEYBOARD_ICO, [this](){
wifiStationMenu.list->clear();
this->addNodes(&wifiStationMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() {
this->changeMenu(wifiStationMenu.parentMenu);
});
int menu_limit;
// Find out how many buttons we will need
if (stations->size() <= BUTTON_ARRAY_LEN)
menu_limit = stations->size();
else
menu_limit = BUTTON_ARRAY_LEN;
// Load buttons with stations
for (int i = 0; i < stations->size(); i++) {
// Check if there is even space left
if (current_menu->list->size() >= menu_limit)
break;
int cur_ap_sta = i;
this->addNodes(&wifiStationMenu, wifi_scan_obj.macToString(stations->get(cur_ap_sta)), TFT_CYAN, NULL, KEYBOARD_ICO, [this, i, cur_ap_sta](){
Station new_sta = stations->get(cur_ap_sta);
new_sta.selected = !stations->get(cur_ap_sta).selected;
// Change selection status of menu node
MenuNode new_node = current_menu->list->get(i + 1);
new_node.selected = !current_menu->list->get(i + 1).selected;
current_menu->list->set(i + 1, new_node);
// Change selection status of button key
//if (new_sta.selected) {
// this->buttonSelected(i + 1);
//} else {
// this->buttonNotSelected(i + 1);
//}
stations->set(cur_ap_sta, new_sta);
}, stations->get(cur_ap_sta).selected);
}
this->changeMenu(&wifiStationMenu);
});
*/

// Select Stations on Mini v2
this->addNodes(&wifiGeneralMenu, "Select Stations", TFT_CYAN, NULL, KEYBOARD_ICO, [this](){
wifiAPMenu.list->clear();
this->addNodes(&wifiAPMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() {
this->changeMenu(wifiAPMenu.parentMenu);
});

int menu_limit;

if (access_points->size() <= BUTTON_ARRAY_LEN)
menu_limit = access_points->size();
else
menu_limit = BUTTON_ARRAY_LEN;

for (int i = 0; i < menu_limit - 1; i++) {
wifiStationMenu.list->clear();
this->addNodes(&wifiAPMenu, access_points->get(i).essid, TFT_CYAN, NULL, KEYBOARD_ICO, [this, i](){

wifiStationMenu.list->clear();

// Add back button to the APs
this->addNodes(&wifiStationMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() {
this->changeMenu(wifiStationMenu.parentMenu);
});

// Add the AP's stations to the specific AP menu
for (int x = 0; x < access_points->get(i).stations->size(); x++) {
int cur_ap_sta = access_points->get(i).stations->get(x);

this->addNodes(&wifiStationMenu, wifi_scan_obj.macToString(stations->get(cur_ap_sta)), TFT_CYAN, NULL, KEYBOARD_ICO, [this, i, cur_ap_sta, x](){
Station new_sta = stations->get(cur_ap_sta);
new_sta.selected = !stations->get(cur_ap_sta).selected;

// Change selection status of menu node
MenuNode new_node = current_menu->list->get(x + 1);
new_node.selected = !current_menu->list->get(x + 1).selected;
current_menu->list->set(x + 1, new_node);

// Change selection status of button key
//if (new_sta.selected) {
// this->buttonSelected(i + 1);
//} else {
// this->buttonNotSelected(i + 1);
//}

stations->set(cur_ap_sta, new_sta);
}, stations->get(cur_ap_sta).selected);
}

// Final change menu to the menu of Stations
this->changeMenu(&wifiStationMenu);

}, false);
}
this->changeMenu(&wifiAPMenu);
});

wifiStationMenu.parentMenu = &wifiAPMenu;
this->addNodes(&wifiStationMenu, text09, TFT_LIGHTGREY, NULL, 0, [this]() {
this->changeMenu(wifiStationMenu.parentMenu);
});
#endif

// Build generate ssids menu
Expand Down
3 changes: 3 additions & 0 deletions esp32_marauder/MenuFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ class MenuFunctions
Menu wifiAttackMenu;
Menu wifiGeneralMenu;
Menu wifiAPMenu;
#ifndef HAS_ILI9341
Menu wifiStationMenu;
#endif

// WiFi General Menu
Menu htmlMenu;
Expand Down
8 changes: 8 additions & 0 deletions esp32_marauder/WiFiScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,14 @@ WiFiScan::WiFiScan()
{
}

String WiFiScan::macToString(const Station& station) {
char macStr[18]; // 6 pairs of hex digits + 5 colons + null terminator
snprintf(macStr, sizeof(macStr), "%02X:%02X:%02X:%02X:%02X:%02X",
station.mac[0], station.mac[1], station.mac[2],
station.mac[3], station.mac[4], station.mac[5]);
return String(macStr);
}

void WiFiScan::RunSetup() {
if (ieee80211_raw_frame_sanity_check(31337, 0, 0) == 1)
this->wsl_bypass_enabled = true;
Expand Down
1 change: 1 addition & 0 deletions esp32_marauder/WiFiScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ class WiFiScan
bool save_serial = false;
void startPcap(String file_name);
void startLog(String file_name);
String macToString(const Station& station);

static void getMAC(char *addr, uint8_t* data, uint16_t offset);
static void pwnSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
Expand Down
4 changes: 2 additions & 2 deletions esp32_marauder/configs.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

//// BOARD TARGETS
//#define MARAUDER_M5STICKC
//#define MARAUDER_MINI
#define MARAUDER_MINI
//#define MARAUDER_V4
//#define MARAUDER_V6
#define MARAUDER_V6_1
//#define MARAUDER_V6_1
//#define MARAUDER_KIT
//#define GENERIC_ESP32
//#define MARAUDER_FLIPPER
Expand Down
3 changes: 3 additions & 0 deletions esp32_marauder/esp32_marauder.ino
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,15 @@ void setup()
backlightOff();

// Draw the title screen
/*
#ifdef HAS_SCREEN
#ifndef MARAUDER_MINI
display_obj.drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
#else
display_obj.drawJpeg("/marauder3L.jpg", 0, 0);
#endif
#endif
*/

#ifdef HAS_SCREEN
#ifndef MARAUDER_MINI
Expand All @@ -210,6 +212,7 @@ void setup()
#endif
#endif


backlightOn(); // Need this

#ifdef HAS_SCREEN
Expand Down

0 comments on commit ccf0c1c

Please sign in to comment.