diff --git a/README.md b/README.md index 5552636..f97ff0d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ -# ESP32 Marauder v0.5.2 +# ESP32 Marauder v0.5.3

Marauder logo

A suite of WiFi/Bluetooth offensive and defensive tools for the ESP32 diff --git a/esp32_marauder/Assets.h b/esp32_marauder/Assets.h index 3b36a42..90d90f1 100644 --- a/esp32_marauder/Assets.h +++ b/esp32_marauder/Assets.h @@ -117,7 +117,19 @@ PROGMEM static const unsigned char menu_icons[][66] = { 0xFF, 0xFF, 0x3F, 0x7F, 0xF0, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0x7F, 0xC0, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, - 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F} + 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F}, + {0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0x00, 0x3C, 0x7F, 0xFF, 0x3D, // SD Update: 19 + 0xBF, 0xFF, 0x3D, 0xDF, 0xFF, 0x3D, 0xEF, 0xFF, 0x3D, 0x6F, 0xC4, 0x3D, + 0xAF, 0xB7, 0x3D, 0xAF, 0xB7, 0x3D, 0x6F, 0xB6, 0x3D, 0xEF, 0xB5, 0x3D, + 0xEF, 0xB5, 0x3D, 0x2F, 0xC6, 0x3D, 0xEF, 0xFF, 0x3D, 0xEF, 0xFF, 0x3D, + 0xEF, 0xFF, 0x3D, 0xEF, 0xFF, 0x3D, 0xEF, 0xFF, 0x3D, 0x0F, 0x00, 0x3C, + 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F}, + {0xFF, 0xFF, 0x3F, 0xFF, 0xC0, 0x3F, 0x3F, 0x23, 0x3F, 0xDF, 0x94, 0x3E, // Web Update: 20 + 0x6F, 0x55, 0x3D, 0xB7, 0xB6, 0x3A, 0x03, 0x00, 0x30, 0xDB, 0xB6, 0x35, + 0xDD, 0xB6, 0x2D, 0xED, 0xB6, 0x2B, 0xED, 0xB6, 0x2B, 0x01, 0x00, 0x20, + 0xED, 0xB6, 0x2B, 0xDD, 0xB6, 0x2D, 0xDB, 0xB6, 0x35, 0xDB, 0x96, 0x35, + 0x07, 0x00, 0x38, 0x6F, 0x55, 0x3D, 0xDF, 0x94, 0x3E, 0x3F, 0x23, 0x3F, + 0xFF, 0xC0, 0x3F, 0xFF, 0xFF, 0x3F} }; diff --git a/esp32_marauder/Display.h b/esp32_marauder/Display.h index dff64c5..7876650 100644 --- a/esp32_marauder/Display.h +++ b/esp32_marauder/Display.h @@ -56,7 +56,7 @@ class Display TFT_eSPI tft = TFT_eSPI(); TFT_eSprite img = TFT_eSprite(&tft); TFT_eSPI_Button key[BUTTON_ARRAY_LEN]; - String version_number = "v0.5.2"; + String version_number = "v0.5.3"; bool printing = false; bool loading = false; diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp index 40dbd86..b4885e2 100644 --- a/esp32_marauder/MenuFunctions.cpp +++ b/esp32_marauder/MenuFunctions.cpp @@ -184,6 +184,8 @@ void MenuFunctions::RunSetup() deviceMenu.list = new LinkedList(); // Device menu stuff + whichUpdateMenu.list = new LinkedList(); + confirmMenu.list = new LinkedList(); updateMenu.list = new LinkedList(); infoMenu.list = new LinkedList(); @@ -201,6 +203,8 @@ void MenuFunctions::RunSetup() wifiMenu.name = " WiFi "; deviceMenu.name = " Device "; generalMenu.name = " General Apps "; + whichUpdateMenu.name = "Select Method "; + confirmMenu.name = " Confirm Update "; updateMenu.name = " Update Firmware "; infoMenu.name = " Device Info "; bluetoothMenu.name = " Bluetooth "; @@ -259,18 +263,36 @@ void MenuFunctions::RunSetup() addNodes(&bluetoothScannerMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(bluetoothScannerMenu.parentMenu);}); addNodes(&bluetoothScannerMenu, "Detect Card Skimmers", TFT_MAGENTA, NULL, CC_SKIMMERS, [this](){wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA);}); + // General apps menu generalMenu.parentMenu = &mainMenu; addNodes(&generalMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){display_obj.draw_tft = false; changeMenu(generalMenu.parentMenu);}); addNodes(&generalMenu, "Draw", TFT_WHITE, NULL, DRAW, [this](){display_obj.clearScreen(); display_obj.draw_tft = true;}); + // Device menu deviceMenu.parentMenu = &mainMenu; addNodes(&deviceMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(deviceMenu.parentMenu);}); - addNodes(&deviceMenu, "Update Firmware", TFT_ORANGE, NULL, UPDATE, [this](){wifi_scan_obj.currentScanMode = OTA_UPDATE; changeMenu(&updateMenu); web_obj.setupOTAupdate();}); + //addNodes(&deviceMenu, "Update Firmware", TFT_ORANGE, NULL, UPDATE, [this](){wifi_scan_obj.currentScanMode = OTA_UPDATE; changeMenu(&updateMenu); web_obj.setupOTAupdate();}); + addNodes(&deviceMenu, "Update Firmware", TFT_ORANGE, NULL, UPDATE, [this](){wifi_scan_obj.currentScanMode = OTA_UPDATE; changeMenu(&whichUpdateMenu);}); addNodes(&deviceMenu, "Device Info", TFT_WHITE, NULL, DEVICE_INFO, [this](){wifi_scan_obj.currentScanMode = SHOW_INFO; changeMenu(&infoMenu); wifi_scan_obj.RunInfo();}); + // Select update + whichUpdateMenu.parentMenu = &deviceMenu; + addNodes(&whichUpdateMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(whichUpdateMenu.parentMenu);}); + addNodes(&whichUpdateMenu, "Web Update", TFT_GREEN, NULL, WEB_UPDATE, [this](){wifi_scan_obj.currentScanMode = OTA_UPDATE; changeMenu(&updateMenu); web_obj.setupOTAupdate();}); + addNodes(&whichUpdateMenu, "SD Update", TFT_MAGENTA, NULL, SD_UPDATE, [this](){wifi_scan_obj.currentScanMode = OTA_UPDATE; changeMenu(&confirmMenu);}); + + // Confirm SD update menu + confirmMenu.parentMenu = &whichUpdateMenu; + addNodes(&confirmMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(confirmMenu.parentMenu);}); + //addNodes(&confirmMenu, "Yes", TFT_ORANGE, NULL, UPDATE, [this](){wifi_scan_obj.currentScanMode = OTA_UPDATE; changeMenu(&updateMenu); sd_obj.runUpdate();}); + addNodes(&confirmMenu, "Yes", TFT_ORANGE, NULL, UPDATE, [this](){wifi_scan_obj.currentScanMode = OTA_UPDATE; sd_obj.runUpdate();}); + + // Web Update updateMenu.parentMenu = &deviceMenu; addNodes(&updateMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF; changeMenu(updateMenu.parentMenu); WiFi.softAPdisconnect(true); web_obj.shutdownServer();}); + //addNodes(&updateMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF; changeMenu(updateMenu.parentMenu);}); + // Device info menu infoMenu.parentMenu = &deviceMenu; addNodes(&infoMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF; changeMenu(infoMenu.parentMenu);}); diff --git a/esp32_marauder/MenuFunctions.h b/esp32_marauder/MenuFunctions.h index 3c0b4ac..0227473 100644 --- a/esp32_marauder/MenuFunctions.h +++ b/esp32_marauder/MenuFunctions.h @@ -44,6 +44,8 @@ extern Web web_obj; #define UPDATE 16 #define DEVICE 17 #define DEVICE_INFO 18 +#define SD_UPDATE 19 +#define WEB_UPDATE 20 struct Menu; @@ -80,6 +82,8 @@ class MenuFunctions Menu deviceMenu; // Device menu stuff + Menu whichUpdateMenu; + Menu confirmMenu; Menu updateMenu; Menu infoMenu; diff --git a/esp32_marauder/SDInterface.cpp b/esp32_marauder/SDInterface.cpp index d69c3c5..bbcafdb 100644 --- a/esp32_marauder/SDInterface.cpp +++ b/esp32_marauder/SDInterface.cpp @@ -68,6 +68,86 @@ void SDInterface::openCapture() { buffer_obj.open(&SD); } +void SDInterface::runUpdate() { + display_obj.clearScreen(); + display_obj.tft.setTextWrap(false); + display_obj.tft.setFreeFont(NULL); + display_obj.tft.setCursor(0, 0); + display_obj.tft.setTextSize(1); + display_obj.tft.setTextColor(TFT_MAGENTA); + + display_obj.tft.println("Opening /update.bin..."); + File updateBin = SD.open("/update.bin"); + if (updateBin) { + if(updateBin.isDirectory()){ + display_obj.tft.println("Error, could not find update.bin"); + Serial.println("Error, update.bin is not a file"); + updateBin.close(); + return; + } + + size_t updateSize = updateBin.size(); + + if (updateSize > 0) { + display_obj.tft.println("Starting SD Update..."); + Serial.println("Try to start update"); + this->performUpdate(updateBin, updateSize); + } + else { + display_obj.tft.println("Error, update.bin is empty"); + Serial.println("Error, file is empty"); + } + + updateBin.close(); + + // whe finished remove the binary from sd card to indicate end of the process + display_obj.tft.println("Exiting update process..."); + Serial.println("Exiting update process..."); + //SD.remove("/update.bin"); + } + else { + display_obj.tft.println("Could not load update.bin from /"); + Serial.println("Could not load update.bin from sd root"); + } +} + +void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) { + if (Update.begin(updateSize)) { + display_obj.tft.println("File size: " + String(updateSize)); + display_obj.tft.println("Writing file to partition..."); + size_t written = Update.writeStream(updateSource); + if (written == updateSize) { + display_obj.tft.println("Written: " + String(written) + " successfully"); + Serial.println("Written : " + String(written) + " successfully"); + } + else { + display_obj.tft.println("Written only : " + String(written) + "/" + String(updateSize) + ". Retry?"); + Serial.println("Written only : " + String(written) + "/" + String(updateSize) + ". Retry?"); + } + if (Update.end()) { + Serial.println("OTA done!"); + if (Update.isFinished()) { + display_obj.tft.println("Update complete"); + Serial.println("Update successfully completed. Rebooting."); + } + else { + display_obj.tft.println("Update could not complete"); + Serial.println("Update not finished? Something went wrong!"); + } + } + else { + display_obj.tft.println("Error Occurred. Error #: " + String(Update.getError())); + Serial.println("Error Occurred. Error #: " + String(Update.getError())); + } + + } + else + { + display_obj.tft.println("Not enough space to begin OTA"); + Serial.println("Not enough space to begin OTA"); + } +} + void SDInterface::main() { if ((this->supported) && (this->do_save)) { //Serial.println("Saving packet..."); diff --git a/esp32_marauder/SDInterface.h b/esp32_marauder/SDInterface.h index 4652448..3fad239 100644 --- a/esp32_marauder/SDInterface.h +++ b/esp32_marauder/SDInterface.h @@ -3,8 +3,11 @@ #include "SD.h" #include "Buffer.h" +#include "Display.h" +#include extern Buffer buffer_obj; +extern Display display_obj; #define SD_CS 12 @@ -27,6 +30,8 @@ class SDInterface { void addPacket(uint8_t* buf, uint32_t len); void openCapture(); + void runUpdate(); + void performUpdate(Stream &updateSource, size_t updateSize); void main(); //void savePacket(uint8_t* buf, uint32_t len); }; diff --git a/esp32_marauder/esp32_marauder.ino.d32.bin b/esp32_marauder/esp32_marauder.ino.d32.bin new file mode 100644 index 0000000..22ef87b Binary files /dev/null and b/esp32_marauder/esp32_marauder.ino.d32.bin differ diff --git a/pictures/icons/sd_update_22.bmp b/pictures/icons/sd_update_22.bmp new file mode 100644 index 0000000..c360605 Binary files /dev/null and b/pictures/icons/sd_update_22.bmp differ diff --git a/pictures/icons/web_update_22.bmp b/pictures/icons/web_update_22.bmp new file mode 100644 index 0000000..7cb6a0f Binary files /dev/null and b/pictures/icons/web_update_22.bmp differ diff --git a/pictures/xbm/sd_update_22.XBM b/pictures/xbm/sd_update_22.XBM new file mode 100644 index 0000000..0fe8233 --- /dev/null +++ b/pictures/xbm/sd_update_22.XBM @@ -0,0 +1,9 @@ +#define 1583800096004_width 22 +#define 1583800096004_height 22 +static char 1583800096004_bits[] = { + 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0x00, 0x3C, 0x7F, 0xFF, 0x3D, + 0xBF, 0xFF, 0x3D, 0xDF, 0xFF, 0x3D, 0xEF, 0xFF, 0x3D, 0x6F, 0xC4, 0x3D, + 0xAF, 0xB7, 0x3D, 0xAF, 0xB7, 0x3D, 0x6F, 0xB6, 0x3D, 0xEF, 0xB5, 0x3D, + 0xEF, 0xB5, 0x3D, 0x2F, 0xC6, 0x3D, 0xEF, 0xFF, 0x3D, 0xEF, 0xFF, 0x3D, + 0xEF, 0xFF, 0x3D, 0xEF, 0xFF, 0x3D, 0xEF, 0xFF, 0x3D, 0x0F, 0x00, 0x3C, + 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x3F, }; diff --git a/pictures/xbm/web_update_22.XBM b/pictures/xbm/web_update_22.XBM new file mode 100644 index 0000000..14983d8 --- /dev/null +++ b/pictures/xbm/web_update_22.XBM @@ -0,0 +1,9 @@ +#define 1583800128954_width 22 +#define 1583800128954_height 22 +static char 1583800128954_bits[] = { + 0xFF, 0xFF, 0x3F, 0xFF, 0xC0, 0x3F, 0x3F, 0x23, 0x3F, 0xDF, 0x94, 0x3E, + 0x6F, 0x55, 0x3D, 0xB7, 0xB6, 0x3A, 0x03, 0x00, 0x30, 0xDB, 0xB6, 0x35, + 0xDD, 0xB6, 0x2D, 0xED, 0xB6, 0x2B, 0xED, 0xB6, 0x2B, 0x01, 0x00, 0x20, + 0xED, 0xB6, 0x2B, 0xDD, 0xB6, 0x2D, 0xDB, 0xB6, 0x35, 0xDB, 0x96, 0x35, + 0x07, 0x00, 0x38, 0x6F, 0x55, 0x3D, 0xDF, 0x94, 0x3E, 0x3F, 0x23, 0x3F, + 0xFF, 0xC0, 0x3F, 0xFF, 0xFF, 0x3F, };