Skip to content

Commit

Permalink
Merge pull request #365 from justcallmekoko/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
justcallmekoko authored Oct 26, 2023
2 parents 6612c48 + 5dd5612 commit 86a4326
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 73 deletions.
1 change: 1 addition & 0 deletions PCBs/FlipperZero/WiFi-Devboard-Pro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Header Pin x8: [C2883805](https://www.lcsc.com/product-detail/Pin-Headers_XKB-Connectivity-X6511WVS-08H-C60D48R1_C2883805.html)
- Header Pin x10: [C2883807](https://www.lcsc.com/product-detail/Pin-Headers_XKB-Connectivity-X6511WVS-10H-C60D48R1_C2883807.html)
- Alternative Header: [M20-8771246](https://www.mouser.com/ProductDetail/Harwin/M20-8771246?qs=WS5Jv%252B%252Bx1qWzrNY%252Bb2U9JQ%3D%3D&countryCode=US&currencyCode=USD)
- or [M20-8771042](https://www.mouser.com/ProductDetail/Harwin/M20-8771042?qs=%252Bk6%2F5FB6qrlBSpg9%252Bi11Bg%3D%3D)
- Light Pipe: [PLP2-188](https://www.digikey.com/en/products/detail/bivar-inc/PLP2-188/5721973?utm_medium=email&utm_source=oce&utm_campaign=4251_OCE23RT&utm_content=productdetail_US&utm_cid=2955578&so=79456987&mkt_tok=MDI4LVNYSy01MDcAAAGJOBaFWa7m6RHsJZT6mWcYRd9LRyXmqis92EV7j5ftyM5NuNOSOPqUp292m0P5E3FKrEWCFuvb9fObSzuSvVMsopuOMPjO46ylCAR1IzCL)
- M2x6mm Round Top Screw: [97763A407](https://www.mcmaster.com/97763A407/)
- M2x8mm Countersunk Screw: [91294A005](https://www.mcmaster.com/91294A005/)
Expand Down
2 changes: 1 addition & 1 deletion esp32_marauder/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void Display::RunSetup()
#endif

#ifdef MARAUDER_M5STICKC
tft.setRotation(3);
tft.setRotation(1);
#endif

tft.setCursor(0, 0);
Expand Down
1 change: 1 addition & 0 deletions esp32_marauder/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class Display
bool tteBar = false;
bool draw_tft = false;
bool exit_draw = false;
bool headless_mode = false;

uint8_t TOP_FIXED_AREA_2 = 48;
uint8_t print_delay_1, print_delay_2 = 10;
Expand Down
4 changes: 2 additions & 2 deletions esp32_marauder/EvilPortal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ bool EvilPortal::setHtml() {
File html_file = sd_obj.getFile("/" + this->target_html_name);
if (!html_file) {
#ifdef HAS_SCREEN
this->sendToDisplay("Could not find /index.html.");
this->sendToDisplay("Could not find /" + this->target_html_name);
this->sendToDisplay("Touch to exit...");
#endif
Serial.println("Could not find /index.html. Use stopscan...");
Serial.println("Could not find /" + this->target_html_name + ". Use stopscan...");
return false;
}
else {
Expand Down
142 changes: 93 additions & 49 deletions esp32_marauder/MenuFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ MenuFunctions::MenuFunctions()
/* Interrupt driven periodic handler */

#ifdef HAS_ILI9341
uint8_t MenuFunctions::updateTouch(uint16_t *x, uint16_t *y, uint16_t threshold) {
if (!display_obj.headless_mode)
return display_obj.tft.getTouch(x, y, threshold);
else
return !display_obj.headless_mode;
}

void MenuFunctions::lv_tick_handler()
{
lv_tick_inc(LVGL_TICK_PERIOD);
Expand Down Expand Up @@ -386,14 +393,18 @@ MenuFunctions::MenuFunctions()
#endif
//// END LV_ARDUINO STUFF

void MenuFunctions::buttonNotSelected(uint8_t b) {
void MenuFunctions::buttonNotSelected(uint8_t b, int8_t x) {
if (x == -1)
x = b;
display_obj.tft.setFreeFont(NULL);
display_obj.key[b].drawButton(false, current_menu->list->get(b).name);
display_obj.key[b].drawButton(false, current_menu->list->get(x).name);
}

void MenuFunctions::buttonSelected(uint8_t b) {
void MenuFunctions::buttonSelected(uint8_t b, int8_t x) {
if (x == -1)
x = b;
display_obj.tft.setFreeFont(NULL);
display_obj.key[b].drawButton(true, current_menu->list->get(b).name);
display_obj.key[b].drawButton(true, current_menu->list->get(x).name);
}

// Function to check menu input
Expand Down Expand Up @@ -456,7 +467,7 @@ void MenuFunctions::main(uint32_t currentTime)

// getTouch causes a 10ms delay which makes beacon spam less effective
#ifdef HAS_ILI9341
pressed = display_obj.tft.getTouch(&t_x, &t_y);
pressed = this->updateTouch(&t_x, &t_y);
#endif


Expand Down Expand Up @@ -643,50 +654,77 @@ void MenuFunctions::main(uint32_t currentTime)
#endif

#ifdef HAS_BUTTONS
#ifndef MARAUDER_M5STICKC
if (u_btn.justPressed()){
#if !(defined(MARAUDER_V6) || defined(MARAUDER_V6_1))
#ifndef MARAUDER_M5STICKC
if (u_btn.justPressed()){
if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_OFF) ||
(wifi_scan_obj.currentScanMode == OTA_UPDATE)) {
if (current_menu->selected > 0) {
current_menu->selected--;
// Page up
if (current_menu->selected < this->menu_start_index) {
this->buildButtons(current_menu, current_menu->selected);
this->displayCurrentMenu(current_menu->selected);
}
this->buttonSelected(current_menu->selected - this->menu_start_index, current_menu->selected);
if (!current_menu->list->get(current_menu->selected + 1).selected)
this->buttonNotSelected(current_menu->selected + 1 - this->menu_start_index, current_menu->selected + 1);
}
// Loop to end
else {
current_menu->selected = current_menu->list->size() - 1;
if (current_menu->selected >= BUTTON_SCREEN_LIMIT) {
this->buildButtons(current_menu, current_menu->selected + 1 - BUTTON_SCREEN_LIMIT);
this->displayCurrentMenu(current_menu->selected + 1 - BUTTON_SCREEN_LIMIT);
}
this->buttonSelected(current_menu->selected, current_menu->selected);
if (!current_menu->list->get(0).selected)
this->buttonNotSelected(0, this->menu_start_index);
}
}
else if ((wifi_scan_obj.currentScanMode == WIFI_PACKET_MONITOR) ||
(wifi_scan_obj.currentScanMode == WIFI_SCAN_EAPOL)) {
if (wifi_scan_obj.set_channel < 14)
wifi_scan_obj.changeChannel(wifi_scan_obj.set_channel + 1);
}
}
#endif
if (d_btn.justPressed()){
if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_OFF) ||
(wifi_scan_obj.currentScanMode == OTA_UPDATE)) {
if (current_menu->selected > 0) {
current_menu->selected--;
if (current_menu->selected < current_menu->list->size() - 1) {
current_menu->selected++;
this->buttonSelected(current_menu->selected - this->menu_start_index, current_menu->selected);
if (!current_menu->list->get(current_menu->selected - 1).selected)
this->buttonNotSelected(current_menu->selected - 1 - this->menu_start_index, current_menu->selected - 1);
// Page down
if (current_menu->selected - this->menu_start_index >= BUTTON_SCREEN_LIMIT) {
this->buildButtons(current_menu, current_menu->selected + 1 - BUTTON_SCREEN_LIMIT);
this->displayCurrentMenu(current_menu->selected + 1 - BUTTON_SCREEN_LIMIT);
}
}
// Loop to beginning
else {
if (current_menu->selected >= BUTTON_SCREEN_LIMIT) {
this->buildButtons(current_menu);
this->displayCurrentMenu();
}
current_menu->selected = 0;
this->buttonSelected(current_menu->selected);
if (!current_menu->list->get(current_menu->selected + 1).selected)
this->buttonNotSelected(current_menu->selected + 1);
if (!current_menu->list->get(current_menu->list->size() - 1).selected)
this->buttonNotSelected(current_menu->list->size() - 1);
}
}
else if ((wifi_scan_obj.currentScanMode == WIFI_PACKET_MONITOR) ||
(wifi_scan_obj.currentScanMode == WIFI_SCAN_EAPOL)) {
if (wifi_scan_obj.set_channel < 14)
wifi_scan_obj.changeChannel(wifi_scan_obj.set_channel + 1);
}
}
#endif
if (d_btn.justPressed()){
if ((wifi_scan_obj.currentScanMode == WIFI_SCAN_OFF) ||
(wifi_scan_obj.currentScanMode == OTA_UPDATE)) {
if (current_menu->selected < current_menu->list->size() - 1) {
current_menu->selected++;
this->buttonSelected(current_menu->selected);
if (!current_menu->list->get(current_menu->selected - 1).selected)
this->buttonNotSelected(current_menu->selected - 1);
}
else {
current_menu->selected = 0;
this->buttonSelected(current_menu->selected);
if (!current_menu->list->get(current_menu->list->size() - 1).selected)
this->buttonNotSelected(current_menu->list->size() - 1);
if (wifi_scan_obj.set_channel > 1)
wifi_scan_obj.changeChannel(wifi_scan_obj.set_channel - 1);
}
}
else if ((wifi_scan_obj.currentScanMode == WIFI_PACKET_MONITOR) ||
(wifi_scan_obj.currentScanMode == WIFI_SCAN_EAPOL)) {
if (wifi_scan_obj.set_channel > 1)
wifi_scan_obj.changeChannel(wifi_scan_obj.set_channel - 1);
if(c_btn_press){
current_menu->list->get(current_menu->selected).callable();
}
}
if(c_btn_press){
current_menu->list->get(current_menu->selected).callable();
}

#endif
#endif
}

Expand Down Expand Up @@ -819,6 +857,9 @@ void MenuFunctions::updateStatusBar()
display_obj.tft.setTextColor(TFT_WHITE, STATUSBAR_COLOR);

display_obj.tft.drawString(gps_obj.getNumSatsString(), 22, 0, 2);
#elif defined(HAS_SCREEN)
display_obj.tft.setTextColor(the_color, STATUSBAR_COLOR);
display_obj.tft.drawString("GPS", 0, 0, 1);
#endif
}
#endif
Expand All @@ -828,7 +869,7 @@ void MenuFunctions::updateStatusBar()
// WiFi Channel Stuff
if (wifi_scan_obj.set_channel != wifi_scan_obj.old_channel) {
wifi_scan_obj.old_channel = wifi_scan_obj.set_channel;
display_obj.tft.fillRect(50, 0, 50, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
display_obj.tft.fillRect(50, 0, TFT_WIDTH * 0.21, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
#ifdef HAS_ILI9341
display_obj.tft.drawString("CH: " + (String)wifi_scan_obj.set_channel, 50, 0, 2);
#endif
Expand Down Expand Up @@ -1178,11 +1219,13 @@ void MenuFunctions::RunSetup()
wifi_scan_obj.StartScan(WIFI_PACKET_MONITOR, TFT_BLUE);
});
#endif
/*this->addNodes(&wifiSnifferMenu, text_table1[47], TFT_RED, NULL, PWNAGOTCHI, [this]() {
display_obj.clearScreen();
this->drawStatusBar();
wifi_scan_obj.StartScan(WIFI_SCAN_PWN, TFT_RED);
});*/
#ifndef HAS_ILI9341
this->addNodes(&wifiSnifferMenu, text_table1[47], TFT_RED, NULL, PWNAGOTCHI, [this]() {
display_obj.clearScreen();
this->drawStatusBar();
wifi_scan_obj.StartScan(WIFI_SCAN_PWN, TFT_RED);
});
#endif
this->addNodes(&wifiSnifferMenu, text_table1[49], TFT_MAGENTA, NULL, BEACON_SNIFF, [this]() {
display_obj.clearScreen();
this->drawStatusBar();
Expand Down Expand Up @@ -1581,6 +1624,7 @@ void MenuFunctions::buildButtons(Menu * menu, int starting_index)
{
if (menu->list != NULL)
{
this->menu_start_index = starting_index;
for (uint8_t i = 0; i < menu->list->size(); i++)
{
TFT_eSPI_Button new_button;
Expand All @@ -1603,7 +1647,7 @@ void MenuFunctions::buildButtons(Menu * menu, int starting_index)
}


void MenuFunctions::displayCurrentMenu()
void MenuFunctions::displayCurrentMenu(uint8_t start_index)
{
//Serial.println(F("Displaying current menu..."));
display_obj.clearScreen();
Expand All @@ -1621,7 +1665,7 @@ void MenuFunctions::displayCurrentMenu()
display_obj.tft.setFreeFont(NULL);
display_obj.tft.setTextSize(1);
#endif
for (uint8_t i = 0; i < current_menu->list->size(); i++)
for (uint8_t i = start_index; i < current_menu->list->size(); i++)
{
#ifdef HAS_ILI9341
if (!current_menu->list->get(i).selected)
Expand All @@ -1642,9 +1686,9 @@ void MenuFunctions::displayCurrentMenu()

#if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC)
if ((current_menu->selected == i) || (current_menu->list->get(i).selected))
display_obj.key[i].drawButton(true, current_menu->list->get(i).name);
display_obj.key[i - start_index].drawButton(true, current_menu->list->get(i).name);
else
display_obj.key[i].drawButton(false, current_menu->list->get(i).name);
display_obj.key[i - start_index].drawButton(false, current_menu->list->get(i).name);
#endif
}
display_obj.tft.setFreeFont(NULL);
Expand Down
9 changes: 6 additions & 3 deletions esp32_marauder/MenuFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class MenuFunctions
String u_result = "";

uint32_t initTime = 0;
uint8_t menu_start_index = 0;


// Main menu stuff
Expand Down Expand Up @@ -163,8 +164,10 @@ class MenuFunctions
String callSetting(String key);
void runBoolSetting(String ley);
void displaySetting(String key, Menu* menu, int index);
void buttonSelected(uint8_t b);
void buttonNotSelected(uint8_t b);
void buttonSelected(uint8_t b, int8_t x = -1);
void buttonNotSelected(uint8_t b, int8_t x = -1);

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

public:
MenuFunctions();
Expand Down Expand Up @@ -193,7 +196,7 @@ class MenuFunctions
void buildButtons(Menu* menu, int starting_index = 0);
void changeMenu(Menu* menu);
void drawStatusBar();
void displayCurrentMenu();
void displayCurrentMenu(uint8_t start_index = 0);
void main(uint32_t currentTime);
void RunSetup();
void orientDisplay();
Expand Down
30 changes: 20 additions & 10 deletions esp32_marauder/WiFiScan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,11 @@ void WiFiScan::startWiFiAttacks(uint8_t scan_mode, uint16_t color, String title_
display_obj.initScrollValues(true);
display_obj.tft.setTextWrap(false);
display_obj.tft.setTextColor(TFT_BLACK, color);
display_obj.tft.fillRect(0,16,240,16, color);
display_obj.tft.drawCentreString((String)title_string,120,16,2);
display_obj.touchToExit();
#ifdef HAS_ILI9341
display_obj.tft.fillRect(0,16,240,16, color);
display_obj.tft.drawCentreString((String)title_string,120,16,2);
display_obj.touchToExit();
#endif
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
#endif

Expand Down Expand Up @@ -1461,7 +1463,11 @@ const char* WiFiScan::generateRandomName() {
}

void WiFiScan::generateRandomMac(uint8_t* mac) {
for (int i = 0; i < 6; i++) {
// Set the locally administered bit and unicast bit for the first byte
mac[0] = 0x02; // The locally administered bit is the second least significant bit

// Generate the rest of the MAC address
for (int i = 1; i < 6; i++) {
mac[i] = random(0, 255);
}
}
Expand Down Expand Up @@ -1853,9 +1859,11 @@ void WiFiScan::RunSourApple(uint8_t scan_mode, uint16_t color) {
display_obj.initScrollValues(true);
display_obj.tft.setTextWrap(false);
display_obj.tft.setTextColor(TFT_BLACK, color);
display_obj.tft.fillRect(0,16,240,16, color);
display_obj.tft.drawCentreString("Sour Apple",120,16,2);
display_obj.touchToExit();
#ifdef HAS_ILI9341
display_obj.tft.fillRect(0,16,240,16, color);
display_obj.tft.drawCentreString("Sour Apple",120,16,2);
display_obj.touchToExit();
#endif
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
#endif

Expand All @@ -1873,9 +1881,11 @@ void WiFiScan::RunSwiftpairSpam(uint8_t scan_mode, uint16_t color) {
display_obj.initScrollValues(true);
display_obj.tft.setTextWrap(false);
display_obj.tft.setTextColor(TFT_BLACK, color);
display_obj.tft.fillRect(0,16,240,16, color);
display_obj.tft.drawCentreString("Swiftpair Spam",120,16,2);
display_obj.touchToExit();
#ifdef HAS_ILI9341
display_obj.tft.fillRect(0,16,240,16, color);
display_obj.tft.drawCentreString("Swiftpair Spam",120,16,2);
display_obj.touchToExit();
#endif
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
#endif

Expand Down
Loading

0 comments on commit 86a4326

Please sign in to comment.