mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-12 15:50:36 -08:00
Add SD Update
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<!---[](https://travis-ci.com/justcallmekoko/ESP32Marauder)--->
|
<!---[](https://travis-ci.com/justcallmekoko/ESP32Marauder)--->
|
||||||
<!---Shields/Badges https://shields.io/--->
|
<!---Shields/Badges https://shields.io/--->
|
||||||
|
|
||||||
# ESP32 Marauder v0.5.2
|
# ESP32 Marauder v0.5.3
|
||||||
<p align="center"><img alt="Marauder logo" src="https://github.com/justcallmekoko/ESP32Marauder/blob/master/pictures/marauder3L.jpg?raw=true" width="300"></p>
|
<p align="center"><img alt="Marauder logo" src="https://github.com/justcallmekoko/ESP32Marauder/blob/master/pictures/marauder3L.jpg?raw=true" width="300"></p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<b>A suite of WiFi/Bluetooth offensive and defensive tools for the ESP32</b>
|
<b>A suite of WiFi/Bluetooth offensive and defensive tools for the ESP32</b>
|
||||||
|
|||||||
@@ -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, 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, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F, 0xFF, 0xF1, 0x3F,
|
||||||
0xFF, 0xF1, 0x3F, 0x7F, 0xC0, 0x3F, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 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}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class Display
|
|||||||
TFT_eSPI tft = TFT_eSPI();
|
TFT_eSPI tft = TFT_eSPI();
|
||||||
TFT_eSprite img = TFT_eSprite(&tft);
|
TFT_eSprite img = TFT_eSprite(&tft);
|
||||||
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||||
String version_number = "v0.5.2";
|
String version_number = "v0.5.3";
|
||||||
|
|
||||||
bool printing = false;
|
bool printing = false;
|
||||||
bool loading = false;
|
bool loading = false;
|
||||||
|
|||||||
@@ -184,6 +184,8 @@ void MenuFunctions::RunSetup()
|
|||||||
deviceMenu.list = new LinkedList<MenuNode>();
|
deviceMenu.list = new LinkedList<MenuNode>();
|
||||||
|
|
||||||
// Device menu stuff
|
// Device menu stuff
|
||||||
|
whichUpdateMenu.list = new LinkedList<MenuNode>();
|
||||||
|
confirmMenu.list = new LinkedList<MenuNode>();
|
||||||
updateMenu.list = new LinkedList<MenuNode>();
|
updateMenu.list = new LinkedList<MenuNode>();
|
||||||
infoMenu.list = new LinkedList<MenuNode>();
|
infoMenu.list = new LinkedList<MenuNode>();
|
||||||
|
|
||||||
@@ -201,6 +203,8 @@ void MenuFunctions::RunSetup()
|
|||||||
wifiMenu.name = " WiFi ";
|
wifiMenu.name = " WiFi ";
|
||||||
deviceMenu.name = " Device ";
|
deviceMenu.name = " Device ";
|
||||||
generalMenu.name = " General Apps ";
|
generalMenu.name = " General Apps ";
|
||||||
|
whichUpdateMenu.name = "Select Method ";
|
||||||
|
confirmMenu.name = " Confirm Update ";
|
||||||
updateMenu.name = " Update Firmware ";
|
updateMenu.name = " Update Firmware ";
|
||||||
infoMenu.name = " Device Info ";
|
infoMenu.name = " Device Info ";
|
||||||
bluetoothMenu.name = " Bluetooth ";
|
bluetoothMenu.name = " Bluetooth ";
|
||||||
@@ -259,18 +263,36 @@ void MenuFunctions::RunSetup()
|
|||||||
addNodes(&bluetoothScannerMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(bluetoothScannerMenu.parentMenu);});
|
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);});
|
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;
|
generalMenu.parentMenu = &mainMenu;
|
||||||
addNodes(&generalMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){display_obj.draw_tft = false; changeMenu(generalMenu.parentMenu);});
|
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;});
|
addNodes(&generalMenu, "Draw", TFT_WHITE, NULL, DRAW, [this](){display_obj.clearScreen(); display_obj.draw_tft = true;});
|
||||||
|
|
||||||
|
// Device menu
|
||||||
deviceMenu.parentMenu = &mainMenu;
|
deviceMenu.parentMenu = &mainMenu;
|
||||||
addNodes(&deviceMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(deviceMenu.parentMenu);});
|
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();});
|
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;
|
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); 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;
|
infoMenu.parentMenu = &deviceMenu;
|
||||||
addNodes(&infoMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF; changeMenu(infoMenu.parentMenu);});
|
addNodes(&infoMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF; changeMenu(infoMenu.parentMenu);});
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,8 @@ extern Web web_obj;
|
|||||||
#define UPDATE 16
|
#define UPDATE 16
|
||||||
#define DEVICE 17
|
#define DEVICE 17
|
||||||
#define DEVICE_INFO 18
|
#define DEVICE_INFO 18
|
||||||
|
#define SD_UPDATE 19
|
||||||
|
#define WEB_UPDATE 20
|
||||||
|
|
||||||
struct Menu;
|
struct Menu;
|
||||||
|
|
||||||
@@ -80,6 +82,8 @@ class MenuFunctions
|
|||||||
Menu deviceMenu;
|
Menu deviceMenu;
|
||||||
|
|
||||||
// Device menu stuff
|
// Device menu stuff
|
||||||
|
Menu whichUpdateMenu;
|
||||||
|
Menu confirmMenu;
|
||||||
Menu updateMenu;
|
Menu updateMenu;
|
||||||
Menu infoMenu;
|
Menu infoMenu;
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,86 @@ void SDInterface::openCapture() {
|
|||||||
buffer_obj.open(&SD);
|
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() {
|
void SDInterface::main() {
|
||||||
if ((this->supported) && (this->do_save)) {
|
if ((this->supported) && (this->do_save)) {
|
||||||
//Serial.println("Saving packet...");
|
//Serial.println("Saving packet...");
|
||||||
|
|||||||
@@ -3,8 +3,11 @@
|
|||||||
|
|
||||||
#include "SD.h"
|
#include "SD.h"
|
||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
|
#include "Display.h"
|
||||||
|
#include <Update.h>
|
||||||
|
|
||||||
extern Buffer buffer_obj;
|
extern Buffer buffer_obj;
|
||||||
|
extern Display display_obj;
|
||||||
|
|
||||||
#define SD_CS 12
|
#define SD_CS 12
|
||||||
|
|
||||||
@@ -27,6 +30,8 @@ class SDInterface {
|
|||||||
|
|
||||||
void addPacket(uint8_t* buf, uint32_t len);
|
void addPacket(uint8_t* buf, uint32_t len);
|
||||||
void openCapture();
|
void openCapture();
|
||||||
|
void runUpdate();
|
||||||
|
void performUpdate(Stream &updateSource, size_t updateSize);
|
||||||
void main();
|
void main();
|
||||||
//void savePacket(uint8_t* buf, uint32_t len);
|
//void savePacket(uint8_t* buf, uint32_t len);
|
||||||
};
|
};
|
||||||
|
|||||||
BIN
esp32_marauder/esp32_marauder.ino.d32.bin
Normal file
BIN
esp32_marauder/esp32_marauder.ino.d32.bin
Normal file
Binary file not shown.
BIN
pictures/icons/sd_update_22.bmp
Normal file
BIN
pictures/icons/sd_update_22.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
pictures/icons/web_update_22.bmp
Normal file
BIN
pictures/icons/web_update_22.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
9
pictures/xbm/sd_update_22.XBM
Normal file
9
pictures/xbm/sd_update_22.XBM
Normal file
@@ -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, };
|
||||||
9
pictures/xbm/web_update_22.XBM
Normal file
9
pictures/xbm/web_update_22.XBM
Normal file
@@ -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, };
|
||||||
Reference in New Issue
Block a user