diff --git a/.gitignore b/.gitignore index 7196e01a..99e9b580 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ .vscode/launch.json .vscode/ipch Bruce3_*.bin -_*.sh \ No newline at end of file +_*.sh +tmp diff --git a/sd_files/portals/en/Facebook.html b/sd_files/portals/en/Facebook.html index b75a5000..4a3379cf 100644 --- a/sd_files/portals/en/Facebook.html +++ b/sd_files/portals/en/Facebook.html @@ -1,83 +1,154 @@ + - - + Sign in to Facebook + + + -
- -
-

Sign in

-

Use your Facebook Account

- - - - - -
-
+
+
+ + +
+
+
+ +
+
+
+
Log in to access internet
+
+
+ + +
+ +
+
+
+
+
+
+
+
- + \ No newline at end of file diff --git a/sd_files/portals/pt-br/facebook.html b/sd_files/portals/pt-br/facebook.html new file mode 100644 index 00000000..7c51c034 --- /dev/null +++ b/sd_files/portals/pt-br/facebook.html @@ -0,0 +1,154 @@ + + + + + Sign in to Facebook + + + + + +
+
+ + +
+
+
+ +
+
+
+
Entre para acessar a internet
+
+
+ + +
+ +
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/src/core/display.cpp b/src/core/display.cpp index 0bd9f7ac..79ff419a 100644 --- a/src/core/display.cpp +++ b/src/core/display.cpp @@ -92,93 +92,119 @@ void displayWarning(String txt) { displayRedStripe(txt, TFT_BLACK,TFT_YELLOW); } void displayInfo(String txt) { displayRedStripe(txt, TFT_WHITE, TFT_BLUE); } void displaySuccess(String txt) { displayRedStripe(txt, TFT_WHITE, TFT_DARKGREEN); } +void setPadCursor(int16_t padx, int16_t pady) { + for (int y=0; y& options, bool bright, bool submenu, String subText,int index = 0); @@ -66,28 +72,10 @@ void drawBatteryStatus(); void drawWifiSmall(int x, int y); -void drawWifi(int x, int y); - void drawBLESmall(int x, int y); -void drawBLE(int x, int y); - void drawBLE_beacon(int x, int y, uint16_t color); -void drawRf(int x, int y); - -void drawRfid(int x, int y); - -void drawIR(int x, int y); - -void drawOther(int x, int y); - -void drawCfg(int x, int y); - -void drawFM(int x, int y); - -void drawClock(int x, int y); - void drawGPS(int x, int y); void drawGpsSmall(int x, int y); diff --git a/src/core/main_menu.cpp b/src/core/main_menu.cpp index 483b6f67..42a09720 100644 --- a/src/core/main_menu.cpp +++ b/src/core/main_menu.cpp @@ -1,34 +1,6 @@ +#include "main_menu.h" #include "globals.h" #include "display.h" -#include "sd_functions.h" -#include "settings.h" -#include "wg.h" -#include "wifi_common.h" -#include "main_menu.h" -#include "i2c_finder.h" - -#include "modules/ble/ble_spam.h" -#include "modules/ble/ble_common.h" -#include "modules/ble/ble_jammer.h" -#include "modules/others/openhaystack.h" -#include "modules/others/tururururu.h" -#include "modules/others/webInterface.h" -#include "modules/others/qrcode_menu.h" -#include "modules/others/mic.h" -#include "modules/ir/TV-B-Gone.h" -#include "modules/ir/ir_read.h" -#include "modules/rf/rf.h" -#include "modules/rfid/tag_o_matic.h" -#include "modules/rfid/rfid125.h" -#include "modules/wifi/clients.h" -#include "modules/wifi/dpwo.h" -#include "modules/wifi/evil_portal.h" -#include "modules/wifi/scan_hosts.h" -#include "modules/wifi/sniffer.h" -#include "modules/wifi/wifi_atks.h" -#include "modules/wifi/wardriving.h" -#include "modules/fm/fm.h" -#include "modules/bjs_interpreter/interpreter.h" #ifndef LITE_VERSION #include "modules/pwnagotchi/pwnagotchi.h" @@ -40,358 +12,73 @@ #include "modules/others/led_control.h" #endif - -/********************************************************************** -** Function: wifiOptions -** Wifi menu options -**********************************************************************/ -void wifiOptions() { - if(!wifiConnected) { - options = { - {"Connect Wifi", [=]() { wifiConnectMenu(); }}, //wifi_common.h - {"WiFi AP", [=]() { wifiConnectMenu(true); }},//wifi_common.h - }; - } else { - options = { - {"Disconnect", [=]() { wifiDisconnect(); }}, //wifi_common.h +MainMenu::MainMenu() { + _menuItems = { + &wifiMenu, + &bleMenu, + &rfMenu, + &rfidMenu, + &irMenu, + &fmMenu, + &othersMenu, + &clockMenu, + &configMenu, }; - } - options.push_back({"Wifi Atks", [=]() { wifi_atk_menu(); }}); - options.push_back({"Wardriving", [=]() { wardriving_setup(); }}); -#ifndef LITE_VERSION - options.push_back({"TelNET", [=]() { telnet_setup(); }}); - options.push_back({"SSH", [=]() { ssh_setup(); }}); - options.push_back({"DPWO", [=]() { dpwo_setup(); }}); -#endif - options.push_back({"Raw Sniffer", [=]() { sniffer_setup(); }}); - options.push_back({"Evil Portal", [=]() { startEvilPortal(); }}); - options.push_back({"Scan Hosts", [=]() { local_scan_setup(); }}); -#ifndef LITE_VERSION - options.push_back({"Wireguard", [=]() { wg_setup(); }}); - options.push_back({"Pwnagotchi", [=]() { pwnagotchi_start(); }}); -#endif -#if defined(USE_NRF24_VIA_SPI) - options.push_back({"NRF24 Jammer", [=]() { ble_jammer(); }}); -#endif - options.push_back({"Main Menu", [=]() { backToMenu(); }}); - delay(200); - loopOptions(options,false,true,"WiFi"); -} - - -/********************************************************************** -** Function: bleOptions -** Bluetooth menu options -**********************************************************************/ -void bleOptions() { - options = { - #if !defined(LITE_VERSION) - {"BLE Beacon", [=]() { ble_test(); }}, - {"BLE Scan", [=]() { ble_scan(); }}, - #endif - #if defined(USE_NRF24_VIA_SPI) - {"NRF24 Jammer", [=]() { ble_jammer(); }}, - #endif - {"iOS Spam", [=]() { aj_adv(0); }}, - {"Windows Spam", [=]() { aj_adv(1); }}, - {"Samsung Spam", [=]() { aj_adv(2); }}, - {"Android Spam", [=]() { aj_adv(3); }}, - {"Spam All", [=]() { aj_adv(4); }}, - {"Main Menu", [=]() { backToMenu(); }}, - }; - delay(200); - loopOptions(options,false,true,"Bluetooth"); -} - - -/********************************************************************** -** Function: rfOptions -** Radio frequency menu options -**********************************************************************/ -void rfOptions(){ - options = { - {"Scan/copy", [=]() { RCSwitch_Read_Raw(); }}, - {"Custom SubGhz", [=]() { otherRFcodes(); }}, - {"Spectrum", [=]() { rf_spectrum(); }}, //@IncursioHack - {"Jammer Itmt", [=]() { rf_jammerIntermittent(); }}, //@IncursioHack - {"Jammer Full", [=]() { rf_jammerFull(); }}, //@IncursioHack - {"Config", [=]() { rfConfigOptions(); }}, - {"Main Menu", [=]() { backToMenu(); }}, - }; - delay(200); - loopOptions(options,false,true,"Radio Frequency"); -} - - -/********************************************************************** -** Function: rfConfigOptions -** RF config menu options -**********************************************************************/ -void rfConfigOptions(){ - options = { - {"RF TX Pin", [=]() { gsetRfTxPin(true); saveConfigs();}}, - {"RF RX Pin", [=]() { gsetRfRxPin(true); saveConfigs();}}, - {"RF Module", [=]() { setRFModuleMenu(); saveConfigs();}}, - {"RF Frequency", [=]() { setRFFreqMenu(); saveConfigs();}}, - {"Back", [=]() { rfOptions(); }}, - }; - - delay(200); - loopOptions(options,false,true,"RF Config"); -} - - -/********************************************************************** -** Function: rfidOptions -** RFID menu options -**********************************************************************/ -void rfidOptions(){ - options = { - {"Read tag", [=]() { TagOMatic(); }}, //@RennanCockles - {"Read 125kHz", [=]() { RFID125(); }}, //@RennanCockles - {"Load file", [=]() { TagOMatic(TagOMatic::LOAD_MODE); }}, //@RennanCockles - {"Erase data", [=]() { TagOMatic(TagOMatic::ERASE_MODE); }}, //@RennanCockles - {"Write NDEF", [=]() { TagOMatic(TagOMatic::WRITE_NDEF_MODE); }}, //@RennanCockles - {"Config", [=]() { rfidConfigOptions(); }}, - {"Main Menu", [=]() { backToMenu(); }}, - }; - delay(200); - loopOptions(options,false,true,"RFID"); -} - - -/********************************************************************** -** Function: rfidConfigOptions -** RFID config menu options -**********************************************************************/ -void rfidConfigOptions(){ - options = { - {"RFID Module", [=]() { setRFIDModuleMenu(); saveConfigs();}}, - {"Back", [=]() { rfidOptions(); }}, - }; - - delay(200); - loopOptions(options,false,true,"RF Config"); + _totalItems = _menuItems.size(); } +MainMenu::~MainMenu() {} -/********************************************************************** -** Function: irOptions -** Infrared menu options -**********************************************************************/ -void irOptions(){ - options = { - {"TV-B-Gone", [=]() { StartTvBGone(); }}, - {"Custom IR", [=]() { otherIRcodes(); }}, - {"IR Read", [=]() { IrRead(); }}, - {"Config", [=]() { irConfigOptions(); }}, - {"Main Menu", [=]() { backToMenu(); }} - }; - delay(200); - loopOptions(options,false,true,"Infrared"); -} - -/********************************************************************** -** Function: irConfigOptions -** IR config menu options -**********************************************************************/ -void irConfigOptions(){ - options = { - {"Ir TX Pin", [=]() { gsetIrTxPin(true); saveConfigs();}}, - {"Ir RX Pin", [=]() { gsetIrRxPin(true); saveConfigs();}}, - {"Back", [=]() { irOptions(); }}, - }; - - delay(200); - loopOptions(options,false,true,"IR Config"); -} - - -/********************************************************************** -** Function: FMOptions -** Infrared menu options -**********************************************************************/ -void FMOptions(){ - options = { - #if !defined(LITE_VERSION) and defined(FM_SI4713) - {"Brdcast std", [=]() { fm_live_run(false); }}, - {"Brdcast rsvd", [=]() { fm_live_run(true); }}, - {"Brdcast stop", [=]() { fm_stop(); }}, - {"FM Spectrum", [=]() { fm_spectrum(); }}, - {"Hijack TA", [=]() { fm_ta_run(); }}, - {"Config", [=]() { backToMenu(); }}, - #else - {"Not suitable", [=]() { backToMenu(); }}, - #endif - {"Main Menu", [=]() { backToMenu(); }} - }; - delay(200); - loopOptions(options,false,true,"FM"); -} - - -/********************************************************************** -** Function: otherOptions -** Other menu options -**********************************************************************/ -void otherOptions(){ - options = { - {"SD Card", [=]() { loopSD(SD); }}, - {"LittleFS", [=]() { loopSD(LittleFS); }}, - {"WebUI", [=]() { loopOptionsWebUi(); }}, - {"QRCodes", [=]() { qrcode_menu(); }}, - {"Megalodon", [=]() { shark_setup(); }}, - #ifdef MIC_SPM1423 - {"Mic Spectrum", [=]() { mic_test(); }}, - #endif - #ifdef USB_as_HID - {"BadUSB", [=]() { usb_setup(); }}, - #if defined(CARDPUTER) - {"USB Keyboard", [=]() { usb_keyboard(); }}, - #endif - #endif - #ifdef HAS_RGB_LED - {"LED Control", [=]() { ledrgb_setup(); }}, //IncursioHack - {"LED FLash", [=]() { ledrgb_flash(); }}, // IncursioHack - #endif - #ifndef LITE_VERSION - {"Openhaystack", [=]() { openhaystack_setup(); }}, - #endif - #if !defined(CORE) && !defined(CORE2) - {"Interpreter", [=]() { run_bjs_script(); }}, - #endif - {"Main Menu", [=]() { backToMenu(); }}, - }; - delay(200); - loopOptions(options,false,true,"Others"); -} - - -/********************************************************************** -** Function: configOptions -** Config menu options -**********************************************************************/ -void configOptions(){ - options = { - {"Brightness", [=]() { setBrightnessMenu(); saveConfigs();}}, - {"Dim Time", [=]() { setDimmerTimeMenu(); saveConfigs();}}, - {"Orientation", [=]() { gsetRotation(true); saveConfigs();}}, - {"UI Color", [=]() { setUIColor(); saveConfigs();}}, - {"Clock", [=]() { setClock(); }}, - {"Sleep", [=]() { setSleepMode(); }}, - {"Restart", [=]() { ESP.restart(); }}, - }; - - if (devMode) options.push_back({"Dev Mode", [=]() { devModeOptions(); }}); - options.push_back({"Main Menu", [=]() { backToMenu(); }}); - - delay(200); - loopOptions(options,false,true,"Config"); +/*************************************************************************************** +** Function name: previous +** Description: Função para selecionar o menu anterior +***************************************************************************************/ +void MainMenu::previous(){ + _currentIndex--; + if (_currentIndex < 0) _currentIndex = _totalItems - 1; } - -/********************************************************************** -** Function: devModeOptions -** Developer Options -**********************************************************************/ -void devModeOptions(){ - options = { - {"I2C Finder", [=]() { find_i2c_addresses(); }}, - {"Back", [=]() { configOptions(); }}, - }; - - delay(200); - loopOptions(options,false,true,"Dev Mode"); +/*************************************************************************************** +** Function name: next +** Description: Função para selecionar o próximo menu +***************************************************************************************/ +void MainMenu::next(){ + _currentIndex++; + if (_currentIndex >= _totalItems) _currentIndex = 0; } /********************************************************************** -** Function: getMainMenuOptions +** Function: openMenuOptions ** Description: Get main menu options **********************************************************************/ -void getMainMenuOptions(int index){ - switch(index) { - case 0: // Wifi - wifiOptions(); - break; - case 1: // BLE - bleOptions(); - break; - case 2: // RF - rfOptions(); - break; - case 3: // RFID - rfidOptions(); - break; - case 4: // IR - irOptions(); - break; - case 5: // FM Radio - FMOptions(); - break; - case 6: // Other - otherOptions(); - break; - case 7: // Clock - runClockLoop(); - break; - case 8: // Config - configOptions(); - break; - } +void MainMenu::openMenuOptions(){ + _menuItems[_currentIndex]->optionsMenu(); } /*************************************************************************************** -** Function name: drawMainMenu +** Function name: draw ** Description: Função para desenhar e mostrar o menu principal ***************************************************************************************/ -void drawMainMenu(int index) { - const char* texts[9] = { "WiFi", "BLE", "RF", "RFID", "IR", "FM", "Others", "Clock", "Config" }; +void MainMenu::draw() { + MenuItemInterface* current_menu = _menuItems[_currentIndex]; - drawMainBorder(false); - // Fix draw main menu icon remaining lines for those smaller than others - tft.fillRect(40, 40, WIDTH-70, HEIGHT-70, BGCOLOR); - tft.setTextSize(FG); + drawMainBorder(false); + // Fix draw main menu icon remaining lines for those smaller than others + tft.fillRect(40, 40, WIDTH-70, HEIGHT-70, BGCOLOR); + tft.setTextSize(FG); - switch(index) { - case 0: - drawWifi(WIDTH/2-40,27+(HEIGHT-134)/2); - break; - case 1: - drawBLE(WIDTH/2-40,27+(HEIGHT-134)/2); - break; - case 2: - drawRf(WIDTH/2-40,27+(HEIGHT-134)/2); - break; - case 3: - drawRfid(WIDTH/2-40,27+(HEIGHT-134)/2); - break; - case 4: - drawIR(WIDTH/2-40,27+(HEIGHT-134)/2); - break; - case 5: - drawFM(WIDTH/2-40,27+(HEIGHT-134)/2); - break; - case 6: - drawOther(WIDTH/2-40,27+(HEIGHT-134)/2); - break; - case 7: - drawClock(WIDTH/2-40,27+(HEIGHT-134)/2); - break; - case 8: - drawCfg(WIDTH/2-40,27+(HEIGHT-134)/2); - break; - } + current_menu->draw(); - tft.setTextSize(FM); - tft.fillRect(10,30+80+(HEIGHT-134)/2, WIDTH-20,LH*FM, BGCOLOR); - tft.drawCentreString(texts[index],WIDTH/2, 30+80+(HEIGHT-134)/2, 1); - tft.setTextSize(FG); - tft.drawChar('<',10,HEIGHT/2+10); - tft.drawChar('>',WIDTH-(LW*FG+10),HEIGHT/2+10); + tft.setTextSize(FM); + tft.fillRect(10,30+80+(HEIGHT-134)/2, WIDTH-20,LH*FM, BGCOLOR); + tft.drawCentreString(current_menu->getName(), WIDTH/2, 30+80+(HEIGHT-134)/2, 1); + tft.setTextSize(FG); + tft.drawChar('<',10,HEIGHT/2+10); + tft.drawChar('>',WIDTH-(LW*FG+10),HEIGHT/2+10); - #if defined(HAS_TOUCH) - TouchFooter(); - #endif + #if defined(HAS_TOUCH) + TouchFooter(); + #endif } diff --git a/src/core/main_menu.h b/src/core/main_menu.h index 7940b986..7f8a09a8 100644 --- a/src/core/main_menu.h +++ b/src/core/main_menu.h @@ -1,15 +1,45 @@ -void wifiOptions(); -void bleOptions(); -void rfOptions(); -void rfConfigOptions(); -void rfidOptions(); -void rfidConfigOptions(); -void irOptions(); -void irConfigOptions(); -void FMOptions(); -void otherOptions(); -void configOptions(); -void devModeOptions(); - -void getMainMenuOptions(int index = 0); -void drawMainMenu(int index = 0); +#ifndef __MAIN_MENU_H__ +#define __MAIN_MENU_H__ + +#include "menu_items/MenuItemInterface.h" + +#include "menu_items/BleMenu.h" +#include "menu_items/ClockMenu.h" +#include "menu_items/ConfigMenu.h" +#include "menu_items/FMMenu.h" +#include "menu_items/IRMenu.h" +#include "menu_items/OthersMenu.h" +#include "menu_items/RFIDMenu.h" +#include "menu_items/RFMenu.h" +#include "menu_items/WifiMenu.h" + + +class MainMenu { +public: + BleMenu bleMenu; + ClockMenu clockMenu; + ConfigMenu configMenu; + FMMenu fmMenu; + IRMenu irMenu; + OthersMenu othersMenu; + RFIDMenu rfidMenu; + RFMenu rfMenu; + WifiMenu wifiMenu; + + MainMenu(); + ~MainMenu(); + + void begin(void) { _currentIndex = 0; }; + void previous(void); + void next(void); + + void openMenuOptions(void); + void draw(void); + +private: + int _currentIndex = 0; + int _totalItems = 0; + std::vector _menuItems; +}; + +#endif diff --git a/src/core/menu_items/BleMenu.cpp b/src/core/menu_items/BleMenu.cpp new file mode 100644 index 00000000..7062fe1d --- /dev/null +++ b/src/core/menu_items/BleMenu.cpp @@ -0,0 +1,43 @@ +#include "BleMenu.h" +#include "core/display.h" +#include "modules/ble/ble_spam.h" +#include "modules/ble/ble_common.h" +#include "modules/ble/ble_jammer.h" + +void BleMenu::optionsMenu() { + options = { + #if !defined(LITE_VERSION) + {"BLE Beacon", [=]() { ble_test(); }}, + {"BLE Scan", [=]() { ble_scan(); }}, + #endif + #if defined(USE_NRF24_VIA_SPI) + {"NRF24 Jammer", [=]() { ble_jammer(); }}, + #endif + {"iOS Spam", [=]() { aj_adv(0); }}, + {"Windows Spam", [=]() { aj_adv(1); }}, + {"Samsung Spam", [=]() { aj_adv(2); }}, + {"Android Spam", [=]() { aj_adv(3); }}, + {"Spam All", [=]() { aj_adv(4); }}, + {"Main Menu", [=]() { backToMenu(); }}, + }; + delay(200); + loopOptions(options,false,true,"Bluetooth"); +} + +String BleMenu::getName() { + return _name; +} + +void BleMenu::draw() { + tft.fillRect(iconX,iconY,80,80,BGCOLOR); + tft.drawWideLine(40+iconX,53+iconY,5+iconX,26+iconY,5,FGCOLOR,BGCOLOR); + tft.drawWideLine(40+iconX,26+iconY,5+iconX,53+iconY,5,FGCOLOR,BGCOLOR); + tft.drawWideLine(40+iconX,53+iconY,20+iconX,68+iconY,5,FGCOLOR,BGCOLOR); + tft.drawWideLine(40+iconX,26+iconY,20+iconX,12+iconY,5,FGCOLOR,BGCOLOR); + tft.drawWideLine(20+iconX,12+iconY,20+iconX,68+iconY,5,FGCOLOR,BGCOLOR); + tft.fillTriangle(40+iconX,26+iconY,20+iconX,40+iconY,20+iconX,12+iconY,FGCOLOR); + tft.fillTriangle(40+iconX,53+iconY,20+iconX,40+iconY,20+iconX,68+iconY,FGCOLOR); + tft.drawArc(40+iconX,40+iconY,10,12,210,330,FGCOLOR,BGCOLOR); + tft.drawArc(40+iconX,40+iconY,23,25,210,330,FGCOLOR,BGCOLOR); + tft.drawArc(40+iconX,40+iconY,36,38,210,330,FGCOLOR,BGCOLOR); +} \ No newline at end of file diff --git a/src/core/menu_items/BleMenu.h b/src/core/menu_items/BleMenu.h new file mode 100644 index 00000000..93d1678c --- /dev/null +++ b/src/core/menu_items/BleMenu.h @@ -0,0 +1,17 @@ +#ifndef __BLE_MENU_H__ +#define __BLE_MENU_H__ + +#include "MenuItemInterface.h" + + +class BleMenu : public MenuItemInterface { +public: + void optionsMenu(void); + void draw(void); + String getName(void); + +private: + String _name = "BLE"; +}; + +#endif diff --git a/src/core/menu_items/ClockMenu.cpp b/src/core/menu_items/ClockMenu.cpp new file mode 100644 index 00000000..b22f0ead --- /dev/null +++ b/src/core/menu_items/ClockMenu.cpp @@ -0,0 +1,28 @@ +#include "ClockMenu.h" +#include "core/display.h" +#include "core/settings.h" + +void ClockMenu::optionsMenu() { + runClockLoop(); +} + +String ClockMenu::getName() { + return _name; +} + +void ClockMenu::draw() { + // Blank + tft.fillRect(iconX,iconY,80,80,BGCOLOR); + + // Case + tft.drawCircle(40+iconX,40+iconY,30,FGCOLOR); + tft.drawCircle(40+iconX,40+iconY,31,FGCOLOR); + tft.drawCircle(40+iconX,40+iconY,32,FGCOLOR); + + // Pivot center + tft.fillCircle(40+iconX,40+iconY,3,FGCOLOR); + + // Hours & minutes + tft.drawLine(40+iconX,40+iconY,40+iconX-10,40+iconY-10,FGCOLOR); + tft.drawLine(40+iconX,40+iconY,40+iconX+16,40+iconY-16,FGCOLOR); +} \ No newline at end of file diff --git a/src/core/menu_items/ClockMenu.h b/src/core/menu_items/ClockMenu.h new file mode 100644 index 00000000..00d55f93 --- /dev/null +++ b/src/core/menu_items/ClockMenu.h @@ -0,0 +1,17 @@ +#ifndef __CLOCK_MENU_H__ +#define __CLOCK_MENU_H__ + +#include "MenuItemInterface.h" + + +class ClockMenu : public MenuItemInterface { +public: + void optionsMenu(void); + void draw(void); + String getName(void); + +private: + String _name = "Clock"; +}; + +#endif diff --git a/src/core/menu_items/ConfigMenu.cpp b/src/core/menu_items/ConfigMenu.cpp new file mode 100644 index 00000000..7060d1b7 --- /dev/null +++ b/src/core/menu_items/ConfigMenu.cpp @@ -0,0 +1,45 @@ +#include "ConfigMenu.h" +#include "core/display.h" +#include "core/settings.h" +#include "core/i2c_finder.h" + +void ConfigMenu::optionsMenu() { + options = { + {"Brightness", [=]() { setBrightnessMenu(); saveConfigs();}}, + {"Dim Time", [=]() { setDimmerTimeMenu(); saveConfigs();}}, + {"Orientation", [=]() { gsetRotation(true); saveConfigs();}}, + {"UI Color", [=]() { setUIColor(); saveConfigs();}}, + {"Clock", [=]() { setClock(); }}, + {"Sleep", [=]() { setSleepMode(); }}, + {"Restart", [=]() { ESP.restart(); }}, + }; + + if (devMode) options.push_back({"Dev Mode", [=]() { devMenu(); }}); + options.push_back({"Main Menu", [=]() { backToMenu(); }}); + + delay(200); + loopOptions(options,false,true,"Config"); +} + +void ConfigMenu::devMenu(){ + options = { + {"I2C Finder", [=]() { find_i2c_addresses(); }}, + {"Back", [=]() { optionsMenu(); }}, + }; + + delay(200); + loopOptions(options,false,true,"Dev Mode"); +} + +String ConfigMenu::getName() { + return _name; +} + +void ConfigMenu::draw() { + tft.fillRect(iconX,iconY,80,80,BGCOLOR); + int i=0; + for(i=0;i<6;i++) { + tft.drawArc(40+iconX,40+iconY,30,20,15+60*i,45+60*i,FGCOLOR,BGCOLOR,true); + } + tft.drawArc(40+iconX,40+iconY,22,8,0,360,FGCOLOR,BGCOLOR,false); +} \ No newline at end of file diff --git a/src/core/menu_items/ConfigMenu.h b/src/core/menu_items/ConfigMenu.h new file mode 100644 index 00000000..22eaf03a --- /dev/null +++ b/src/core/menu_items/ConfigMenu.h @@ -0,0 +1,19 @@ +#ifndef __CONFIG_MENU_H__ +#define __CONFIG_MENU_H__ + +#include "MenuItemInterface.h" + + +class ConfigMenu : public MenuItemInterface { +public: + void optionsMenu(void); + void draw(void); + String getName(void); + +private: + String _name = "Config"; + + void devMenu(void); +}; + +#endif diff --git a/src/core/menu_items/FMMenu.cpp b/src/core/menu_items/FMMenu.cpp new file mode 100644 index 00000000..6a09c2ae --- /dev/null +++ b/src/core/menu_items/FMMenu.cpp @@ -0,0 +1,48 @@ +#include "FMMenu.h" +#include "core/display.h" +#include "modules/fm/fm.h" + +void FMMenu::optionsMenu() { + options = { + #if !defined(LITE_VERSION) and defined(FM_SI4713) + {"Brdcast std", [=]() { fm_live_run(false); }}, + {"Brdcast rsvd", [=]() { fm_live_run(true); }}, + {"Brdcast stop", [=]() { fm_stop(); }}, + {"FM Spectrum", [=]() { fm_spectrum(); }}, + {"Hijack TA", [=]() { fm_ta_run(); }}, + #endif + {"Main Menu", [=]() { backToMenu(); }} + }; + + delay(200); + loopOptions(options,false,true,"FM"); +} + +String FMMenu::getName() { + return _name; +} + +void FMMenu::draw() { + // Blank + tft.fillRect(iconX,iconY,80,80,BGCOLOR); + + // Case + tft.drawRoundRect(-12+iconX,16+iconY,110,55,8,FGCOLOR); + tft.drawRoundRect(-12+iconX-1,16-1+iconY,112,57,8,FGCOLOR); + tft.drawRoundRect(-12+iconX-2,16-2+iconY,114,59,8,FGCOLOR); + + // Potentiometer + tft.fillCircle(75+iconX,40+iconY,12,FGCOLOR); + + // Screen + tft.drawRect(7+iconX,27+iconY,40,20,FGCOLOR); + + // Antenna + tft.drawLine(iconX ,16+iconY,iconX+28,iconY+3,FGCOLOR); + tft.drawLine(iconX+1,16+iconY,iconX+29,iconY+3,FGCOLOR); + tft.fillCircle(iconX+28,iconY+3,2,FGCOLOR); + + // Buttons + tft.fillCircle(12+iconX,58+iconY,5,FGCOLOR); + tft.fillCircle(42+iconX,58+iconY,5,FGCOLOR); +} \ No newline at end of file diff --git a/src/core/menu_items/FMMenu.h b/src/core/menu_items/FMMenu.h new file mode 100644 index 00000000..ee1f4260 --- /dev/null +++ b/src/core/menu_items/FMMenu.h @@ -0,0 +1,19 @@ +#ifndef __FM_MENU_H__ +#define __FM_MENU_H__ + +#include "MenuItemInterface.h" + + +class FMMenu : public MenuItemInterface { +public: + void optionsMenu(void); + void draw(void); + String getName(void); + +private: + String _name = "FM"; + + void configMenu(void); +}; + +#endif diff --git a/src/core/menu_items/IRMenu.cpp b/src/core/menu_items/IRMenu.cpp new file mode 100644 index 00000000..5c0dfb18 --- /dev/null +++ b/src/core/menu_items/IRMenu.cpp @@ -0,0 +1,43 @@ +#include "IRMenu.h" +#include "core/display.h" +#include "core/settings.h" +#include "modules/ir/TV-B-Gone.h" +#include "modules/ir/ir_read.h" + +void IRMenu::optionsMenu() { + options = { + {"TV-B-Gone", [=]() { StartTvBGone(); }}, + {"Custom IR", [=]() { otherIRcodes(); }}, + {"IR Read", [=]() { IrRead(); }}, + {"Config", [=]() { configMenu(); }}, + {"Main Menu", [=]() { backToMenu(); }} + }; + + delay(200); + loopOptions(options,false,true,"Infrared"); +} + +void IRMenu::configMenu() { + options = { + {"Ir TX Pin", [=]() { gsetIrTxPin(true); saveConfigs();}}, + {"Ir RX Pin", [=]() { gsetIrRxPin(true); saveConfigs();}}, + {"Back", [=]() { optionsMenu(); }}, + }; + + delay(200); + loopOptions(options,false,true,"IR Config"); +} + +String IRMenu::getName() { + return _name; +} + +void IRMenu::draw() { + tft.fillRect(iconX,iconY,80,80,BGCOLOR); + tft.fillRoundRect(11+iconX,10+iconY,10,60,2,FGCOLOR); + tft.fillRoundRect(21+iconX,20+iconY,10,40,2,FGCOLOR); + tft.drawCircle(31+iconX,40+iconY,7,FGCOLOR); + tft.drawArc(31+iconX,40+iconY,18,15,220,320,FGCOLOR,BGCOLOR); + tft.drawArc(31+iconX,40+iconY,28,25,220,320,FGCOLOR,BGCOLOR); + tft.drawArc(31+iconX,40+iconY,38,35,220,320,FGCOLOR,BGCOLOR); +} \ No newline at end of file diff --git a/src/core/menu_items/IRMenu.h b/src/core/menu_items/IRMenu.h new file mode 100644 index 00000000..0abe36f1 --- /dev/null +++ b/src/core/menu_items/IRMenu.h @@ -0,0 +1,19 @@ +#ifndef __IR_MENU_H__ +#define __IR_MENU_H__ + +#include "MenuItemInterface.h" + + +class IRMenu : public MenuItemInterface { +public: + void optionsMenu(void); + void draw(void); + String getName(void); + +private: + String _name = "IR"; + + void configMenu(void); +}; + +#endif diff --git a/src/core/menu_items/MenuItemInterface.h b/src/core/menu_items/MenuItemInterface.h new file mode 100644 index 00000000..5868a79c --- /dev/null +++ b/src/core/menu_items/MenuItemInterface.h @@ -0,0 +1,22 @@ +#ifndef __MENU_ITEM_INTERFACE_H__ +#define __MENU_ITEM_INTERFACE_H__ + +#include "core/globals.h" + + +class MenuItemInterface { +public: + virtual ~MenuItemInterface() = default; + virtual void optionsMenu(void) = 0; + virtual void draw(void) = 0; + virtual String getName(void) = 0; + +private: + String _name = ""; + +protected: + int iconX = WIDTH/2 - 40; + int iconY = 27 + (HEIGHT-134)/2; +}; + +#endif diff --git a/src/core/menu_items/OthersMenu.cpp b/src/core/menu_items/OthersMenu.cpp new file mode 100644 index 00000000..dfbbde43 --- /dev/null +++ b/src/core/menu_items/OthersMenu.cpp @@ -0,0 +1,62 @@ +#include "OthersMenu.h" +#include "core/display.h" +#include "core/sd_functions.h" +#include "modules/others/openhaystack.h" +#include "modules/others/tururururu.h" +#include "modules/others/webInterface.h" +#include "modules/others/qrcode_menu.h" +#include "modules/others/mic.h" +#include "modules/bjs_interpreter/interpreter.h" + +#ifdef USB_as_HID +#include "modules/others/bad_usb.h" +#endif +#ifdef HAS_RGB_LED +#include "modules/others/led_control.h" +#endif + +void OthersMenu::optionsMenu() { + options = { + {"SD Card", [=]() { loopSD(SD); }}, + {"LittleFS", [=]() { loopSD(LittleFS); }}, + {"WebUI", [=]() { loopOptionsWebUi(); }}, + {"QRCodes", [=]() { qrcode_menu(); }}, + {"Megalodon", [=]() { shark_setup(); }}, + #ifdef MIC_SPM1423 + {"Mic Spectrum", [=]() { mic_test(); }}, + #endif + #ifdef USB_as_HID + {"BadUSB", [=]() { usb_setup(); }}, + #if defined(CARDPUTER) + {"USB Keyboard", [=]() { usb_keyboard(); }}, + #endif + #endif + #ifdef HAS_RGB_LED + {"LED Control", [=]() { ledrgb_setup(); }}, //IncursioHack + {"LED FLash", [=]() { ledrgb_flash(); }}, // IncursioHack + #endif + #ifndef LITE_VERSION + {"Openhaystack", [=]() { openhaystack_setup(); }}, + #endif + #if !defined(CORE) && !defined(CORE2) + {"Interpreter", [=]() { run_bjs_script(); }}, + #endif + {"Main Menu", [=]() { backToMenu(); }}, + }; + + delay(200); + loopOptions(options,false,true,"Others"); +} + +String OthersMenu::getName() { + return _name; +} + +void OthersMenu::draw() { + tft.fillRect(iconX,iconY,80,80,BGCOLOR); + tft.fillCircle(40+iconX,40+iconY,7,FGCOLOR); + tft.drawArc(40+iconX,40+iconY,18,15,0,340,FGCOLOR,BGCOLOR); + tft.drawArc(40+iconX,40+iconY,25,22,20,360,FGCOLOR,BGCOLOR); + tft.drawArc(40+iconX,40+iconY,32,29,0,200,FGCOLOR,BGCOLOR); + tft.drawArc(40+iconX,40+iconY,32,29,240,360,FGCOLOR,BGCOLOR); +} \ No newline at end of file diff --git a/src/core/menu_items/OthersMenu.h b/src/core/menu_items/OthersMenu.h new file mode 100644 index 00000000..a08cd8a9 --- /dev/null +++ b/src/core/menu_items/OthersMenu.h @@ -0,0 +1,17 @@ +#ifndef __OTHERS_MENU_H__ +#define __OTHERS_MENU_H__ + +#include "MenuItemInterface.h" + + +class OthersMenu : public MenuItemInterface { +public: + void optionsMenu(void); + void draw(void); + String getName(void); + +private: + String _name = "Others"; +}; + +#endif diff --git a/src/core/menu_items/RFIDMenu.cpp b/src/core/menu_items/RFIDMenu.cpp new file mode 100644 index 00000000..aa6db29e --- /dev/null +++ b/src/core/menu_items/RFIDMenu.cpp @@ -0,0 +1,44 @@ +#include "RFIDMenu.h" +#include "core/display.h" +#include "core/settings.h" +#include "modules/rfid/tag_o_matic.h" +#include "modules/rfid/rfid125.h" + +void RFIDMenu::optionsMenu() { + options = { + {"Read tag", [=]() { TagOMatic(); }}, + {"Read 125kHz", [=]() { RFID125(); }}, + {"Load file", [=]() { TagOMatic(TagOMatic::LOAD_MODE); }}, + {"Erase data", [=]() { TagOMatic(TagOMatic::ERASE_MODE); }}, + {"Write NDEF", [=]() { TagOMatic(TagOMatic::WRITE_NDEF_MODE); }}, + {"Config", [=]() { configMenu(); }}, + {"Main Menu", [=]() { backToMenu(); }}, + }; + + delay(200); + loopOptions(options,false,true,"RFID"); +} + +void RFIDMenu::configMenu() { + options = { + {"RFID Module", [=]() { setRFIDModuleMenu(); saveConfigs();}}, + {"Back", [=]() { optionsMenu(); }}, + }; + + delay(200); + loopOptions(options,false,true,"RFID Config"); +} + +String RFIDMenu::getName() { + return _name; +} + +void RFIDMenu::draw() { + tft.fillRect(iconX,iconY,80,80,BGCOLOR); + tft.drawRoundRect(5+iconX,5+iconY,70,70,10,FGCOLOR); + tft.fillRect(0+iconX,40+iconY,40,40,BGCOLOR); + tft.drawCircle(15+iconX,65+iconY,7,FGCOLOR); + tft.drawArc(15+iconX,65+iconY,18,15,180,270,FGCOLOR,BGCOLOR); + tft.drawArc(15+iconX,65+iconY,28,25,180,270,FGCOLOR,BGCOLOR); + tft.drawArc(15+iconX,65+iconY,38,35,180,270,FGCOLOR,BGCOLOR); +} \ No newline at end of file diff --git a/src/core/menu_items/RFIDMenu.h b/src/core/menu_items/RFIDMenu.h new file mode 100644 index 00000000..679b9f22 --- /dev/null +++ b/src/core/menu_items/RFIDMenu.h @@ -0,0 +1,19 @@ +#ifndef __RFID_MENU_H__ +#define __RFID_MENU_H__ + +#include "MenuItemInterface.h" + + +class RFIDMenu : public MenuItemInterface { +public: + void optionsMenu(void); + void draw(void); + String getName(void); + +private: + String _name = "RFID"; + + void configMenu(void); +}; + +#endif diff --git a/src/core/menu_items/RFMenu.cpp b/src/core/menu_items/RFMenu.cpp new file mode 100644 index 00000000..0cf141bb --- /dev/null +++ b/src/core/menu_items/RFMenu.cpp @@ -0,0 +1,48 @@ +#include "RFMenu.h" +#include "core/display.h" +#include "core/settings.h" +#include "modules/rf/rf.h" + +void RFMenu::optionsMenu() { + options = { + {"Scan/copy", [=]() { RCSwitch_Read_Raw(); }}, + {"Custom SubGhz", [=]() { otherRFcodes(); }}, + {"Spectrum", [=]() { rf_spectrum(); }}, //@IncursioHack + {"Jammer Itmt", [=]() { rf_jammerIntermittent(); }}, //@IncursioHack + {"Jammer Full", [=]() { rf_jammerFull(); }}, //@IncursioHack + {"Config", [=]() { configMenu(); }}, + {"Main Menu", [=]() { backToMenu(); }}, + }; + + delay(200); + loopOptions(options,false,true,"Radio Frequency"); +} + +void RFMenu::configMenu() { + options = { + {"RF TX Pin", [=]() { gsetRfTxPin(true); saveConfigs();}}, + {"RF RX Pin", [=]() { gsetRfRxPin(true); saveConfigs();}}, + {"RF Module", [=]() { setRFModuleMenu(); saveConfigs();}}, + {"RF Frequency", [=]() { setRFFreqMenu(); saveConfigs();}}, + {"Back", [=]() { optionsMenu(); }}, + }; + + delay(200); + loopOptions(options,false,true,"RF Config"); +} + +String RFMenu::getName() { + return _name; +} + +void RFMenu::draw() { + tft.fillRect(iconX,iconY,80,80,BGCOLOR); + tft.fillCircle(40+iconX,30+iconY,7,FGCOLOR); + tft.fillTriangle(40+iconX,40+iconY,25+iconX,70+iconY,55+iconX,70+iconY,FGCOLOR); + tft.drawArc(40+iconX,30+iconY,18,15,40,140,FGCOLOR,BGCOLOR); + tft.drawArc(40+iconX,30+iconY,28,25,40,140,FGCOLOR,BGCOLOR); + tft.drawArc(40+iconX,30+iconY,38,35,40,140,FGCOLOR,BGCOLOR); + tft.drawArc(40+iconX,30+iconY,18,15,220,320,FGCOLOR,BGCOLOR); + tft.drawArc(40+iconX,30+iconY,28,25,220,320,FGCOLOR,BGCOLOR); + tft.drawArc(40+iconX,30+iconY,38,35,220,320,FGCOLOR,BGCOLOR); +} \ No newline at end of file diff --git a/src/core/menu_items/RFMenu.h b/src/core/menu_items/RFMenu.h new file mode 100644 index 00000000..aee69044 --- /dev/null +++ b/src/core/menu_items/RFMenu.h @@ -0,0 +1,19 @@ +#ifndef __RF_MENU_H__ +#define __RF_MENU_H__ + +#include "MenuItemInterface.h" + + +class RFMenu : public MenuItemInterface { +public: + void optionsMenu(void); + void draw(void); + String getName(void); + +private: + String _name = "RF"; + + void configMenu(void); +}; + +#endif diff --git a/src/core/menu_items/WifiMenu.cpp b/src/core/menu_items/WifiMenu.cpp new file mode 100644 index 00000000..671c5b18 --- /dev/null +++ b/src/core/menu_items/WifiMenu.cpp @@ -0,0 +1,56 @@ +#include "WifiMenu.h" +#include "core/display.h" +#include "core/wifi_common.h" +#include "core/wg.h" +#include "modules/wifi/clients.h" +#include "modules/wifi/dpwo.h" +#include "modules/wifi/evil_portal.h" +#include "modules/wifi/scan_hosts.h" +#include "modules/wifi/sniffer.h" +#include "modules/wifi/wardriving.h" +#include "modules/wifi/wifi_atks.h" +#include "modules/ble/ble_jammer.h" + +void WifiMenu::optionsMenu() { + if(!wifiConnected) { + options = { + {"Connect Wifi", [=]() { wifiConnectMenu(); }}, //wifi_common.h + {"WiFi AP", [=]() { wifiConnectMenu(true); }},//wifi_common.h + }; + } else { + options = { + {"Disconnect", [=]() { wifiDisconnect(); }}, //wifi_common.h + }; + } + options.push_back({"Wifi Atks", [=]() { wifi_atk_menu(); }}); + options.push_back({"Wardriving", [=]() { Wardriving(); }}); +#ifndef LITE_VERSION + options.push_back({"TelNET", [=]() { telnet_setup(); }}); + options.push_back({"SSH", [=]() { ssh_setup(); }}); + options.push_back({"DPWO", [=]() { dpwo_setup(); }}); +#endif + options.push_back({"Raw Sniffer", [=]() { sniffer_setup(); }}); + options.push_back({"Evil Portal", [=]() { startEvilPortal(); }}); + options.push_back({"Scan Hosts", [=]() { local_scan_setup(); }}); +#ifndef LITE_VERSION + options.push_back({"Wireguard", [=]() { wg_setup(); }}); +#endif +#if defined(USE_NRF24_VIA_SPI) + options.push_back({"NRF24 Jammer", [=]() { ble_jammer(); }}); +#endif + options.push_back({"Main Menu", [=]() { backToMenu(); }}); + + delay(200); + loopOptions(options,false,true,"WiFi"); +} + +String WifiMenu::getName() { + return _name; +} + +void WifiMenu::draw() { + tft.fillRect(iconX,iconY,80,80,BGCOLOR); + tft.fillCircle(40+iconX,60+iconY,6,FGCOLOR); + tft.drawArc(40+iconX,60+iconY,26,20,130,230,FGCOLOR, BGCOLOR); + tft.drawArc(40+iconX,60+iconY,46,40,130,230,FGCOLOR, BGCOLOR); +} \ No newline at end of file diff --git a/src/core/menu_items/WifiMenu.h b/src/core/menu_items/WifiMenu.h new file mode 100644 index 00000000..ca9b63ae --- /dev/null +++ b/src/core/menu_items/WifiMenu.h @@ -0,0 +1,17 @@ +#ifndef __WIFI_MENU_H__ +#define __WIFI_MENU_H__ + +#include "MenuItemInterface.h" + + +class WifiMenu : public MenuItemInterface { +public: + void optionsMenu(void); + void draw(void); + String getName(void); + +private: + String _name = "WiFi"; +}; + +#endif diff --git a/src/core/sd_functions.cpp b/src/core/sd_functions.cpp index 8ff7c91c..6aa41bd5 100644 --- a/src/core/sd_functions.cpp +++ b/src/core/sd_functions.cpp @@ -307,7 +307,7 @@ String readSmallFile(FS &fs, String filepath) { Serial.println("File is too big"); return ""; } - + fileContent = file.readString(); file.close(); @@ -321,8 +321,8 @@ String readSmallFile(FS &fs, String filepath) { size_t getFileSize(FS &fs, String filepath) { /* #if !defined(M5STACK) - if(&fs == &SD) filepath = "/sd" + filepath; - else if(&fs == &LittleFS) filepath = "/littlefs" + filepath; + if(&fs == &SD) filepath = "/sd" + filepath; + else if(&fs == &LittleFS) filepath = "/littlefs" + filepath; else return 0; // not found struct stat st; memset(&st, 0, sizeof(struct stat)); @@ -358,13 +358,13 @@ String readDecryptedAesFile(FS &fs, String filepath) { displayError("File is too big"); return ""; } - + char buffer[fileSize]; size_t bytesRead = file.readBytes(buffer, fileSize); //Serial.print("fileSize:"); //Serial.println(fileSize); //Serial.println(bytesRead); - + /* // read the whole file with a single call char buffer[fileSize + 1]; @@ -372,21 +372,21 @@ String readDecryptedAesFile(FS &fs, String filepath) { buffer[bytesRead] = '\0'; // Null-terminate the string return String(buffer); */ - + if (bytesRead==0) { Serial.println("empty cypherText"); return ""; } // else - + if(cachedPassword.length()==0) { cachedPassword = keyboard("", 32, "password"); if(cachedPassword.length()==0) return ""; // cancelled } - + // else try to decrypt String plaintext = aes_decrypt((uint8_t*)buffer, bytesRead, cachedPassword); - + // check if really plaintext if(!is_valid_ascii(plaintext)) { // invalidate cached password -> will ask again on the next try @@ -644,23 +644,23 @@ String loopSD(FS &fs, bool filePicker, String allowed_ext) { if(&fs == &LittleFS && sdcardMounted) options.push_back({"Copy->SD", [=]() { copyToFs(LittleFS, SD, filepath); }}); // custom file formats commands added in front - if(filepath.endsWith(".ir")) options.insert(options.begin(), {"IR Tx SpamAll", [&]() { + if(filepath.endsWith(".ir")) options.insert(options.begin(), {"IR Tx SpamAll", [&]() { delay(200); txIrFile(&fs, filepath); }}); - if(filepath.endsWith(".sub")) options.insert(options.begin(), {"Subghz Tx", [&]() { + if(filepath.endsWith(".sub")) options.insert(options.begin(), {"Subghz Tx", [&]() { delay(200); txSubFile(&fs, filepath); }}); #if defined(USB_as_HID) if(filepath.endsWith(".txt")) { - options.push_back({"BadUSB Run", [&]() { - Kb.begin(); USB.begin(); + options.push_back({"BadUSB Run", [&]() { + Kb.begin(); USB.begin(); // TODO: set default keyboard layout key_input(fs, filepath); }}); /* - options.push_back({"USB HID Type", [&]() { + options.push_back({"USB HID Type", [&]() { Kb.begin(); USB.begin(); Kb.print(readSmallFile(fs, filepath).c_str()); // buggy? //String t = readSmallFile(fs, filepath).c_str(); @@ -670,7 +670,7 @@ String loopSD(FS &fs, bool filePicker, String allowed_ext) { #endif /* WIP if(filepath.endsWith(".aes") || filepath.endsWith(".enc")) { // aes encrypted files - options.insert(options.begin(), {"Decrypt+Type", [&]() { + options.insert(options.begin(), {"Decrypt+Type", [&]() { String plaintext = readDecryptedAesFile(fs, filepath); if(plaintext.length()==0) return displayError("invalid password");; // file is too big or cannot read, or cancelled // else @@ -690,7 +690,7 @@ String loopSD(FS &fs, bool filePicker, String allowed_ext) { }}); }*/ #if defined(HAS_NS4168_SPKR) - if(isAudioFile(filepath)) options.insert(options.begin(), {"Play Audio", [&]() { + if(isAudioFile(filepath)) options.insert(options.begin(), {"Play Audio", [&]() { delay(200); playAudioFile(&fs, filepath); setup_gpio(); //TODO: remove after fix select loop @@ -699,7 +699,7 @@ String loopSD(FS &fs, bool filePicker, String allowed_ext) { // generate qr codes from small files (<3K) size_t filesize = getFileSize(fs, filepath); //Serial.println(filesize); - if(filesize < 3*1024 && filesize>0) options.push_back({"QR code", [&]() { + if(filesize < 3*1024 && filesize>0) options.push_back({"QR code", [&]() { delay(200); qrcode_display(readSmallFile(fs, filepath)); }}); @@ -751,7 +751,7 @@ String loopSD(FS &fs, bool filePicker, String allowed_ext) { // else look again from the start for(int i=0; i= 4096; +} + +/********************************************************************* +** Function: getFsStorage +** Function will return true and FS will point to SDFS if available +** and LittleFS otherwise. If LittleFS is full it wil return false. +**********************************************************************/ +bool getFsStorage(FS *&fs) { + if(setupSdCard()) fs=&SD; + else if(checkLittleFsSize()) fs=&LittleFS; + else return false; + + return true; } diff --git a/src/core/sd_functions.h b/src/core/sd_functions.h index d8f22b7f..716b26fd 100644 --- a/src/core/sd_functions.h +++ b/src/core/sd_functions.h @@ -44,3 +44,5 @@ int createFilePages(String fileContent); bool checkLittleFsSize(); bool checkLittleFsSizeNM(); //Don't display msg + +bool getFsStorage(FS *&fs); diff --git a/src/main.cpp b/src/main.cpp index b87984d1..a40549b9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,4 +1,5 @@ #include "core/globals.h" +#include "core/main_menu.h" #include #include @@ -9,6 +10,7 @@ +MainMenu mainMenu; SPIClass sdcardSPI; #if defined(STICK_C_PLUS) || defined(STICK_C_PLUS2) SPIClass CC_NRF_SPI; @@ -85,7 +87,6 @@ uint8_t buff[4096] = {0}; #include "core/mykeyboard.h" #include "core/sd_functions.h" #include "core/settings.h" -#include "core/main_menu.h" #include "core/serialcmds.h" #include "modules/others/audio.h" // for playAudioFile #include "modules/rf/rf.h" // for initCC1101once @@ -142,7 +143,7 @@ void begin_tft(){ M5.begin(); #elif defined(M5STACK) M5.begin(); - + #endif rotation = gsetRotation(); tft.setRotation(rotation); @@ -352,8 +353,7 @@ void loop() { #endif bool redraw = true; long clock_update=0; - int index = 0; - int opt = 9; + mainMenu.begin(); // Interpreter must be ran in the loop() function, otherwise it breaks // called by 'stack canary watchpoint triggered (loopTask)' @@ -378,7 +378,7 @@ void loop() { } if (redraw) { - drawMainMenu(index); + mainMenu.draw(); clock_update=0; // forces clock drawing redraw = false; delay(200); @@ -391,20 +391,18 @@ void loop() { if (checkPrevPress()) { checkReboot(); - if(index==0) index = opt - 1; - else if(index>0) index--; + mainMenu.previous(); redraw = true; } /* DW Btn to next item */ if (checkNextPress()) { - index++; - if((index+1)>opt) index = 0; + mainMenu.next(); redraw = true; } /* Select and run function */ if (checkSelPress()) { - getMainMenuOptions(index); + mainMenu.openMenuOptions(); drawMainBorder(true); redraw=true; } diff --git a/src/modules/others/bad_usb.cpp b/src/modules/others/bad_usb.cpp index 477b485f..f8e6792c 100644 --- a/src/modules/others/bad_usb.cpp +++ b/src/modules/others/bad_usb.cpp @@ -238,7 +238,7 @@ void usb_setup() { bad_script = loopSD(*fs,true); tft.fillScreen(BGCOLOR); - drawMainMenu(4); + // drawMainMenu(4); options = { {"US Inter", [=]() { chooseKb(KeyboardLayout_en_US); }}, @@ -247,7 +247,7 @@ void usb_setup() { {"AZERTY FR", [=]() { chooseKb(KeyboardLayout_fr_FR); }}, {"es-Espanol", [=]() { chooseKb(KeyboardLayout_es_ES); }}, {"it-Italiano", [=]() { chooseKb(KeyboardLayout_it_IT); }}, - {"en-UK", [=]() { chooseKb(KeyboardLayout_en_UK); }}, + {"en-UK", [=]() { chooseKb(KeyboardLayout_en_UK); }}, {"de-DE", [=]() { chooseKb(KeyboardLayout_de_DE); }}, {"sv-SE", [=]() { chooseKb(KeyboardLayout_sv_SE); }}, {"da-DK", [=]() { chooseKb(KeyboardLayout_da_DK); }}, @@ -292,7 +292,7 @@ void usb_keyboard() { {"AZERTY FR", [=]() { chooseKb(KeyboardLayout_fr_FR); }}, {"es-Espanol", [=]() { chooseKb(KeyboardLayout_es_ES); }}, {"it-Italiano", [=]() { chooseKb(KeyboardLayout_it_IT); }}, - {"en-UK", [=]() { chooseKb(KeyboardLayout_en_UK); }}, + {"en-UK", [=]() { chooseKb(KeyboardLayout_en_UK); }}, {"de-DE", [=]() { chooseKb(KeyboardLayout_de_DE); }}, {"sv-SE", [=]() { chooseKb(KeyboardLayout_sv_SE); }}, {"da-DK", [=]() { chooseKb(KeyboardLayout_da_DK); }}, diff --git a/src/modules/rfid/PN532.cpp b/src/modules/rfid/PN532.cpp index 22941430..9405e94b 100644 --- a/src/modules/rfid/PN532.cpp +++ b/src/modules/rfid/PN532.cpp @@ -69,8 +69,7 @@ int PN532::load() { File file; FS *fs; - if(setupSdCard()) fs=&SD; - else fs=&LittleFS; + if(!getFsStorage(fs)) return FAILURE; filepath = loopSD(*fs, true, "RFID|NFC"); file = fs->open(filepath, FILE_READ); @@ -105,13 +104,7 @@ int PN532::load() { int PN532::save(String filename) { FS *fs; - if(setupSdCard()) fs=&SD; - else { - if(!checkLittleFsSize()) fs=&LittleFS; - else { - return FAILURE; - } - } + if(!getFsStorage(fs)) return FAILURE; if (!(*fs).exists("/BruceRFID")) (*fs).mkdir("/BruceRFID"); if ((*fs).exists("/BruceRFID/" + filename + ".rfid")) { diff --git a/src/modules/rfid/RFID2.cpp b/src/modules/rfid/RFID2.cpp index 22c37c56..48295362 100644 --- a/src/modules/rfid/RFID2.cpp +++ b/src/modules/rfid/RFID2.cpp @@ -105,8 +105,7 @@ int RFID2::load() { File file; FS *fs; - if(setupSdCard()) fs=&SD; - else fs=&LittleFS; + if(!getFsStorage(fs)) return FAILURE; filepath = loopSD(*fs, true, "RFID|NFC"); file = fs->open(filepath, FILE_READ); @@ -141,13 +140,7 @@ int RFID2::load() { int RFID2::save(String filename) { FS *fs; - if(setupSdCard()) fs=&SD; - else { - if(!checkLittleFsSize()) fs=&LittleFS; - else { - return FAILURE; - } - } + if(!getFsStorage(fs)) return FAILURE; if (!(*fs).exists("/BruceRFID")) (*fs).mkdir("/BruceRFID"); if ((*fs).exists("/BruceRFID/" + filename + ".rfid")) { diff --git a/src/modules/rfid/rfid125.cpp b/src/modules/rfid/rfid125.cpp index 4b98d739..a536aad0 100644 --- a/src/modules/rfid/rfid125.cpp +++ b/src/modules/rfid/rfid125.cpp @@ -247,9 +247,7 @@ void RFID125::save_file() { bool RFID125::write_file(String filename) { FS *fs; - if(setupSdCard()) fs=&SD; - else if(!checkLittleFsSize()) fs=&LittleFS; - else return false; + if(!getFsStorage(fs)) return false; if (!(*fs).exists("/BruceRFID")) (*fs).mkdir("/BruceRFID"); if ((*fs).exists("/BruceRFID/" + filename + ".lfrfid")) { diff --git a/src/modules/wifi/wardriving.cpp b/src/modules/wifi/wardriving.cpp index ccb9c504..d4f233b7 100644 --- a/src/modules/wifi/wardriving.cpp +++ b/src/modules/wifi/wardriving.cpp @@ -1,110 +1,147 @@ -#include -#include "core/globals.h" +/** + * @file wardriving.cpp + * @author IncursioHack - https://github.com/IncursioHack + * @brief WiFi Wardriving + * @version 0.2 + * @note Updated: 2024-08-28 by Rennan Cockles (https://github.com/rennancockles) + */ + + +#include "wardriving.h" #include "core/display.h" -#include "core/main_menu.h" #include "core/mykeyboard.h" #include "core/wifi_common.h" #include "core/sd_functions.h" -#include -#include -#include -#include -#include -#include "wardriving.h" -/* Made by @IncursioHack */ - -TinyGPSPlus gps; -HardwareSerial GPSserial(2); // Uses UART2 for GPS -std::set registeredMACs; // Store and track registered MAC -int wifiNetworkCount = 0; // Counter fo wifi networks - -void wardriving_logData() { - if (wifiNetworkCount==0) drawMainBorder(); - tft.setCursor(10, 30); - tft.println("WARDRIVING:"); - tft.setCursor(10, 38); - tft.println(" Wi-Fi Networks Found: " + String(wifiNetworkCount)); - // scan nearby wifi networks - int n = WiFi.scanNetworks(); - drawMainBorder(); - // check if networks were found - if (n == 0) { - tft.setCursor(10, tft.getCursorY()); - tft.println("No Wi-Fi networks found"); - } else { - // Open file for writing - File file; - bool FirstLine = false; - FS* Fs; - if(sdcardMounted) Fs = &SD; - else { - if(checkLittleFsSize()) Fs = &LittleFS; - else returnToMenu = true; +#define MAX_WAIT 5000 + + +Wardriving::Wardriving() { + setup(); +} + +Wardriving::~Wardriving() { + if (gpsConnected) end(); +} + +void Wardriving::setup() { + display_banner(); + padprintln("Initializing..."); + + begin_wifi(); + if (!begin_gps()) return; + + delay(500); + return loop(); +} + +void Wardriving::begin_wifi() { + WiFi.mode(WIFI_STA); + WiFi.disconnect(); +} + +bool Wardriving::begin_gps() { + GPSserial.begin(9600, SERIAL_8N1, GROVE_SCL, GROVE_SDA); // RX, TX + + int count = 0; + padprintln("Waiting for GPS data"); + while(GPSserial.available() <= 0) { + if(checkEscPress()) { + end(); + return false; + } + displayRedStripe("Waiting GPS: " + String(count)+ "s", TFT_WHITE, FGCOLOR); + count++; + delay(1000); } - if(!(*Fs).exists("/wardriving_bruce_log.csv")) FirstLine=true; - file = (*Fs).open("/wardriving_bruce_log.csv", FirstLine ? FILE_WRITE : FILE_APPEND); - if(FirstLine) file.println("WigleWifi-1.4,appRelease=v1.0.0,model=ESP32 M5Stack,release=v1.0.0,device=ESP32 M5Stack,display=SPI TFT,board=ESP32 M5Stack,brand=Bruce\nMAC,SSID,AuthMode,FirstSeen,Channel,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,Type"); - - if (file) { - int ListCursorStart = 49; - tft.setCursor(10, ListCursorStart); - // Store data from each WIFI found - int line=0; - for (int i = 0; i < n; i++) { - String macAddress = WiFi.BSSIDstr(i); - - // Check if MAC was already found in this session - if (registeredMACs.find(macAddress) == registeredMACs.end()) { - registeredMACs.insert(macAddress); // Adds MAC to file - - char buffer[512]; - snprintf(buffer, sizeof(buffer), "%s,%s,[%s],%02d/%02d/%02d %02d:%02d:%02d,%d,%d,%f,%f,%f,%f,WIFI\n", - macAddress.c_str(), - WiFi.SSID(i).c_str(), - wardriving_authModeToString(WiFi.encryptionType(i)).c_str(), - gps.date.month(), gps.date.day(), gps.date.year(), - gps.time.hour(), gps.time.minute(), gps.time.second(), - WiFi.channel(i), - WiFi.RSSI(i), - gps.location.lat(), - gps.location.lng(), - gps.altitude.meters(), - gps.hdop.hdop() * 1.0); - file.print(buffer); - - // Increases counter - wifiNetworkCount++; - - // Show networks info on screen - tft.setTextSize(FP); - tft.setTextColor(FGCOLOR, BGCOLOR); - if(i % 4 == 0 && i>0) { //Show 3 networks at a time, delays 500ms to see what has been found - tft.setCursor(10, ListCursorStart); - tft.fillRect(10,49,WIDTH-20,HEIGHT-59,BGCOLOR); - line=0; - delay(500); - } - tft.setCursor(10, ListCursorStart + line*8); - tft.println("WIFI:" + WiFi.SSID(i).substring(0,15) + " [" + wardriving_authModeToString(WiFi.encryptionType(i)).c_str() + "]"); - tft.setCursor(10, ListCursorStart + (line+1)*8); - tft.printf("GPS: %.4f , %.4f", gps.location.lat(), gps.location.lng()); - tft.setCursor(10, tft.getCursorY()+(18)); - line +=2; + + gpsConnected = true; + return true; +} + +void Wardriving::end() { + wifiDisconnect(); + + GPSserial.end(); + + returnToMenu = true; + gpsConnected = false; + + delay(500); +} + +void Wardriving::loop() { + int count = 0; + returnToMenu = false; + while(1) { + display_banner(); + + if (checkEscPress() || returnToMenu) return end(); + + if (GPSserial.available() > 0) { + count = 0; + while (GPSserial.available() > 0) gps.encode(GPSserial.read()); + + if (gps.location.isUpdated()) { + padprintln("GPS location updated"); + set_position(); + scan_networks(); + } else { + padprintln("GPS location not updated"); + dump_gps_data(); + } + } else { + if (count > 5) { + displayError("GPS not Found!"); + return end(); + } + padprintln("No GPS data available"); + count++; + } + + int tmp = millis(); + while(millis()-tmp < MAX_WAIT && !gps.location.isUpdated()){ + if (checkEscPress() || returnToMenu) return end(); } - } - - file.close(); -// tft.setCursor(10, tft.getCursorY()+20); -// tft.println("Recorded GPS data and Wi-Fi networks"); - } else { - tft.setCursor(10, tft.getCursorY()+20); - tft.println("Failed to open file for writing"); } - } } -String wardriving_authModeToString(wifi_auth_mode_t authMode) { +void Wardriving::set_position() { + double lat = gps.location.lat(); + double lng = gps.location.lng(); + + if (initial_position_set) distance += gps.distanceBetween(cur_lat, cur_lng, lat, lng); + else initial_position_set = true; + + cur_lat = lat; + cur_lng = lng; +} + +void Wardriving::display_banner() { + drawMainBorderWithTitle("Wardriving"); + padprintln(""); + + if (wifiNetworkCount > 0){ + padprintln("Unique Networks Found: " + String(wifiNetworkCount), 2); + padprintf(2, "Distance: %.2fkm\n", distance / 1000); + } + + padprintln(""); +} + +void Wardriving::dump_gps_data() { + if (!date_time_updated && (!gps.date.isUpdated() || !gps.time.isUpdated())) { + padprintln("Waiting for valid GPS data"); + return; + } + date_time_updated = true; + padprintf(2, "Date: %02d-%02d-%02d\n", gps.date.year(), gps.date.month(), gps.date.day()); + padprintf(2, "Time: %02d:%02d:%02d\n", gps.time.hour(), gps.time.minute(), gps.time.second()); + padprintf(2, "Sat: %d\n", gps.satellites.value()); + padprintf(2, "HDOP: %.2f\n", gps.hdop.hdop()); +} + +String Wardriving::auth_mode_to_string(wifi_auth_mode_t authMode) { switch (authMode) { case WIFI_AUTH_OPEN: return "OPEN"; case WIFI_AUTH_WEP: return "WEP"; @@ -119,106 +156,74 @@ String wardriving_authModeToString(wifi_auth_mode_t authMode) { } } -void wardriving_setup() { - // Inicialização do M5Stack - Serial.begin(115200); - drawMainBorder(); // no loop para dar refresh na borda sem piscar a tela - WiFi.mode(WIFI_STA); - WiFi.disconnect(); - tft.setTextSize(FP); - tft.setTextColor(FGCOLOR, BGCOLOR); - tft.setCursor(10, 30); - tft.setCursor(10, tft.getCursorY()); - tft.println(" Initializing..."); - - // Inicializa o serial do GPS - GPSserial.begin(9600, SERIAL_8N1, GROVE_SCL, GROVE_SDA); // RX, TX - - // Verifica o cartão SD - if (!SD.begin()) { - tft.setCursor(10, tft.getCursorY()); - tft.println(" Failed to initialize SD card"); - tft.setCursor(10, tft.getCursorY()); - tft.println(" Using LittleFS"); - } else { - tft.setCursor(10, tft.getCursorY()); - tft.println(" SD card successfully mounted"); +void Wardriving::scan_networks() { + wifiConnected = true; - } + int network_amount = WiFi.scanNetworks(); + if (network_amount == 0) { + padprintln("No Wi-Fi networks found", 2); + return; + } - // Waits until GPS is connected - tft.setCursor(10, tft.getCursorY()); - tft.println(" Waiting for GPS data"); - int count=0; - while(GPSserial.available() <= 0) { - if(checkEscPress()) goto EndGPS; - displayRedStripe("Waiting GPS: " + String(count)+ "s",TFT_WHITE, FGCOLOR); - count++; - delay(1000); - } + padprintf(2, "Coord: %.6f, %.6f\n", gps.location.lat(), gps.location.lng()); + padprintln("Networks Found: " + String(network_amount), 2); + + return append_to_file(network_amount); +} - gpsConnected=true; - drawMainBorder(); - // Loop contínuo - count=0; - while (true) { - tft.setCursor(10, 30); - tft.setTextSize(FP); - tft.setTextColor(FGCOLOR, BGCOLOR); - if (checkEscPress() || returnToMenu) { - displayRedStripe("Stopped"); - delay(2000); - returnToMenu = true; - goto EndGPS; - break; +void Wardriving::append_to_file(int network_amount) { + FS *fs; + if(!getFsStorage(fs)) { + padprintln("Storage setup error"); + returnToMenu = true; + return; } - // Depuração para verificar disponibilidade de dados no GPS - if (GPSserial.available() > 0) { - tft.setCursor(10, tft.getCursorY()); - tft.println(" GPS data available"); - while (GPSserial.available() > 0) { - gps.encode(GPSserial.read()); - } - - // Depuração para verificar se a localização do GPS foi atualizada - if (gps.location.isUpdated()) { - tft.setCursor(10, tft.getCursorY()); - tft.println(" GPS location updated"); - wifiConnected=true; - wardriving_logData(); - } else { - tft.setCursor(10, tft.getCursorY()+3); - tft.println(" GPS location not updated"); - tft.setCursor(10, tft.getCursorY()+3); - tft.printf(" Time: %02d:%02d:%02d\n", gps.time.hour(), gps.time.minute(), gps.time.second()); - tft.setCursor(10, tft.getCursorY()); - tft.printf(" Date: %02d/%02d/%02d\n", gps.date.month(), gps.date.day(), gps.date.year()); - tft.setCursor(10, tft.getCursorY()); - tft.printf(" Satellites: %d\n", gps.satellites.value()); - tft.setCursor(10, tft.getCursorY()); - tft.printf(" HDOP: %f\n", gps.hdop.hdop()); - } - } else { - if(count>5) { - displayError("GPS not Found!"); - delay(2000); - break; - } - tft.setCursor(10, tft.getCursorY()); - tft.println(" No GPS data available"); - count++; + + if (!(*fs).exists("/BruceWiFi")) (*fs).mkdir("/BruceWiFi"); + + bool is_new_file = false; + if(!(*fs).exists("/BruceWiFi/wardriving.csv")) is_new_file = true; + File file = (*fs).open("/BruceWiFi/wardriving.csv", is_new_file ? FILE_WRITE : FILE_APPEND); + + if (!file) { + padprintln("Failed to open file for writing"); + returnToMenu = true; + return; } - // Keep running to wait next GPS Iteration - int tmp = millis(); - // Checks para sair do while - while(millis()-tmp < 5000 && !gps.location.isUpdated()) { + if (is_new_file) { + file.println("WigleWifi-1.6,appRelease=v"+String(BRUCE_VERSION)+",model=M5Stack GPS Unit,release=v"+String(BRUCE_VERSION)+",device=ESP32 M5Stack,display=SPI TFT,board=ESP32 M5Stack,brand=Bruce,star=Sol,body=4,subBody=1"); + file.println("MAC,SSID,AuthMode,FirstSeen,Channel,Frequency,RSSI,CurrentLatitude,CurrentLongitude,AltitudeMeters,AccuracyMeters,RCOIs,MfgrId,Type"); + } + for (int i = 0; i < network_amount; i++) { + String macAddress = WiFi.BSSIDstr(i); + + // Check if MAC was already found in this session + if (registeredMACs.find(macAddress) == registeredMACs.end()) { + registeredMACs.insert(macAddress); // Adds MAC to file + int32_t channel = WiFi.channel(i); + + char buffer[512]; + snprintf(buffer, sizeof(buffer), "%s,%s,[%s],%04d-%02d-%02d %02d:%02d:%02d,%d,%d,%d,%f,%f,%f,%f,,,WIFI\n", + macAddress.c_str(), + WiFi.SSID(i).c_str(), + auth_mode_to_string(WiFi.encryptionType(i)).c_str(), + gps.date.year(), gps.date.month(), gps.date.day(), + gps.time.hour(), gps.time.minute(), gps.time.second(), + channel, + channel != 14 ? 2407 + (channel * 5) : 2484, + WiFi.RSSI(i), + gps.location.lat(), + gps.location.lng(), + gps.altitude.meters(), + gps.hdop.hdop() * 1.0 + ); + file.print(buffer); + + wifiNetworkCount++; + } } - } -EndGPS: - wifiDisconnect(); - GPSserial.end(); - returnToMenu=true; - gpsConnected=false; + + file.close(); } diff --git a/src/modules/wifi/wardriving.h b/src/modules/wifi/wardriving.h index e303bf82..43c67e70 100644 --- a/src/modules/wifi/wardriving.h +++ b/src/modules/wifi/wardriving.h @@ -1,17 +1,65 @@ -//Wardriving WIFI - @IncursioHack - https://github.com/IncursioHack +/** + * @file wardriving.h + * @author IncursioHack - https://github.com/IncursioHack + * @brief WiFi Wardriving + * @version 0.2 + * @note Updated: 2024-08-28 by Rennan Cockles (https://github.com/rennancockles) + */ + #ifndef WAR_DRIVING_H #define WAR_DRIVING_H -#include +#include "core/globals.h" #include #include +#include + + +class Wardriving { +public: + ///////////////////////////////////////////////////////////////////////////////////// + // Constructor + ///////////////////////////////////////////////////////////////////////////////////// + Wardriving(); + ~Wardriving(); + + ///////////////////////////////////////////////////////////////////////////////////// + // Life Cycle + ///////////////////////////////////////////////////////////////////////////////////// + void setup(); + void loop(); + +private: + bool date_time_updated = false; + bool initial_position_set = false; + double cur_lat; + double cur_lng; + double distance = 0; + TinyGPSPlus gps; + HardwareSerial GPSserial = HardwareSerial(2); // Uses UART2 for GPS + std::set registeredMACs; // Store and track registered MAC + int wifiNetworkCount = 0; // Counter fo wifi networks + + ///////////////////////////////////////////////////////////////////////////////////// + // Setup + ///////////////////////////////////////////////////////////////////////////////////// + void begin_wifi(void); + bool begin_gps(void); + void end(void); -extern TinyGPSPlus gps; -extern HardwareSerial GPSserial; -extern std::set registeredMACs; + ///////////////////////////////////////////////////////////////////////////////////// + // Display functions + ///////////////////////////////////////////////////////////////////////////////////// + void display_banner(void); + void dump_gps_data(void); -void wardriving_setup(); -void wardriving_logData(); -String wardriving_authModeToString(wifi_auth_mode_t authMode); + ///////////////////////////////////////////////////////////////////////////////////// + // Operations + ///////////////////////////////////////////////////////////////////////////////////// + void set_position(void); + void scan_networks(void); + String auth_mode_to_string(wifi_auth_mode_t authMode); + void append_to_file(int network_amount); +}; #endif // WAR_DRIVING_H \ No newline at end of file diff --git a/src/modules/wifi/wifi_atks.cpp b/src/modules/wifi/wifi_atks.cpp index 9f2f2036..7e2c4183 100644 --- a/src/modules/wifi/wifi_atks.cpp +++ b/src/modules/wifi/wifi_atks.cpp @@ -162,7 +162,7 @@ void deauthFloodAttack() wifiConnected = true; int nets; WiFi.mode(WIFI_AP); -ScanNets: +ScanNets: displayRedStripe("Scanning..", TFT_WHITE, FGCOLOR); nets = WiFi.scanNetworks(); ap_records.clear(); @@ -571,7 +571,7 @@ void beaconAttack() delay(200); wifiConnected = true; // display wifi icon - drawMainMenu(0); + // drawMainMenu(0); displayRedStripe(txt, TFT_WHITE, FGCOLOR); while (1) {