mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-22 15:16:43 -08:00
Fixes
Fix wifi shutdown Fix eapolScan Fix font size Fix strings Fix for loops
This commit is contained in:
@@ -34,10 +34,10 @@ void Display::RunSetup()
|
|||||||
|
|
||||||
#ifdef TFT_SHIELD
|
#ifdef TFT_SHIELD
|
||||||
uint16_t calData[5] = { 275, 3494, 361, 3528, 4 }; // tft.setRotation(0); // Portrait with TFT Shield
|
uint16_t calData[5] = { 275, 3494, 361, 3528, 4 }; // tft.setRotation(0); // Portrait with TFT Shield
|
||||||
Serial.println("Using TFT Shield");
|
Serial.println(F("Using TFT Shield"));
|
||||||
#else if defined(TFT_DIY)
|
#else if defined(TFT_DIY)
|
||||||
uint16_t calData[5] = { 339, 3470, 237, 3438, 2 }; // tft.setRotation(0); // Portrait with DIY TFT
|
uint16_t calData[5] = { 339, 3470, 237, 3438, 2 }; // tft.setRotation(0); // Portrait with DIY TFT
|
||||||
Serial.println("Using TFT DIY");
|
Serial.println(F("Using TFT DIY"));
|
||||||
#endif
|
#endif
|
||||||
tft.setTouch(calData);
|
tft.setTouch(calData);
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ void Display::RunSetup()
|
|||||||
// Initialize file system
|
// Initialize file system
|
||||||
// This should probably have its own class
|
// This should probably have its own class
|
||||||
if (!SPIFFS.begin()) {
|
if (!SPIFFS.begin()) {
|
||||||
Serial.println("SPIFFS initialisation failed!");
|
Serial.println(F("SPIFFS initialisation failed!"));
|
||||||
while (1) yield(); // Stay here twiddling thumbs waiting
|
while (1) yield(); // Stay here twiddling thumbs waiting
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,7 +312,7 @@ void Display::touchToExit()
|
|||||||
// Function to just draw the screen black
|
// Function to just draw the screen black
|
||||||
void Display::clearScreen()
|
void Display::clearScreen()
|
||||||
{
|
{
|
||||||
Serial.println("clearScreen()");
|
Serial.println(F("clearScreen()"));
|
||||||
tft.fillScreen(TFT_BLACK);
|
tft.fillScreen(TFT_BLACK);
|
||||||
tft.setCursor(0, 0);
|
tft.setCursor(0, 0);
|
||||||
}
|
}
|
||||||
@@ -354,7 +354,7 @@ void Display::showCenterText(String text, int y)
|
|||||||
|
|
||||||
void Display::initScrollValues(bool tte)
|
void Display::initScrollValues(bool tte)
|
||||||
{
|
{
|
||||||
Serial.println("initScrollValues()");
|
Serial.println(F("initScrollValues()"));
|
||||||
yDraw = YMAX - BOT_FIXED_AREA - TEXT_HEIGHT;
|
yDraw = YMAX - BOT_FIXED_AREA - TEXT_HEIGHT;
|
||||||
|
|
||||||
xPos = 0;
|
xPos = 0;
|
||||||
@@ -372,7 +372,7 @@ void Display::initScrollValues(bool tte)
|
|||||||
yArea = YMAX - TOP_FIXED_AREA_2 - BOT_FIXED_AREA;
|
yArea = YMAX - TOP_FIXED_AREA_2 - BOT_FIXED_AREA;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 18; i++) blank[i] = 0;
|
for(uint8_t i = 0; i < 18; i++) blank[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -410,7 +410,7 @@ int Display::scroll_line(uint32_t color) {
|
|||||||
|
|
||||||
// Function to setup hardware scroll for TFT screen
|
// Function to setup hardware scroll for TFT screen
|
||||||
void Display::setupScrollArea(uint16_t tfa, uint16_t bfa) {
|
void Display::setupScrollArea(uint16_t tfa, uint16_t bfa) {
|
||||||
Serial.println("setupScrollArea()");
|
Serial.println(F("setupScrollArea()"));
|
||||||
Serial.println(" tfa: " + (String)tfa);
|
Serial.println(" tfa: " + (String)tfa);
|
||||||
Serial.println(" bfa: " + (String)bfa);
|
Serial.println(" bfa: " + (String)bfa);
|
||||||
Serial.println("yStart: " + (String)this->yStart);
|
Serial.println("yStart: " + (String)this->yStart);
|
||||||
@@ -458,7 +458,7 @@ void Display::drawJpeg(const char *filename, int xpos, int ypos) {
|
|||||||
jpegRender(xpos, ypos);
|
jpegRender(xpos, ypos);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Serial.println("Jpeg file format not supported!");
|
Serial.println(F("Jpeg file format not supported!"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,7 +479,7 @@ void Display::drawStylus()
|
|||||||
boolean pressed = tft.getTouch(&x, &y);
|
boolean pressed = tft.getTouch(&x, &y);
|
||||||
|
|
||||||
if ((x <= 10) && (y <= 10) && (pressed)) {
|
if ((x <= 10) && (y <= 10) && (pressed)) {
|
||||||
Serial.println("Exit draw function");
|
Serial.println(F("Exit draw function"));
|
||||||
this->draw_tft = false;
|
this->draw_tft = false;
|
||||||
this->exit_draw = true;
|
this->exit_draw = true;
|
||||||
return;
|
return;
|
||||||
@@ -646,16 +646,16 @@ void createArray(const char *filename) {
|
|||||||
uint8_t data;
|
uint8_t data;
|
||||||
byte line_len = 0;
|
byte line_len = 0;
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
Serial.println("// Generated by a JPEGDecoder library example sketch:");
|
Serial.println(F("// Generated by a JPEGDecoder library example sketch:"));
|
||||||
Serial.println("// https://github.com/Bodmer/JPEGDecoder");
|
Serial.println(F("// https://github.com/Bodmer/JPEGDecoder"));
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
Serial.println("#if defined(__AVR__)");
|
Serial.println(F("#if defined(__AVR__)"));
|
||||||
Serial.println(" #include <avr/pgmspace.h>");
|
Serial.println(F(" #include <avr/pgmspace.h>"));
|
||||||
Serial.println("#endif");
|
Serial.println(F("#endif"));
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
Serial.print ("const uint8_t ");
|
Serial.print (F("const uint8_t "));
|
||||||
while (*filename != '.') Serial.print(*filename++);
|
while (*filename != '.') Serial.print(*filename++);
|
||||||
Serial.println("[] PROGMEM = {"); // PROGMEM added for AVR processors, it is ignored by Due
|
Serial.println(F("[] PROGMEM = {")); // PROGMEM added for AVR processors, it is ignored by Due
|
||||||
|
|
||||||
while ( jpgFile.available()) {
|
while ( jpgFile.available()) {
|
||||||
|
|
||||||
@@ -681,13 +681,13 @@ void createArray(const char *filename) {
|
|||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
void Display::listFiles(void) {
|
void Display::listFiles(void) {
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.println("SPIFFS files found:");
|
Serial.println(F("SPIFFS files found:"));
|
||||||
|
|
||||||
fs::Dir dir = SPIFFS.openDir("/"); // Root directory
|
fs::Dir dir = SPIFFS.openDir("/"); // Root directory
|
||||||
String line = "=====================================";
|
String line = "=====================================";
|
||||||
|
|
||||||
Serial.println(line);
|
Serial.println(line);
|
||||||
Serial.println(" File name Size");
|
Serial.println(F(" File name Size"));
|
||||||
Serial.println(line);
|
Serial.println(line);
|
||||||
|
|
||||||
while (dir.next()) {
|
while (dir.next()) {
|
||||||
@@ -720,22 +720,22 @@ void Display::listFiles(void) {
|
|||||||
void Display::listDir(fs::FS &fs, const char * dirname, uint8_t levels) {
|
void Display::listDir(fs::FS &fs, const char * dirname, uint8_t levels) {
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.println("SPIFFS files found:");
|
Serial.println(F("SPIFFS files found:"));
|
||||||
|
|
||||||
Serial.printf("Listing directory: %s\n", "/");
|
Serial.printf("Listing directory: %s\n", "/");
|
||||||
String line = "=====================================";
|
String line = "=====================================";
|
||||||
|
|
||||||
Serial.println(line);
|
Serial.println(line);
|
||||||
Serial.println(" File name Size");
|
Serial.println(F(" File name Size"));
|
||||||
Serial.println(line);
|
Serial.println(line);
|
||||||
|
|
||||||
fs::File root = fs.open(dirname);
|
fs::File root = fs.open(dirname);
|
||||||
if (!root) {
|
if (!root) {
|
||||||
Serial.println("Failed to open directory");
|
Serial.println(F("Failed to open directory"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!root.isDirectory()) {
|
if (!root.isDirectory()) {
|
||||||
Serial.println("Not a directory");
|
Serial.println(F("Not a directory"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,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.7.0";
|
const String PROGMEM version_number = "v0.7.1";
|
||||||
|
|
||||||
bool printing = false;
|
bool printing = false;
|
||||||
bool loading = false;
|
bool loading = false;
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ void MenuFunctions::battery2(bool initial)
|
|||||||
|
|
||||||
void MenuFunctions::updateStatusBar()
|
void MenuFunctions::updateStatusBar()
|
||||||
{
|
{
|
||||||
|
display_obj.tft.setTextSize(1);
|
||||||
uint16_t the_color;
|
uint16_t the_color;
|
||||||
|
|
||||||
// Draw temp info
|
// Draw temp info
|
||||||
@@ -320,6 +321,7 @@ void MenuFunctions::updateStatusBar()
|
|||||||
|
|
||||||
void MenuFunctions::drawStatusBar()
|
void MenuFunctions::drawStatusBar()
|
||||||
{
|
{
|
||||||
|
display_obj.tft.setTextSize(1);
|
||||||
display_obj.tft.fillRect(0, 0, 240, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
display_obj.tft.fillRect(0, 0, 240, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
||||||
//display_obj.tft.fillRect(0, STATUS_BAR_WIDTH + 1, 240, 1, TFT_DARKGREY);
|
//display_obj.tft.fillRect(0, STATUS_BAR_WIDTH + 1, 240, 1, TFT_DARKGREY);
|
||||||
display_obj.tft.setTextColor(TFT_WHITE, STATUSBAR_COLOR);
|
display_obj.tft.setTextColor(TFT_WHITE, STATUSBAR_COLOR);
|
||||||
@@ -677,10 +679,10 @@ void MenuFunctions::changeMenu(Menu * menu)
|
|||||||
void MenuFunctions::showMenuList(Menu * menu, int layer)
|
void MenuFunctions::showMenuList(Menu * menu, int layer)
|
||||||
{
|
{
|
||||||
// Iterate through all of the menu nodes in the menu
|
// Iterate through all of the menu nodes in the menu
|
||||||
for (int i = 0; i < menu->list->size(); i++)
|
for (uint8_t i = 0; i < menu->list->size(); i++)
|
||||||
{
|
{
|
||||||
// Depending on layer, indent
|
// Depending on layer, indent
|
||||||
for (int x = 0; x < layer * 4; x++)
|
for (uint8_t x = 0; x < layer * 4; x++)
|
||||||
Serial.print(" ");
|
Serial.print(" ");
|
||||||
Serial.print("Node: ");
|
Serial.print("Node: ");
|
||||||
Serial.println(menu->list->get(i).name);
|
Serial.println(menu->list->get(i).name);
|
||||||
@@ -732,7 +734,7 @@ void MenuFunctions::buildButtons(Menu * menu)
|
|||||||
|
|
||||||
void MenuFunctions::displayCurrentMenu()
|
void MenuFunctions::displayCurrentMenu()
|
||||||
{
|
{
|
||||||
Serial.println("Displaying current menu...");
|
Serial.println(F("Displaying current menu..."));
|
||||||
display_obj.clearScreen();
|
display_obj.clearScreen();
|
||||||
display_obj.tft.setTextColor(TFT_LIGHTGREY, TFT_DARKGREY);
|
display_obj.tft.setTextColor(TFT_LIGHTGREY, TFT_DARKGREY);
|
||||||
this->drawStatusBar();
|
this->drawStatusBar();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ bool SDInterface::initSD() {
|
|||||||
String display_string = "";
|
String display_string = "";
|
||||||
|
|
||||||
if (!SD.begin(SD_CS)) {
|
if (!SD.begin(SD_CS)) {
|
||||||
Serial.println("Failed to mount SD Card");
|
Serial.println(F("Failed to mount SD Card"));
|
||||||
this->supported = false;
|
this->supported = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -12,13 +12,13 @@ bool SDInterface::initSD() {
|
|||||||
this->supported = true;
|
this->supported = true;
|
||||||
this->cardType = SD.cardType();
|
this->cardType = SD.cardType();
|
||||||
if (cardType == CARD_MMC)
|
if (cardType == CARD_MMC)
|
||||||
Serial.println("SD: MMC Mounted");
|
Serial.println(F("SD: MMC Mounted"));
|
||||||
else if(cardType == CARD_SD)
|
else if(cardType == CARD_SD)
|
||||||
Serial.println("SD: SDSC Mounted");
|
Serial.println(F("SD: SDSC Mounted"));
|
||||||
else if(cardType == CARD_SDHC)
|
else if(cardType == CARD_SDHC)
|
||||||
Serial.println("SD: SDHC Mounted");
|
Serial.println(F("SD: SDHC Mounted"));
|
||||||
else
|
else
|
||||||
Serial.println("SD: UNKNOWN Card Mounted");
|
Serial.println(F("SD: UNKNOWN Card Mounted"));
|
||||||
|
|
||||||
//this->cardSizeBT = SD.cardSize();
|
//this->cardSizeBT = SD.cardSize();
|
||||||
//this->cardSizeKB = SD.cardSize() / 1024;
|
//this->cardSizeKB = SD.cardSize() / 1024;
|
||||||
@@ -76,13 +76,13 @@ void SDInterface::runUpdate() {
|
|||||||
display_obj.tft.setTextSize(1);
|
display_obj.tft.setTextSize(1);
|
||||||
display_obj.tft.setTextColor(TFT_WHITE);
|
display_obj.tft.setTextColor(TFT_WHITE);
|
||||||
|
|
||||||
display_obj.tft.println("Opening /update.bin...");
|
display_obj.tft.println(F("Opening /update.bin..."));
|
||||||
File updateBin = SD.open("/update.bin");
|
File updateBin = SD.open("/update.bin");
|
||||||
if (updateBin) {
|
if (updateBin) {
|
||||||
if(updateBin.isDirectory()){
|
if(updateBin.isDirectory()){
|
||||||
display_obj.tft.setTextColor(TFT_RED);
|
display_obj.tft.setTextColor(TFT_RED);
|
||||||
display_obj.tft.println("Error, could not find update.bin");
|
display_obj.tft.println(F("Error, could not find update.bin"));
|
||||||
Serial.println("Error, update.bin is not a file");
|
Serial.println(F("Error, update.bin is not a file"));
|
||||||
display_obj.tft.setTextColor(TFT_WHITE);
|
display_obj.tft.setTextColor(TFT_WHITE);
|
||||||
updateBin.close();
|
updateBin.close();
|
||||||
return;
|
return;
|
||||||
@@ -91,14 +91,14 @@ void SDInterface::runUpdate() {
|
|||||||
size_t updateSize = updateBin.size();
|
size_t updateSize = updateBin.size();
|
||||||
|
|
||||||
if (updateSize > 0) {
|
if (updateSize > 0) {
|
||||||
display_obj.tft.println("Starting SD Update...");
|
display_obj.tft.println(F("Starting SD Update..."));
|
||||||
Serial.println("Try to start update");
|
Serial.println(F("Try to start update"));
|
||||||
this->performUpdate(updateBin, updateSize);
|
this->performUpdate(updateBin, updateSize);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
display_obj.tft.setTextColor(TFT_RED);
|
display_obj.tft.setTextColor(TFT_RED);
|
||||||
display_obj.tft.println("Error, update.bin is empty");
|
display_obj.tft.println(F("Error, update.bin is empty"));
|
||||||
Serial.println("Error, file is empty");
|
Serial.println(F("Error, file is empty"));
|
||||||
display_obj.tft.setTextColor(TFT_WHITE);
|
display_obj.tft.setTextColor(TFT_WHITE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -106,16 +106,16 @@ void SDInterface::runUpdate() {
|
|||||||
updateBin.close();
|
updateBin.close();
|
||||||
|
|
||||||
// whe finished remove the binary from sd card to indicate end of the process
|
// whe finished remove the binary from sd card to indicate end of the process
|
||||||
display_obj.tft.println("rebooting...");
|
display_obj.tft.println(F("rebooting..."));
|
||||||
Serial.println("rebooting...");
|
Serial.println(F("rebooting..."));
|
||||||
//SD.remove("/update.bin");
|
//SD.remove("/update.bin");
|
||||||
delay(1000);
|
delay(1000);
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
display_obj.tft.setTextColor(TFT_RED);
|
display_obj.tft.setTextColor(TFT_RED);
|
||||||
display_obj.tft.println("Could not load update.bin from /");
|
display_obj.tft.println(F("Could not load update.bin from /"));
|
||||||
Serial.println("Could not load update.bin from sd root");
|
Serial.println(F("Could not load update.bin from sd root"));
|
||||||
display_obj.tft.setTextColor(TFT_WHITE);
|
display_obj.tft.setTextColor(TFT_WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,7 +123,7 @@ void SDInterface::runUpdate() {
|
|||||||
void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
|
void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
|
||||||
if (Update.begin(updateSize)) {
|
if (Update.begin(updateSize)) {
|
||||||
display_obj.tft.println("File size: " + String(updateSize));
|
display_obj.tft.println("File size: " + String(updateSize));
|
||||||
display_obj.tft.println("Writing file to partition...");
|
display_obj.tft.println(F("Writing file to partition..."));
|
||||||
size_t written = Update.writeStream(updateSource);
|
size_t written = Update.writeStream(updateSource);
|
||||||
if (written == updateSize) {
|
if (written == updateSize) {
|
||||||
display_obj.tft.println("Written: " + String(written) + " successfully");
|
display_obj.tft.println("Written: " + String(written) + " successfully");
|
||||||
@@ -136,8 +136,8 @@ void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
|
|||||||
if (Update.end()) {
|
if (Update.end()) {
|
||||||
Serial.println("OTA done!");
|
Serial.println("OTA done!");
|
||||||
if (Update.isFinished()) {
|
if (Update.isFinished()) {
|
||||||
display_obj.tft.println("Update complete");
|
display_obj.tft.println(F("Update complete"));
|
||||||
Serial.println("Update successfully completed. Rebooting.");
|
Serial.println(F("Update successfully completed. Rebooting."));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
display_obj.tft.setTextColor(TFT_RED);
|
display_obj.tft.setTextColor(TFT_RED);
|
||||||
|
|||||||
@@ -162,6 +162,18 @@ void WiFiScan::StartScan(uint8_t scan_mode, uint16_t color)
|
|||||||
WiFiScan::currentScanMode = scan_mode;
|
WiFiScan::currentScanMode = scan_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WiFiScan::shutdownWiFi() {
|
||||||
|
Serial.println("Ahhh yes...promiscuity will end");
|
||||||
|
esp_wifi_set_promiscuous(false);
|
||||||
|
//WiFi.persistent(false);
|
||||||
|
WiFi.disconnect(true);
|
||||||
|
WiFi.mode(WIFI_OFF);
|
||||||
|
|
||||||
|
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||||
|
esp_wifi_stop();
|
||||||
|
esp_wifi_deinit();
|
||||||
|
}
|
||||||
|
|
||||||
// Function to stop all wifi scans
|
// Function to stop all wifi scans
|
||||||
void WiFiScan::StopScan(uint8_t scan_mode)
|
void WiFiScan::StopScan(uint8_t scan_mode)
|
||||||
{
|
{
|
||||||
@@ -176,13 +188,7 @@ void WiFiScan::StopScan(uint8_t scan_mode)
|
|||||||
(currentScanMode == WIFI_ATTACK_RICK_ROLL) ||
|
(currentScanMode == WIFI_ATTACK_RICK_ROLL) ||
|
||||||
(currentScanMode == WIFI_PACKET_MONITOR))
|
(currentScanMode == WIFI_PACKET_MONITOR))
|
||||||
{
|
{
|
||||||
Serial.println("Ahhh yes...promiscuity will end");
|
this->shutdownWiFi();
|
||||||
esp_wifi_set_promiscuous(false);
|
|
||||||
WiFi.mode(WIFI_OFF);
|
|
||||||
|
|
||||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
|
||||||
esp_wifi_stop();
|
|
||||||
esp_wifi_deinit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -220,7 +226,7 @@ String WiFiScan::getStaMAC()
|
|||||||
char *buf;
|
char *buf;
|
||||||
uint8_t mac[6];
|
uint8_t mac[6];
|
||||||
char macAddrChr[18] = {0};
|
char macAddrChr[18] = {0};
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
//wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
esp_wifi_init(&cfg);
|
esp_wifi_init(&cfg);
|
||||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||||
@@ -234,6 +240,7 @@ String WiFiScan::getStaMAC()
|
|||||||
mac[3],
|
mac[3],
|
||||||
mac[4],
|
mac[4],
|
||||||
mac[5]);
|
mac[5]);
|
||||||
|
this->shutdownWiFi();
|
||||||
return String(macAddrChr);
|
return String(macAddrChr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -242,7 +249,7 @@ String WiFiScan::getApMAC()
|
|||||||
char *buf;
|
char *buf;
|
||||||
uint8_t mac[6];
|
uint8_t mac[6];
|
||||||
char macAddrChr[18] = {0};
|
char macAddrChr[18] = {0};
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
//wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
esp_wifi_init(&cfg);
|
esp_wifi_init(&cfg);
|
||||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||||
@@ -256,6 +263,7 @@ String WiFiScan::getApMAC()
|
|||||||
mac[3],
|
mac[3],
|
||||||
mac[4],
|
mac[4],
|
||||||
mac[5]);
|
mac[5]);
|
||||||
|
this->shutdownWiFi();
|
||||||
return String(macAddrChr);
|
return String(macAddrChr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,8 +301,8 @@ void WiFiScan::RunLvJoinWiFi(uint8_t scan_mode, uint16_t color) {
|
|||||||
|
|
||||||
void WiFiScan::RunInfo()
|
void WiFiScan::RunInfo()
|
||||||
{
|
{
|
||||||
//String sta_mac = this->getStaMAC();
|
String sta_mac = this->getStaMAC();
|
||||||
//String ap_mac = this->getApMAC();
|
String ap_mac = this->getApMAC();
|
||||||
String free_ram = this->freeRAM();
|
String free_ram = this->freeRAM();
|
||||||
|
|
||||||
//Serial.print("STA MAC: ");
|
//Serial.print("STA MAC: ");
|
||||||
@@ -308,11 +316,10 @@ void WiFiScan::RunInfo()
|
|||||||
display_obj.tft.setCursor(0, 100);
|
display_obj.tft.setCursor(0, 100);
|
||||||
display_obj.tft.setTextSize(1);
|
display_obj.tft.setTextSize(1);
|
||||||
display_obj.tft.setTextColor(TFT_CYAN);
|
display_obj.tft.setTextColor(TFT_CYAN);
|
||||||
|
|
||||||
//display_obj.tft.println(" Station MAC: " + sta_mac);
|
|
||||||
//display_obj.tft.println(" AP MAC: " + ap_mac);
|
|
||||||
display_obj.tft.println(" Firmware: Marauder");
|
display_obj.tft.println(" Firmware: Marauder");
|
||||||
display_obj.tft.println(" Version: " + display_obj.version_number + "\n");
|
display_obj.tft.println(" Version: " + display_obj.version_number + "\n");
|
||||||
|
display_obj.tft.println(" Station MAC: " + sta_mac);
|
||||||
|
display_obj.tft.println(" AP MAC: " + ap_mac);
|
||||||
display_obj.tft.println(" " + free_ram);
|
display_obj.tft.println(" " + free_ram);
|
||||||
|
|
||||||
if (sd_obj.supported) {
|
if (sd_obj.supported) {
|
||||||
@@ -353,7 +360,7 @@ void WiFiScan::RunEspressifScan(uint8_t scan_mode, uint16_t color) {
|
|||||||
display_obj.touchToExit();
|
display_obj.touchToExit();
|
||||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||||
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
//wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
esp_wifi_init(&cfg);
|
esp_wifi_init(&cfg);
|
||||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||||
@@ -398,7 +405,7 @@ void WiFiScan::RunPacketMonitor(uint8_t scan_mode, uint16_t color)
|
|||||||
display_obj.tftDrawExitScaleButtons();
|
display_obj.tftDrawExitScaleButtons();
|
||||||
|
|
||||||
Serial.println("Running packet scan...");
|
Serial.println("Running packet scan...");
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
//wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
esp_wifi_init(&cfg);
|
esp_wifi_init(&cfg);
|
||||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||||
@@ -501,7 +508,11 @@ void WiFiScan::RunBeaconSpam(uint8_t scan_mode, uint16_t color)
|
|||||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||||
packets_sent = 0;
|
packets_sent = 0;
|
||||||
//esp_wifi_set_mode(WIFI_MODE_STA);
|
//esp_wifi_set_mode(WIFI_MODE_STA);
|
||||||
WiFi.mode(WIFI_AP_STA);
|
//WiFi.mode(WIFI_AP_STA);
|
||||||
|
esp_wifi_init(&cfg);
|
||||||
|
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||||
|
//WiFi.mode(WIFI_AP_STA);
|
||||||
|
esp_wifi_set_mode(WIFI_AP_STA);
|
||||||
esp_wifi_start();
|
esp_wifi_start();
|
||||||
esp_wifi_set_promiscuous_filter(NULL);
|
esp_wifi_set_promiscuous_filter(NULL);
|
||||||
esp_wifi_set_promiscuous(true);
|
esp_wifi_set_promiscuous(true);
|
||||||
@@ -528,7 +539,7 @@ void WiFiScan::RunPwnScan(uint8_t scan_mode, uint16_t color)
|
|||||||
display_obj.touchToExit();
|
display_obj.touchToExit();
|
||||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||||
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
//wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
esp_wifi_init(&cfg);
|
esp_wifi_init(&cfg);
|
||||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||||
@@ -558,7 +569,7 @@ void WiFiScan::RunBeaconScan(uint8_t scan_mode, uint16_t color)
|
|||||||
display_obj.touchToExit();
|
display_obj.touchToExit();
|
||||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||||
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
//wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
esp_wifi_init(&cfg);
|
esp_wifi_init(&cfg);
|
||||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||||
@@ -587,7 +598,7 @@ void WiFiScan::RunDeauthScan(uint8_t scan_mode, uint16_t color)
|
|||||||
display_obj.touchToExit();
|
display_obj.touchToExit();
|
||||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||||
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
//wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
esp_wifi_init(&cfg);
|
esp_wifi_init(&cfg);
|
||||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||||
@@ -618,7 +629,7 @@ void WiFiScan::RunProbeScan(uint8_t scan_mode, uint16_t color)
|
|||||||
display_obj.touchToExit();
|
display_obj.touchToExit();
|
||||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||||
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
//wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
esp_wifi_init(&cfg);
|
esp_wifi_init(&cfg);
|
||||||
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
esp_wifi_set_storage(WIFI_STORAGE_RAM);
|
||||||
esp_wifi_set_mode(WIFI_MODE_NULL);
|
esp_wifi_set_mode(WIFI_MODE_NULL);
|
||||||
@@ -831,7 +842,10 @@ void WiFiScan::pwnSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
|||||||
{
|
{
|
||||||
Serial.print((char)snifferPacket->payload[i + 38]);
|
Serial.print((char)snifferPacket->payload[i + 38]);
|
||||||
//display_string.concat((char)snifferPacket->payload[i + 38]);
|
//display_string.concat((char)snifferPacket->payload[i + 38]);
|
||||||
|
if (isAscii(snifferPacket->payload[i + 38]))
|
||||||
essid.concat((char)snifferPacket->payload[i + 38]);
|
essid.concat((char)snifferPacket->payload[i + 38]);
|
||||||
|
else
|
||||||
|
Serial.println("Got non-ascii character: " + (String)(char)snifferPacket->payload[i + 38]);
|
||||||
}
|
}
|
||||||
//essid.concat("\": \"\"}}");
|
//essid.concat("\": \"\"}}");
|
||||||
//Serial.println("\n" + (String)(snifferPacket->payload[37]) + " -> " + essid);
|
//Serial.println("\n" + (String)(snifferPacket->payload[37]) + " -> " + essid);
|
||||||
@@ -841,6 +855,7 @@ void WiFiScan::pwnSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type)
|
|||||||
JsonObject& json = jsonBuffer.parseObject(essid);
|
JsonObject& json = jsonBuffer.parseObject(essid);
|
||||||
if (!json.success()) {
|
if (!json.success()) {
|
||||||
Serial.println("\nCould not parse Pwnagotchi json");
|
Serial.println("\nCould not parse Pwnagotchi json");
|
||||||
|
display_string.concat(essid);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Serial.println("\nSuccessfully parsed json");
|
Serial.println("\nSuccessfully parsed json");
|
||||||
|
|||||||
@@ -165,6 +165,7 @@ class WiFiScan
|
|||||||
|
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
|
|
||||||
|
void shutdownWiFi();
|
||||||
String getStaMAC();
|
String getStaMAC();
|
||||||
String getApMAC();
|
String getApMAC();
|
||||||
String freeRAM();
|
String freeRAM();
|
||||||
|
|||||||
@@ -79,11 +79,11 @@ void setup()
|
|||||||
|
|
||||||
display_obj.tft.println("Started Serial");
|
display_obj.tft.println("Started Serial");
|
||||||
|
|
||||||
Serial.println("\n\n--------------------------------\n");
|
Serial.println(F("\n\n--------------------------------\n"));
|
||||||
Serial.println(" ESP32 Marauder \n");
|
Serial.println(F(" ESP32 Marauder \n"));
|
||||||
Serial.println(" " + display_obj.version_number + "\n");
|
Serial.println(" " + display_obj.version_number + "\n");
|
||||||
Serial.println(" By: justcallmekoko\n");
|
Serial.println(F(" By: justcallmekoko\n"));
|
||||||
Serial.println("--------------------------------\n\n");
|
Serial.println(F("--------------------------------\n\n"));
|
||||||
|
|
||||||
//Serial.println("Internal Temp: " + (String)((temprature_sens_read() - 32) / 1.8));
|
//Serial.println("Internal Temp: " + (String)((temprature_sens_read() - 32) / 1.8));
|
||||||
|
|
||||||
@@ -93,13 +93,13 @@ void setup()
|
|||||||
|
|
||||||
// Do some SD stuff
|
// Do some SD stuff
|
||||||
if(sd_obj.initSD()) {
|
if(sd_obj.initSD()) {
|
||||||
Serial.println("SD Card supported");
|
Serial.println(F("SD Card supported"));
|
||||||
display_obj.tft.println("Initialized SD Card");
|
display_obj.tft.println(F("Initialized SD Card"));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Serial.println("SD Card NOT Supported");
|
Serial.println(F("SD Card NOT Supported"));
|
||||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||||
display_obj.tft.println("Failed to Initialize SD Card");
|
display_obj.tft.println(F("Failed to Initialize SD Card"));
|
||||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,30 +117,30 @@ void setup()
|
|||||||
Serial.println(wifi_scan_obj.freeRAM());
|
Serial.println(wifi_scan_obj.freeRAM());
|
||||||
battery_obj.RunSetup();
|
battery_obj.RunSetup();
|
||||||
|
|
||||||
display_obj.tft.println("Checked battery configuration");
|
display_obj.tft.println(F("Checked battery configuration"));
|
||||||
|
|
||||||
// Temperature stuff
|
// Temperature stuff
|
||||||
Serial.println(wifi_scan_obj.freeRAM());
|
Serial.println(wifi_scan_obj.freeRAM());
|
||||||
temp_obj.RunSetup();
|
temp_obj.RunSetup();
|
||||||
|
|
||||||
display_obj.tft.println("Initialized temperature interface");
|
display_obj.tft.println(F("Initialized temperature interface"));
|
||||||
|
|
||||||
battery_obj.battery_level = battery_obj.getBatteryLevel();
|
battery_obj.battery_level = battery_obj.getBatteryLevel();
|
||||||
|
|
||||||
if (battery_obj.i2c_supported) {
|
if (battery_obj.i2c_supported) {
|
||||||
Serial.println("IP5306 I2C Supported: true");
|
Serial.println(F("IP5306 I2C Supported: true"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Serial.println("IP5306 I2C Supported: false");
|
Serial.println(F("IP5306 I2C Supported: false"));
|
||||||
|
|
||||||
Serial.println(wifi_scan_obj.freeRAM());
|
Serial.println(wifi_scan_obj.freeRAM());
|
||||||
|
|
||||||
// Do some LED stuff
|
// Do some LED stuff
|
||||||
led_obj.RunSetup();
|
led_obj.RunSetup();
|
||||||
|
|
||||||
display_obj.tft.println("Initialized LED Interface");
|
display_obj.tft.println(F("Initialized LED Interface"));
|
||||||
|
|
||||||
display_obj.tft.println("Starting...");
|
display_obj.tft.println(F("Starting..."));
|
||||||
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user