mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-08 05:41:00 -08:00
Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a1ee15345 | ||
|
|
da538934e3 | ||
|
|
e2b52f74e5 | ||
|
|
546afc63a7 | ||
|
|
2f0d05a538 | ||
|
|
9f013d3d52 | ||
|
|
45db8f3c22 | ||
|
|
e490b40196 | ||
|
|
72edd3d43d | ||
|
|
bc6a07f5cb | ||
|
|
bd7a350a9b | ||
|
|
cdd0ee5976 | ||
|
|
d7aac68866 | ||
|
|
0f58a0657b | ||
|
|
d9a6966574 | ||
|
|
5341c559be | ||
|
|
2c4edd012d | ||
|
|
3b09650363 | ||
|
|
7d6d0517e1 | ||
|
|
30020dd710 | ||
|
|
3d2bb75081 | ||
|
|
95841e5384 | ||
|
|
a73ae2bbcb | ||
|
|
ae1aebde50 | ||
|
|
9134280c6a | ||
|
|
93d0f2e1d2 | ||
|
|
e3f365febf | ||
|
|
66576c1908 | ||
|
|
8c53ac679f | ||
|
|
2d33c0b5ab | ||
|
|
ec4fc7487f | ||
|
|
71ced23041 | ||
|
|
8e874c493b | ||
|
|
373482822a | ||
|
|
bca0f70073 | ||
|
|
37c65bf6f1 | ||
|
|
b7be44d5ea | ||
|
|
503e65e012 | ||
|
|
a78d5b792c | ||
|
|
38098cb9e5 | ||
|
|
466d5fbb1a | ||
|
|
51a7ff7e26 | ||
|
|
f166c7a4df | ||
|
|
9e1fe534b0 | ||
|
|
a23e7a4c48 | ||
|
|
f801ba0bc5 | ||
|
|
31687c10cb |
309
MarauderOTA/MarauderOTA.ino
Normal file
309
MarauderOTA/MarauderOTA.ino
Normal file
File diff suppressed because one or more lines are too long
429
PCBs/Kit/PCB_ESP32 Marauder 3.5 Kit V3 PCB_2022-04-29.json
Normal file
429
PCBs/Kit/PCB_ESP32 Marauder 3.5 Kit V3 PCB_2022-04-29.json
Normal file
File diff suppressed because one or more lines are too long
BIN
PCBs/Kit/QD-TFT2803 specification_v1.1.pdf
Normal file
BIN
PCBs/Kit/QD-TFT2803 specification_v1.1.pdf
Normal file
Binary file not shown.
BIN
PCBs/v4(OG)/MSP2807-2.8-SPI.pdf
Normal file
BIN
PCBs/v4(OG)/MSP2807-2.8-SPI.pdf
Normal file
Binary file not shown.
BIN
PCBs/v4(OG)/Marauder Screen PCB Measurements.png
Normal file
BIN
PCBs/v4(OG)/Marauder Screen PCB Measurements.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
459
PCBs/v4(OG)/PCB_ESP32 Marauder 3.7 OG PCB_2022-04-29.json
Normal file
459
PCBs/v4(OG)/PCB_ESP32 Marauder 3.7 OG PCB_2022-04-29.json
Normal file
File diff suppressed because one or more lines are too long
BIN
PCBs/v4(OG)/QD-TFT2803 specification_v1.1.pdf
Normal file
BIN
PCBs/v4(OG)/QD-TFT2803 specification_v1.1.pdf
Normal file
Binary file not shown.
1
PCBs/v4(OG)/README.md
Normal file
1
PCBs/v4(OG)/README.md
Normal file
@@ -0,0 +1 @@
|
||||
Further resources can be found [here](http://www.lcdwiki.com/2.8inch_SPI_Module_ILI9341_SKU:MSP2807)
|
||||
576
PCBs/v6/PCB_ESP32 Marauder 6 PCB_2022-04-29.json
Normal file
576
PCBs/v6/PCB_ESP32 Marauder 6 PCB_2022-04-29.json
Normal file
File diff suppressed because one or more lines are too long
BIN
PCBs/v6/QD-TFT2803 specification_v1.1.pdf
Normal file
BIN
PCBs/v6/QD-TFT2803 specification_v1.1.pdf
Normal file
Binary file not shown.
@@ -3,7 +3,7 @@
|
||||
<!---[](https://travis-ci.com/justcallmekoko/ESP32Marauder)--->
|
||||
<!---Shields/Badges https://shields.io/--->
|
||||
|
||||
# ESP32 Marauder v0.9.1
|
||||
# ESP32 Marauder v0.9.5
|
||||
<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">
|
||||
<b>A suite of WiFi/Bluetooth offensive and defensive tools for the ESP32</b>
|
||||
@@ -19,8 +19,6 @@
|
||||
<br>
|
||||
<a href="https://www.twitch.tv/willstunforfood"><img src="https://assets.stickpng.com/images/580b57fcd9996e24bc43c540.png" alt="Twitch WillStunForFood" width="200"></a>
|
||||
</p>
|
||||
|
||||
Catch my live stream on [Twitch](https://www.twitch.tv/willstunforfood) where I play games, have just chatting sessions to talk tech, and just generally be an ordinary person who can't figure out how to make proper life decisions.
|
||||
|
||||
## Getting Started
|
||||
Download the [latest release](https://github.com/justcallmekoko/ESP32Marauder/releases/latest) of the firmware.
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,43 +1,49 @@
|
||||
#include "BatteryInterface.h"
|
||||
|
||||
#include "lang_var.h"
|
||||
BatteryInterface::BatteryInterface() {
|
||||
|
||||
}
|
||||
|
||||
void BatteryInterface::main(uint32_t currentTime) {
|
||||
if (currentTime != 0) {
|
||||
if (currentTime - initTime >= 3000) {
|
||||
//Serial.println("Checking Battery Level");
|
||||
this->initTime = millis();
|
||||
int8_t new_level = this->getBatteryLevel();
|
||||
//this->battery_level = this->getBatteryLevel();
|
||||
if (this->battery_level != new_level) {
|
||||
Serial.println("Battery Level changed: " + (String)new_level);
|
||||
this->battery_level = new_level;
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
if (currentTime != 0) {
|
||||
if (currentTime - initTime >= 3000) {
|
||||
//Serial.println("Checking Battery Level");
|
||||
this->initTime = millis();
|
||||
int8_t new_level = this->getBatteryLevel();
|
||||
//this->battery_level = this->getBatteryLevel();
|
||||
if (this->battery_level != new_level) {
|
||||
Serial.println(text00 + (String)new_level);
|
||||
this->battery_level = new_level;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void BatteryInterface::RunSetup() {
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
this->initTime = millis();
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
Wire.begin(I2C_SDA, I2C_SCL);
|
||||
this->initTime = millis();
|
||||
#endif
|
||||
}
|
||||
|
||||
int8_t BatteryInterface::getBatteryLevel() {
|
||||
Wire.beginTransmission(IP5306_ADDR);
|
||||
Wire.write(0x78);
|
||||
if (Wire.endTransmission(false) == 0 &&
|
||||
Wire.requestFrom(0x75, 1)) {
|
||||
this->i2c_supported = true;
|
||||
switch (Wire.read() & 0xF0) {
|
||||
case 0xE0: return 25;
|
||||
case 0xC0: return 50;
|
||||
case 0x80: return 75;
|
||||
case 0x00: return 100;
|
||||
default: return 0;
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
Wire.beginTransmission(IP5306_ADDR);
|
||||
Wire.write(0x78);
|
||||
if (Wire.endTransmission(false) == 0 &&
|
||||
Wire.requestFrom(0x75, 1)) {
|
||||
this->i2c_supported = true;
|
||||
switch (Wire.read() & 0xF0) {
|
||||
case 0xE0: return 25;
|
||||
case 0xC0: return 50;
|
||||
case 0x80: return 75;
|
||||
case 0x00: return 100;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
this->i2c_supported = false;
|
||||
return -1;
|
||||
this->i2c_supported = false;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
#include <Wire.h>
|
||||
#include "configs.h"
|
||||
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
#include <Wire.h>
|
||||
#endif
|
||||
|
||||
#define I2C_SDA 33
|
||||
#define I2C_SCL 22
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Buffer.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
Buffer::Buffer(){
|
||||
bufA = (uint8_t*)malloc(BUF_SIZE);
|
||||
@@ -37,7 +38,7 @@ void Buffer::close(fs::FS* fs){
|
||||
if(!writing) return;
|
||||
forceSave(fs);
|
||||
writing = false;
|
||||
Serial.println("file closed");
|
||||
Serial.println(text01);
|
||||
}
|
||||
|
||||
void Buffer::addPacket(uint8_t* buf, uint32_t len){
|
||||
@@ -123,7 +124,7 @@ void Buffer::save(fs::FS* fs){
|
||||
|
||||
file = fs->open(fileName, FILE_APPEND);
|
||||
if (!file) {
|
||||
Serial.println("Failed to open file '"+fileName+"'");
|
||||
Serial.println(text02 + fileName+"'");
|
||||
//useSD = false;
|
||||
return;
|
||||
}
|
||||
@@ -159,7 +160,7 @@ void Buffer::forceSave(fs::FS* fs){
|
||||
|
||||
file = fs->open(fileName, FILE_APPEND);
|
||||
if (!file) {
|
||||
Serial.println("Failed to open file '"+fileName+"'");
|
||||
Serial.println(text02+fileName+"'");
|
||||
//useSD = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,41 +1,44 @@
|
||||
#ifndef Buffer_h
|
||||
#define Buffer_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "FS.h"
|
||||
//#include "SD_MMC.h"
|
||||
|
||||
#define BUF_SIZE 3 * 1024 // Had to reduce buffer size to save RAM. GG @spacehuhn
|
||||
#define SNAP_LEN 2324 // max len of each recieved packet
|
||||
|
||||
//extern bool useSD;
|
||||
|
||||
class Buffer {
|
||||
public:
|
||||
Buffer();
|
||||
void open(fs::FS* fs, String fn = "");
|
||||
void close(fs::FS* fs);
|
||||
void addPacket(uint8_t* buf, uint32_t len);
|
||||
void save(fs::FS* fs);
|
||||
void forceSave(fs::FS* fs);
|
||||
private:
|
||||
void write(int32_t n);
|
||||
void write(uint32_t n);
|
||||
void write(uint16_t n);
|
||||
void write(uint8_t* buf, uint32_t len);
|
||||
|
||||
uint8_t* bufA;
|
||||
uint8_t* bufB;
|
||||
|
||||
uint32_t bufSizeA = 0;
|
||||
uint32_t bufSizeB = 0;
|
||||
|
||||
bool writing = false; // acceppting writes to buffer
|
||||
bool useA = true; // writing to bufA or bufB
|
||||
bool saving = false; // currently saving onto the SD card
|
||||
|
||||
String fileName = "/0.pcap";
|
||||
File file;
|
||||
};
|
||||
|
||||
#endif
|
||||
#ifndef Buffer_h
|
||||
#define Buffer_h
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "FS.h"
|
||||
#include "settings.h"
|
||||
//#include "SD_MMC.h"
|
||||
|
||||
#define BUF_SIZE 3 * 1024 // Had to reduce buffer size to save RAM. GG @spacehuhn
|
||||
#define SNAP_LEN 2324 // max len of each recieved packet
|
||||
|
||||
//extern bool useSD;
|
||||
|
||||
extern Settings settings_obj;
|
||||
|
||||
class Buffer {
|
||||
public:
|
||||
Buffer();
|
||||
void open(fs::FS* fs, String fn = "");
|
||||
void close(fs::FS* fs);
|
||||
void addPacket(uint8_t* buf, uint32_t len);
|
||||
void save(fs::FS* fs);
|
||||
void forceSave(fs::FS* fs);
|
||||
private:
|
||||
void write(int32_t n);
|
||||
void write(uint32_t n);
|
||||
void write(uint16_t n);
|
||||
void write(uint8_t* buf, uint32_t len);
|
||||
|
||||
uint8_t* bufA;
|
||||
uint8_t* bufB;
|
||||
|
||||
uint32_t bufSizeA = 0;
|
||||
uint32_t bufSizeB = 0;
|
||||
|
||||
bool writing = false; // acceppting writes to buffer
|
||||
bool useA = true; // writing to bufA or bufB
|
||||
bool saving = false; // currently saving onto the SD card
|
||||
|
||||
String fileName = "/0.pcap";
|
||||
File file;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
138
esp32_marauder/CommandLine.cpp
Normal file
138
esp32_marauder/CommandLine.cpp
Normal file
@@ -0,0 +1,138 @@
|
||||
#include "CommandLine.h"
|
||||
|
||||
CommandLine::CommandLine() {
|
||||
}
|
||||
|
||||
void CommandLine::RunSetup() {
|
||||
Serial.print("> ");
|
||||
}
|
||||
|
||||
String CommandLine::getSerialInput() {
|
||||
String input = "";
|
||||
|
||||
if (Serial.available() > 0)
|
||||
input = Serial.readStringUntil('\n');
|
||||
|
||||
input.trim();
|
||||
return input;
|
||||
}
|
||||
|
||||
void CommandLine::main(uint32_t currentTime) {
|
||||
String input = this->getSerialInput();
|
||||
|
||||
this->runCommand(input);
|
||||
|
||||
if (input != "")
|
||||
Serial.print("> ");
|
||||
}
|
||||
|
||||
LinkedList<String> CommandLine::parseCommand(String input) {
|
||||
LinkedList<String> cmd_args;
|
||||
|
||||
if (input != "") {
|
||||
|
||||
char delim[] = " ";
|
||||
|
||||
char fancy[input.length() + 1] = {};
|
||||
input.toCharArray(fancy, input.length() + 1);
|
||||
|
||||
char* ptr = strtok(fancy, delim);
|
||||
|
||||
while (ptr != NULL) {
|
||||
cmd_args.add(String(ptr));
|
||||
|
||||
ptr = strtok(NULL, delim);
|
||||
}
|
||||
|
||||
//memset(fancy, 0, sizeof(fancy));
|
||||
|
||||
// Display the segmented cmd
|
||||
//for (int i = 0; i < cmd_args.size(); i++) {
|
||||
// Serial.println(cmd_args.get(i));
|
||||
//}
|
||||
}
|
||||
|
||||
return cmd_args;
|
||||
}
|
||||
|
||||
int CommandLine::argSearch(LinkedList<String>* cmd_args_list, String key) {
|
||||
for (int i = 0; i < cmd_args_list->size(); i++) {
|
||||
if (cmd_args_list->get(i) == key)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
void CommandLine::runCommand(String input) {
|
||||
if (input != "")
|
||||
Serial.println("#" + input);
|
||||
else
|
||||
return;
|
||||
|
||||
LinkedList<String> cmd_args = this->parseCommand(input);
|
||||
|
||||
//// Admin commands
|
||||
|
||||
// Stop Scan
|
||||
if (cmd_args.get(0) == STOPSCAN_CMD) {
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_OFF);
|
||||
|
||||
// If we don't do this, the text and button coordinates will be off
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.init();
|
||||
menu_function_obj.changeMenu(menu_function_obj.current_menu);
|
||||
#endif
|
||||
}
|
||||
// Channel command
|
||||
else if (cmd_args.get(0) == CH_CMD) {
|
||||
// Search for channel set arg
|
||||
int ch_set = this->argSearch(&cmd_args, "-s");
|
||||
|
||||
if (cmd_args.size() == 1) {
|
||||
Serial.println("Current channel: " + (String)wifi_scan_obj.set_channel);
|
||||
}
|
||||
else if (ch_set != -1) {
|
||||
wifi_scan_obj.set_channel = cmd_args.get(ch_set + 1).toInt();
|
||||
wifi_scan_obj.changeChannel();
|
||||
Serial.println("Set channel: " + (String)wifi_scan_obj.set_channel);
|
||||
}
|
||||
}
|
||||
// Clear APs
|
||||
else if (cmd_args.get(0) == CLEARAP_CMD) {
|
||||
wifi_scan_obj.RunClearAPs();
|
||||
}
|
||||
|
||||
//// WiFi Scan commands
|
||||
if (!wifi_scan_obj.scanning()) {
|
||||
|
||||
// AP Scan
|
||||
if (cmd_args.get(0) == SCANAP_CMD) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_TARGET_AP, TFT_MAGENTA);
|
||||
}
|
||||
// Beacon sniff
|
||||
else if (cmd_args.get(0) == SNIFF_BEACON_CMD) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_AP, TFT_MAGENTA);
|
||||
}
|
||||
// Deauth sniff
|
||||
else if (cmd_args.get(0) == SNIFF_DEAUTH_CMD) {
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
menu_function_obj.drawStatusBar();
|
||||
#endif
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_DEAUTH, TFT_RED);
|
||||
}
|
||||
// PMKID sniff
|
||||
else if (cmd_args.get(0) == SNIFF_PMKID_CMD) {
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_EAPOL, TFT_VIOLET);
|
||||
}
|
||||
}
|
||||
}
|
||||
43
esp32_marauder/CommandLine.h
Normal file
43
esp32_marauder/CommandLine.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef CommandLine_h
|
||||
#define CommandLine_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "MenuFunctions.h"
|
||||
#include "Display.h"
|
||||
#endif
|
||||
|
||||
#include "WiFiScan.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
extern MenuFunctions menu_function_obj;
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
extern WiFiScan wifi_scan_obj;
|
||||
|
||||
// Commands
|
||||
const char PROGMEM CH_CMD[] = "channel";
|
||||
const char PROGMEM SCANAP_CMD[] = "scanap";
|
||||
const char PROGMEM SNIFF_BEACON_CMD[] = "sniffbeacon";
|
||||
const char PROGMEM SNIFF_DEAUTH_CMD[] = "sniffdeauth";
|
||||
const char PROGMEM SNIFF_PMKID_CMD[] = "sniffpmkid";
|
||||
const char PROGMEM STOPSCAN_CMD[] = "stopscan";
|
||||
const char PROGMEM CLEARAP_CMD[] = "clearap";
|
||||
|
||||
class CommandLine {
|
||||
private:
|
||||
String getSerialInput();
|
||||
LinkedList<String> parseCommand(String input);
|
||||
void runCommand(String input);
|
||||
int argSearch(LinkedList<String>* cmd_args, String key);
|
||||
|
||||
public:
|
||||
CommandLine();
|
||||
|
||||
void RunSetup();
|
||||
void main(uint32_t currentTime);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,15 +1,7 @@
|
||||
#include "Display.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
|
||||
/*
|
||||
Big thanks to bodmer for having great TFT and JPEG libraries
|
||||
|
||||
https://github.com/bodmer
|
||||
*/
|
||||
|
||||
//PROGMEM lv_obj_t * slider_label;
|
||||
//PROGMEM lv_obj_t * ta1;
|
||||
//PROGMEM lv_obj_t * ta2;
|
||||
#ifdef HAS_SCREEN
|
||||
|
||||
Display::Display()
|
||||
{
|
||||
@@ -27,118 +19,58 @@ void Display::RunSetup()
|
||||
tft.setRotation(0); // Portrait
|
||||
|
||||
tft.setCursor(0, 0);
|
||||
//tft.setFreeFont(&FreeMonoBold9pt7b);
|
||||
|
||||
// Calibration data
|
||||
//uint16_t calData[5] = { 390, 3516, 253, 3520, 7 }; tft.setRotation(1); // Portrait
|
||||
#ifndef MARAUDER_MINI
|
||||
|
||||
#ifdef TFT_SHIELD
|
||||
uint16_t calData[5] = { 275, 3494, 361, 3528, 4 }; // tft.setRotation(0); // Portrait with TFT Shield
|
||||
Serial.println(F("Using TFT Shield"));
|
||||
#else if defined(TFT_DIY)
|
||||
uint16_t calData[5] = { 339, 3470, 237, 3438, 2 }; // tft.setRotation(0); // Portrait with DIY TFT
|
||||
Serial.println(F("Using TFT DIY"));
|
||||
#endif
|
||||
tft.setTouch(calData);
|
||||
|
||||
#ifdef TFT_SHIELD
|
||||
uint16_t calData[5] = { 275, 3494, 361, 3528, 4 }; // tft.setRotation(0); // Portrait with TFT Shield
|
||||
Serial.println(F("Using TFT Shield"));
|
||||
#else if defined(TFT_DIY)
|
||||
uint16_t calData[5] = { 339, 3470, 237, 3438, 2 }; // tft.setRotation(0); // Portrait with DIY TFT
|
||||
Serial.println(F("Using TFT DIY"));
|
||||
#endif
|
||||
tft.setTouch(calData);
|
||||
|
||||
//tft.fillScreen(TFT_BLACK);
|
||||
clearScreen();
|
||||
|
||||
Serial.println("SPI_FREQUENCY: " + (String)SPI_FREQUENCY);
|
||||
Serial.println("SPI_READ_FREQUENCY: " + (String)SPI_READ_FREQUENCY);
|
||||
Serial.println("SPI_READ_FREQUENCY:" + (String)SPI_READ_FREQUENCY);
|
||||
Serial.println("SPI_TOUCH_FREQUENCY: " + (String)SPI_TOUCH_FREQUENCY);
|
||||
|
||||
|
||||
// Initialize file system
|
||||
// This should probably have its own class
|
||||
if (!SPIFFS.begin()) {
|
||||
Serial.println(F("SPIFFS initialisation failed!"));
|
||||
while (1) yield(); // Stay here twiddling thumbs waiting
|
||||
}
|
||||
|
||||
//this->initLVGL();
|
||||
|
||||
|
||||
// Draw the title screen
|
||||
//drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
|
||||
|
||||
//showCenterText(version_number, 250);
|
||||
//tft.drawCentreString(version_number, 120, 250, 2);
|
||||
|
||||
//digitalWrite(TFT_BL, HIGH);
|
||||
|
||||
//delay(5000);
|
||||
#ifdef KIT
|
||||
pinMode(KIT_LED_BUILTIN, OUTPUT);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Interrupt driven periodic handler */
|
||||
/*
|
||||
void Display::lv_tick_handler()
|
||||
void Display::drawFrame()
|
||||
{
|
||||
lv_tick_inc(LVGL_TICK_PERIOD);
|
||||
}*/
|
||||
|
||||
/* Display flushing */
|
||||
/*
|
||||
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
|
||||
{
|
||||
extern Display display_obj;
|
||||
uint16_t c;
|
||||
|
||||
display_obj.tft.startWrite();
|
||||
display_obj.tft.setAddrWindow(area->x1, area->y1, (area->x2 - area->x1 + 1), (area->y2 - area->y1 + 1));
|
||||
for (int y = area->y1; y <= area->y2; y++) {
|
||||
for (int x = area->x1; x <= area->x2; x++) {
|
||||
c = color_p->full;
|
||||
display_obj.tft.writeColor(c, 1);
|
||||
color_p++;
|
||||
}
|
||||
}
|
||||
display_obj.tft.endWrite();
|
||||
lv_disp_flush_ready(disp);
|
||||
tft.drawRect(FRAME_X, FRAME_Y, FRAME_W, FRAME_H, TFT_BLACK);
|
||||
}
|
||||
|
||||
void Display::tftDrawRedOnOffButton() {
|
||||
tft.fillRect(REDBUTTON_X, REDBUTTON_Y, REDBUTTON_W, REDBUTTON_H, TFT_RED);
|
||||
tft.fillRect(GREENBUTTON_X, GREENBUTTON_Y, GREENBUTTON_W, GREENBUTTON_H, TFT_DARKGREY);
|
||||
drawFrame();
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.setTextSize(2);
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
tft.drawString(text03, GREENBUTTON_X + (GREENBUTTON_W / 2), GREENBUTTON_Y + (GREENBUTTON_H / 2));
|
||||
this->SwitchOn = false;
|
||||
}
|
||||
|
||||
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
|
||||
{
|
||||
extern Display display_obj;
|
||||
|
||||
uint16_t touchX, touchY;
|
||||
|
||||
bool touched = display_obj.tft.getTouch(&touchX, &touchY, 600);
|
||||
|
||||
if(!touched)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(touchX>WIDTH_1 || touchY > HEIGHT_1)
|
||||
{
|
||||
Serial.println("Y or y outside of expected parameters..");
|
||||
Serial.print("y:");
|
||||
Serial.print(touchX);
|
||||
Serial.print(" x:");
|
||||
Serial.print(touchY);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
data->state = touched ? LV_INDEV_STATE_PR : LV_INDEV_STATE_REL;
|
||||
|
||||
//if(data->state == LV_INDEV_STATE_PR) touchpad_get_xy(&last_x, &last_y);
|
||||
|
||||
data->point.x = touchX;
|
||||
data->point.y = touchY;
|
||||
|
||||
Serial.print("Data x");
|
||||
Serial.println(touchX);
|
||||
|
||||
Serial.print("Data y");
|
||||
Serial.println(touchY);
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}*/
|
||||
void Display::tftDrawGreenOnOffButton() {
|
||||
tft.fillRect(GREENBUTTON_X, GREENBUTTON_Y, GREENBUTTON_W, GREENBUTTON_H, TFT_GREEN);
|
||||
tft.fillRect(REDBUTTON_X, REDBUTTON_Y, REDBUTTON_W, REDBUTTON_H, TFT_DARKGREY);
|
||||
drawFrame();
|
||||
tft.setTextColor(TFT_WHITE);
|
||||
tft.setTextSize(2);
|
||||
tft.setTextDatum(MC_DATUM);
|
||||
tft.drawString(text04, REDBUTTON_X + (REDBUTTON_W / 2) + 1, REDBUTTON_Y + (REDBUTTON_H / 2));
|
||||
this->SwitchOn = true;
|
||||
}
|
||||
|
||||
void Display::tftDrawGraphObjects(byte x_scale)
|
||||
{
|
||||
@@ -238,7 +170,7 @@ void Display::tftDrawYScaleButtons(byte y_scale)
|
||||
void Display::tftDrawChannelScaleButtons(int set_channel)
|
||||
{
|
||||
tft.drawFastVLine(178, 0, 20, TFT_WHITE);
|
||||
tft.setCursor(145, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print("Channel:"); tft.print(set_channel);
|
||||
tft.setCursor(145, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print(text10); tft.print(set_channel);
|
||||
|
||||
key[4].initButton(&tft, // channel - box
|
||||
164,
|
||||
@@ -308,7 +240,7 @@ void Display::touchToExit()
|
||||
{
|
||||
tft.setTextColor(TFT_BLACK, TFT_LIGHTGREY);
|
||||
tft.fillRect(0,32,HEIGHT_1,16, TFT_LIGHTGREY);
|
||||
tft.drawCentreString("Touch screen to exit",120,32,2);
|
||||
tft.drawCentreString(text11,120,32,2);
|
||||
}
|
||||
|
||||
|
||||
@@ -417,20 +349,24 @@ void Display::setupScrollArea(uint16_t tfa, uint16_t bfa) {
|
||||
Serial.println(" tfa: " + (String)tfa);
|
||||
Serial.println(" bfa: " + (String)bfa);
|
||||
Serial.println("yStart: " + (String)this->yStart);
|
||||
tft.writecommand(ILI9341_VSCRDEF); // Vertical scroll definition
|
||||
tft.writedata(tfa >> 8); // Top Fixed Area line count
|
||||
tft.writedata(tfa);
|
||||
tft.writedata((YMAX-tfa-bfa)>>8); // Vertical Scrolling Area line count
|
||||
tft.writedata(YMAX-tfa-bfa);
|
||||
tft.writedata(bfa >> 8); // Bottom Fixed Area line count
|
||||
tft.writedata(bfa);
|
||||
#ifndef MARAUDER_MINI
|
||||
tft.writecommand(ILI9341_VSCRDEF); // Vertical scroll definition
|
||||
tft.writedata(tfa >> 8); // Top Fixed Area line count
|
||||
tft.writedata(tfa);
|
||||
tft.writedata((YMAX-tfa-bfa)>>8); // Vertical Scrolling Area line count
|
||||
tft.writedata(YMAX-tfa-bfa);
|
||||
tft.writedata(bfa >> 8); // Bottom Fixed Area line count
|
||||
tft.writedata(bfa);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Display::scrollAddress(uint16_t vsp) {
|
||||
tft.writecommand(ILI9341_VSCRSADD); // Vertical scrolling pointer
|
||||
tft.writedata(vsp>>8);
|
||||
tft.writedata(vsp);
|
||||
#ifndef MARAUDER_MINI
|
||||
tft.writecommand(ILI9341_VSCRSADD); // Vertical scrolling pointer
|
||||
tft.writedata(vsp>>8);
|
||||
tft.writedata(vsp);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -440,18 +376,21 @@ void Display::scrollAddress(uint16_t vsp) {
|
||||
void Display::drawJpeg(const char *filename, int xpos, int ypos) {
|
||||
|
||||
// Open the named file (the Jpeg decoder library will close it after rendering image)
|
||||
fs::File jpegFile = SPIFFS.open( filename, "r"); // File handle reference for SPIFFS
|
||||
//fs::File jpegFile = SPIFFS.open( filename, "r"); // File handle reference for SPIFFS
|
||||
|
||||
//jpegFile.close();
|
||||
|
||||
//ESP32 always seems to return 1 for jpegFile so this null trap does not work
|
||||
if ( !jpegFile ) {
|
||||
Serial.print("ERROR: File \""); Serial.print(filename); Serial.println ("\" not found!");
|
||||
return;
|
||||
}
|
||||
//if ( !jpegFile ) {
|
||||
// Serial.print("ERROR: File \""); Serial.print(filename); Serial.println ("\" not found!");
|
||||
// return;
|
||||
//}
|
||||
|
||||
// Use one of the three following methods to initialise the decoder,
|
||||
// the filename can be a String or character array type:
|
||||
|
||||
boolean decoded = JpegDec.decodeFsFile(filename); // or pass the filename (leading / distinguishes SPIFFS files)
|
||||
//boolean decoded = JpegDec.decodeFsFile(filename); // or pass the filename (leading / distinguishes SPIFFS files)
|
||||
boolean decoded = JpegDec.decodeArray(MarauderTitle, 13578);
|
||||
|
||||
if (decoded) {
|
||||
// print information about the image to the serial port
|
||||
@@ -615,7 +554,7 @@ void Display::jpegRender(int xpos, int ypos) {
|
||||
// Print information decoded from the Jpeg image
|
||||
//====================================================================================
|
||||
void Display::jpegInfo() {
|
||||
/*
|
||||
|
||||
Serial.println("===============");
|
||||
Serial.println("JPEG image info");
|
||||
Serial.println("===============");
|
||||
@@ -629,7 +568,7 @@ void Display::jpegInfo() {
|
||||
Serial.print ("MCU height :"); Serial.println(JpegDec.MCUHeight);
|
||||
Serial.println("===============");
|
||||
Serial.println("");
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
//====================================================================================
|
||||
@@ -806,7 +745,7 @@ void Display::buildBanner(String msg, int xpos)
|
||||
//img.fillCircle(SCREEN_WIDTH / 2, TEXT_HEIGHT / 2, 10, TFT_ORANGE);
|
||||
|
||||
// Now print text on top of the graphics
|
||||
img.setTextSize(2); // Font size scaling is x1
|
||||
img.setTextSize(BANNER_TEXT_SIZE); // Font size scaling is x1
|
||||
img.setTextFont(0); // Font 4 selected
|
||||
img.setTextColor(TFT_WHITE); // Black text, no background colour
|
||||
img.setTextWrap(false); // Turn of wrap so we can print past end of sprite
|
||||
@@ -819,112 +758,6 @@ void Display::buildBanner(String msg, int xpos)
|
||||
img.print(msg);
|
||||
}
|
||||
|
||||
/*
|
||||
void Display::initLVGL() {
|
||||
tick.attach_ms(LVGL_TICK_PERIOD, lv_tick_handler);
|
||||
|
||||
lv_init();
|
||||
|
||||
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10);
|
||||
|
||||
lv_disp_drv_t disp_drv;
|
||||
lv_disp_drv_init(&disp_drv);
|
||||
disp_drv.hor_res = WIDTH_1;
|
||||
disp_drv.ver_res = HEIGHT_1;
|
||||
disp_drv.flush_cb = my_disp_flush;
|
||||
disp_drv.buffer = &disp_buf;
|
||||
lv_disp_drv_register(&disp_drv);
|
||||
|
||||
lv_indev_drv_t indev_drv;
|
||||
lv_indev_drv_init(&indev_drv);
|
||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||
indev_drv.read_cb = my_touchpad_read;
|
||||
lv_indev_drv_register(&indev_drv);
|
||||
}
|
||||
|
||||
|
||||
void Display::deinitLVGL() {
|
||||
Serial.println(F("Deinit LVGL"));
|
||||
//lv_deinit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Display::joinWiFiGFX(){
|
||||
|
||||
// Create one text area
|
||||
ta1 = lv_textarea_create(lv_scr_act(), NULL);
|
||||
lv_textarea_set_one_line(ta1, true);
|
||||
lv_obj_set_width(ta1, LV_HOR_RES / 2 - 20);
|
||||
lv_obj_set_pos(ta1, 5, 20);
|
||||
//lv_ta_set_cursor_type(ta, LV_CURSOR_BLOCK);
|
||||
lv_textarea_set_text(ta1, "");
|
||||
lv_obj_set_event_cb(ta1, ta_event_cb);
|
||||
|
||||
// Create first label
|
||||
lv_obj_t * ssid_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(ssid_label, "SSID:");
|
||||
lv_obj_align(ssid_label, ta1, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
|
||||
// Create second text area
|
||||
ta2 = lv_textarea_create(lv_scr_act(), ta1);
|
||||
//lv_textarea_set_pwd_mode(ta2, true); // This shit makes it so backspace does not work
|
||||
//lv_textarea_set_pwd_show_time(ta2, 1000);
|
||||
lv_textarea_set_cursor_hidden(ta2, true);
|
||||
lv_obj_align(ta2, NULL, LV_ALIGN_IN_TOP_RIGHT, -5, 20);
|
||||
|
||||
// Create second label
|
||||
lv_obj_t * pw_label = lv_label_create(lv_scr_act(), NULL);
|
||||
lv_label_set_text(pw_label, "Password:");
|
||||
lv_obj_align(pw_label, ta2, LV_ALIGN_OUT_TOP_LEFT, 0, 0);
|
||||
|
||||
// Create a keyboard and apply the styles
|
||||
kb = lv_keyboard_create(lv_scr_act(), NULL);
|
||||
lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2);
|
||||
lv_obj_set_event_cb(kb, keyboard_event_cb);
|
||||
|
||||
// Focus it on one of the text areas to start
|
||||
lv_keyboard_set_textarea(kb, ta1);
|
||||
lv_keyboard_set_cursor_manage(kb, true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event){
|
||||
extern Display display_obj;
|
||||
lv_keyboard_def_event_cb(kb, event);
|
||||
if(event == LV_EVENT_APPLY){
|
||||
printf("LV_EVENT_APPLY\n");
|
||||
//String ta1_text = lv_textarea_get_text(lv_keyboard_get_textarea(kb));
|
||||
String ta1_text = lv_textarea_get_text(ta1);
|
||||
String ta2_text = lv_textarea_get_text(ta2);
|
||||
Serial.println(ta1_text);
|
||||
Serial.println(ta2_text);
|
||||
//joinWiFi(ta1_text, ta2_text);
|
||||
}else if(event == LV_EVENT_CANCEL){
|
||||
printf("LV_EVENT_CANCEL\n");
|
||||
//lv_textarea_set_text(lv_keyboard_get_textarea(kb), "");
|
||||
display_obj.deinitLVGL();
|
||||
display_obj.exit_draw = true; // set everything back to normal
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ta_event_cb(lv_obj_t * ta, lv_event_t event)
|
||||
{
|
||||
if(event == LV_EVENT_CLICKED) {
|
||||
if(kb != NULL)
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
}
|
||||
|
||||
//else if(event == LV_EVENT_INSERT) {
|
||||
// const char * str = lv_event_get_data();
|
||||
// if(str[0] == '\n') {
|
||||
// printf("Ready\n");
|
||||
// }
|
||||
//}
|
||||
}*/
|
||||
|
||||
void Display::main(uint8_t scan_mode)
|
||||
{
|
||||
if ((scan_mode == LV_JOIN_WIFI) ||
|
||||
@@ -933,3 +766,5 @@ void Display::main(uint8_t scan_mode)
|
||||
return;
|
||||
}
|
||||
// End SPIFFS_functions
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,179 +1,157 @@
|
||||
#ifndef Display_h
|
||||
#define Display_h
|
||||
|
||||
|
||||
#include <FS.h>
|
||||
#include <functional>
|
||||
#include <JPEGDecoder.h>
|
||||
//#include <SimpleList.h>
|
||||
#include <LinkedList.h>
|
||||
#include <SPI.h>
|
||||
#include <lvgl.h>
|
||||
#include <Ticker.h>
|
||||
//#include <M5Stack.h>
|
||||
#include "SPIFFS.h"
|
||||
#include "Assets.h"
|
||||
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
#define TFT_MISO 19
|
||||
#define TFT_MOSI 23
|
||||
#define TFT_SCLK 18
|
||||
#define TFT_CS 27
|
||||
#define TFT_DC 26
|
||||
#define TFT_RST 5
|
||||
#define TFT_BL 32
|
||||
#define TOUCH_CS 21
|
||||
#define SD_CS 4
|
||||
|
||||
// WiFi stuff
|
||||
#define OTA_UPDATE 100
|
||||
#define SHOW_INFO 101
|
||||
#define WIFI_SCAN_OFF 0
|
||||
#define WIFI_SCAN_PROBE 1
|
||||
#define WIFI_SCAN_AP 2
|
||||
#define WIFI_SCAN_PWN 3
|
||||
#define WIFI_SCAN_EAPOL 4
|
||||
#define WIFI_SCAN_DEAUTH 5
|
||||
#define WIFI_SCAN_ALL 6
|
||||
#define WIFI_PACKET_MONITOR 7
|
||||
#define WIFI_ATTACK_BEACON_SPAM 8
|
||||
#define WIFI_ATTACK_RICK_ROLL 9
|
||||
#define BT_SCAN_ALL 10
|
||||
#define BT_SCAN_SKIMMERS 11
|
||||
#define WIFI_SCAN_ESPRESSIF 12
|
||||
#define LV_JOIN_WIFI 13
|
||||
#define LV_ADD_SSID 14
|
||||
#define WIFI_ATTACK_BEACON_LIST 15
|
||||
|
||||
#define TFT_SHIELD
|
||||
//#define TFT_DIY
|
||||
|
||||
#define SCREEN_WIDTH 240
|
||||
#define SCREEN_HEIGHT 320
|
||||
#define HEIGHT_1 240
|
||||
#define WIDTH_1 320
|
||||
#define STANDARD_FONT_CHAR_LIMIT 40 // number of characters on a single line with normal font
|
||||
#define TEXT_HEIGHT 16 // Height of text to be printed and scrolled
|
||||
#define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen)
|
||||
#define TOP_FIXED_AREA 48 // Number of lines in top fixed area (lines counted from top of screen)
|
||||
#define YMAX 320 // Bottom of screen area
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
//#define MENU_FONT NULL
|
||||
#define MENU_FONT &FreeMono9pt7b // Winner
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 9
|
||||
#define STATUS_BAR_WIDTH 16
|
||||
#define LVGL_TICK_PERIOD 6
|
||||
|
||||
#define STATUSBAR_COLOR 0x4A49
|
||||
|
||||
/*
|
||||
PROGMEM void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
|
||||
PROGMEM bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
|
||||
|
||||
PROGMEM static lv_disp_buf_t disp_buf;
|
||||
PROGMEM static lv_color_t buf[LV_HOR_RES_MAX * 10];
|
||||
|
||||
PROGMEM static void ta_event_cb(lv_obj_t * ta, lv_event_t event);
|
||||
PROGMEM static void keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
|
||||
// lvgl stuff
|
||||
PROGMEM static lv_obj_t *kb;
|
||||
*/
|
||||
|
||||
class Display
|
||||
{
|
||||
private:
|
||||
|
||||
bool run_setup = true;
|
||||
|
||||
// For the byte we read from the serial port
|
||||
byte data = 0;
|
||||
|
||||
// A few test variables used during debugging
|
||||
boolean change_colour = 1;
|
||||
boolean selected = 1;
|
||||
|
||||
//void addNodes(Menu* menu, String name, Menu* child, std::function<void()> callable);
|
||||
//void changeMenu(Menu* menu);
|
||||
//void showMenuList(Menu* menu, int layer);
|
||||
//static void lv_tick_handler();
|
||||
|
||||
public:
|
||||
Display();
|
||||
//Ticker tick;
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
TFT_eSprite img = TFT_eSprite(&tft);
|
||||
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
const String PROGMEM version_number = "v0.9.1";
|
||||
|
||||
bool printing = false;
|
||||
bool loading = false;
|
||||
bool tteBar = false;
|
||||
bool draw_tft = false;
|
||||
bool exit_draw = false;
|
||||
|
||||
int TOP_FIXED_AREA_2 = 48;
|
||||
int print_delay_1, print_delay_2 = 10;
|
||||
int current_banner_pos = SCREEN_WIDTH;
|
||||
|
||||
//Menu* current_menu;
|
||||
|
||||
//Menu mainMenu;
|
||||
//Menu wifiMenu;
|
||||
//Menu bluetoothMenu;
|
||||
|
||||
LinkedList<String>* display_buffer;
|
||||
|
||||
// The initial y coordinate of the top of the bottom text line
|
||||
uint16_t yDraw = YMAX - BOT_FIXED_AREA - TEXT_HEIGHT;
|
||||
|
||||
// Keep track of the drawing x coordinate
|
||||
uint16_t xPos = 0;
|
||||
|
||||
// The initial y coordinate of the top of the scrolling area
|
||||
uint16_t yStart = TOP_FIXED_AREA_2;
|
||||
// yArea must be a integral multiple of TEXT_HEIGHT
|
||||
uint16_t yArea = YMAX - TOP_FIXED_AREA_2 - BOT_FIXED_AREA;
|
||||
|
||||
// We have to blank the top line each time the display is scrolled, but this takes up to 13 milliseconds
|
||||
// for a full width line, meanwhile the serial buffer may be filling... and overflowing
|
||||
// We can speed up scrolling of short text lines by just blanking the character we drew
|
||||
int blank[19]; // We keep all the strings pixel lengths to optimise the speed of the top line blanking
|
||||
|
||||
//void initLVGL();
|
||||
//void deinitLVGL();
|
||||
//void joinWiFiGFX();
|
||||
void tftDrawGraphObjects(byte x_scale);
|
||||
void tftDrawEapolColorKey();
|
||||
void tftDrawColorKey();
|
||||
void tftDrawXScaleButtons(byte x_scale);
|
||||
void tftDrawYScaleButtons(byte y_scale);
|
||||
void tftDrawChannelScaleButtons(int set_channel);
|
||||
void tftDrawExitScaleButtons();
|
||||
void buildBanner(String msg, int xpos);
|
||||
void clearScreen();
|
||||
void displayBuffer(bool do_clear = false);
|
||||
void drawJpeg(const char *filename, int xpos, int ypos);
|
||||
void setupDraw();
|
||||
void drawStylus();
|
||||
void getTouchWhileFunction(bool pressed);
|
||||
void initScrollValues(bool tte = false);
|
||||
void jpegInfo();
|
||||
void jpegRender(int xpos, int ypos);
|
||||
void listDir(fs::FS &fs, const char * dirname, uint8_t levels);
|
||||
void listFiles();
|
||||
void main(uint8_t scan_mode);
|
||||
void RunSetup();
|
||||
void scrollAddress(uint16_t vsp);
|
||||
int scroll_line(uint32_t color);
|
||||
void setupScrollArea(uint16_t tfa, uint16_t bfa);
|
||||
void showCenterText(String text, int y);
|
||||
void touchToExit();
|
||||
void twoPartDisplay(String center_text);
|
||||
void updateBanner(String msg);
|
||||
};
|
||||
#endif
|
||||
#ifndef Display_h
|
||||
#define Display_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
|
||||
#include <FS.h>
|
||||
#include <functional>
|
||||
#include <JPEGDecoder.h>
|
||||
//#include <SimpleList.h>
|
||||
#include <LinkedList.h>
|
||||
#include <SPI.h>
|
||||
#include <lvgl.h>
|
||||
#include <Ticker.h>
|
||||
//#include <M5Stack.h>
|
||||
#include "SPIFFS.h"
|
||||
#include "Assets.h"
|
||||
|
||||
#include <TFT_eSPI.h>
|
||||
|
||||
// WiFi stuff
|
||||
#define OTA_UPDATE 100
|
||||
#define SHOW_INFO 101
|
||||
#define WIFI_SCAN_OFF 0
|
||||
#define WIFI_SCAN_PROBE 1
|
||||
#define WIFI_SCAN_AP 2
|
||||
#define WIFI_SCAN_PWN 3
|
||||
#define WIFI_SCAN_EAPOL 4
|
||||
#define WIFI_SCAN_DEAUTH 5
|
||||
#define WIFI_SCAN_ALL 6
|
||||
#define WIFI_PACKET_MONITOR 7
|
||||
#define WIFI_ATTACK_BEACON_SPAM 8
|
||||
#define WIFI_ATTACK_RICK_ROLL 9
|
||||
#define BT_SCAN_ALL 10
|
||||
#define BT_SCAN_SKIMMERS 11
|
||||
#define WIFI_SCAN_ESPRESSIF 12
|
||||
#define LV_JOIN_WIFI 13
|
||||
#define LV_ADD_SSID 14
|
||||
#define WIFI_ATTACK_BEACON_LIST 15
|
||||
|
||||
/*
|
||||
PROGMEM void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
|
||||
PROGMEM bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
|
||||
|
||||
PROGMEM static lv_disp_buf_t disp_buf;
|
||||
PROGMEM static lv_color_t buf[LV_HOR_RES_MAX * 10];
|
||||
|
||||
PROGMEM static void ta_event_cb(lv_obj_t * ta, lv_event_t event);
|
||||
PROGMEM static void keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
|
||||
// lvgl stuff
|
||||
PROGMEM static lv_obj_t *kb;
|
||||
*/
|
||||
|
||||
// #define KIT
|
||||
// #define TFT_DIY
|
||||
|
||||
class Display
|
||||
{
|
||||
private:
|
||||
bool SwitchOn = false;
|
||||
|
||||
bool run_setup = true;
|
||||
|
||||
// For the byte we read from the serial port
|
||||
byte data = 0;
|
||||
|
||||
// A few test variables used during debugging
|
||||
boolean change_colour = 1;
|
||||
boolean selected = 1;
|
||||
|
||||
void drawFrame();
|
||||
|
||||
//void addNodes(Menu* menu, String name, Menu* child, std::function<void()> callable);
|
||||
//void changeMenu(Menu* menu);
|
||||
//void showMenuList(Menu* menu, int layer);
|
||||
//static void lv_tick_handler();
|
||||
|
||||
public:
|
||||
Display();
|
||||
//Ticker tick;
|
||||
TFT_eSPI tft = TFT_eSPI();
|
||||
TFT_eSprite img = TFT_eSprite(&tft);
|
||||
TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
const String PROGMEM version_number = MARAUDER_VERSION;
|
||||
|
||||
bool printing = false;
|
||||
bool loading = false;
|
||||
bool tteBar = false;
|
||||
bool draw_tft = false;
|
||||
bool exit_draw = false;
|
||||
|
||||
int TOP_FIXED_AREA_2 = 48;
|
||||
int print_delay_1, print_delay_2 = 10;
|
||||
int current_banner_pos = SCREEN_WIDTH;
|
||||
|
||||
//Menu* current_menu;
|
||||
|
||||
//Menu mainMenu;
|
||||
//Menu wifiMenu;
|
||||
//Menu bluetoothMenu;
|
||||
|
||||
LinkedList<String>* display_buffer;
|
||||
|
||||
// The initial y coordinate of the top of the bottom text line
|
||||
uint16_t yDraw = YMAX - BOT_FIXED_AREA - TEXT_HEIGHT;
|
||||
|
||||
// Keep track of the drawing x coordinate
|
||||
uint16_t xPos = 0;
|
||||
|
||||
// The initial y coordinate of the top of the scrolling area
|
||||
uint16_t yStart = TOP_FIXED_AREA_2;
|
||||
// yArea must be a integral multiple of TEXT_HEIGHT
|
||||
uint16_t yArea = YMAX - TOP_FIXED_AREA_2 - BOT_FIXED_AREA;
|
||||
|
||||
// We have to blank the top line each time the display is scrolled, but this takes up to 13 milliseconds
|
||||
// for a full width line, meanwhile the serial buffer may be filling... and overflowing
|
||||
// We can speed up scrolling of short text lines by just blanking the character we drew
|
||||
int blank[19]; // We keep all the strings pixel lengths to optimise the speed of the top line blanking
|
||||
|
||||
//void initLVGL();
|
||||
//void deinitLVGL();
|
||||
//void joinWiFiGFX();
|
||||
void tftDrawRedOnOffButton();
|
||||
void tftDrawGreenOnOffButton();
|
||||
void tftDrawGraphObjects(byte x_scale);
|
||||
void tftDrawEapolColorKey();
|
||||
void tftDrawColorKey();
|
||||
void tftDrawXScaleButtons(byte x_scale);
|
||||
void tftDrawYScaleButtons(byte y_scale);
|
||||
void tftDrawChannelScaleButtons(int set_channel);
|
||||
void tftDrawExitScaleButtons();
|
||||
void buildBanner(String msg, int xpos);
|
||||
void clearScreen();
|
||||
void displayBuffer(bool do_clear = false);
|
||||
void drawJpeg(const char *filename, int xpos, int ypos);
|
||||
void setupDraw();
|
||||
void drawStylus();
|
||||
void getTouchWhileFunction(bool pressed);
|
||||
void initScrollValues(bool tte = false);
|
||||
void jpegInfo();
|
||||
void jpegRender(int xpos, int ypos);
|
||||
void listDir(fs::FS &fs, const char * dirname, uint8_t levels);
|
||||
void listFiles();
|
||||
void main(uint8_t scan_mode);
|
||||
void RunSetup();
|
||||
void scrollAddress(uint16_t vsp);
|
||||
int scroll_line(uint32_t color);
|
||||
void setupScrollArea(uint16_t tfa, uint16_t bfa);
|
||||
void showCenterText(String text, int y);
|
||||
void touchToExit();
|
||||
void twoPartDisplay(String center_text);
|
||||
void updateBanner(String msg);
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,207 +1,221 @@
|
||||
#ifndef MenuFunctions_h
|
||||
#define MenuFunctions_h
|
||||
|
||||
#define BATTERY_ANALOG_ON 0
|
||||
|
||||
#include "WiFiScan.h"
|
||||
#include "Display.h"
|
||||
#include "BatteryInterface.h"
|
||||
#include "SDInterface.h"
|
||||
#include "Web.h"
|
||||
#include "esp_interface.h"
|
||||
#include "a32u4_interface.h"
|
||||
|
||||
|
||||
extern Display display_obj;
|
||||
extern WiFiScan wifi_scan_obj;
|
||||
extern Web web_obj;
|
||||
extern SDInterface sd_obj;
|
||||
extern BatteryInterface battery_obj;
|
||||
extern EspInterface esp_obj;
|
||||
extern A32u4Interface a32u4_obj;
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X 120 // Centre of key
|
||||
#define KEY_Y 50
|
||||
#define KEY_W 240 // Width and height
|
||||
#define KEY_H 22
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 22
|
||||
//#define BUTTON_ARRAY_LEN 5
|
||||
|
||||
#define FLASH_BUTTON 0
|
||||
|
||||
#if BATTERY_ANALOG_ON == 1
|
||||
#define BATTERY_PIN 13
|
||||
#define ANALOG_PIN 34
|
||||
#define CHARGING_PIN 27
|
||||
#endif
|
||||
|
||||
// Icon definitions
|
||||
#define ATTACKS 0
|
||||
#define BEACON_SNIFF 1
|
||||
#define BLUETOOTH 2
|
||||
#define BLUETOOTH_SNIFF 3
|
||||
#define DEAUTH_SNIFF 4
|
||||
#define DRAW 5
|
||||
#define PACKET_MONITOR 6
|
||||
#define PROBE_SNIFF 7
|
||||
#define SCANNERS 8
|
||||
#define CC_SKIMMERS 9
|
||||
#define SNIFFERS 10
|
||||
#define WIFI 11
|
||||
#define BEACON_SPAM 12
|
||||
#define RICK_ROLL 13
|
||||
#define REBOOT 14
|
||||
#define GENERAL_APPS 15
|
||||
#define UPDATE 16
|
||||
#define DEVICE 17
|
||||
#define DEVICE_INFO 18
|
||||
#define SD_UPDATE 19
|
||||
#define WEB_UPDATE 20
|
||||
#define EAPOL 21
|
||||
#define STATUS_BAT 22
|
||||
#define STATUS_SD 23
|
||||
#define PWNAGOTCHI 24
|
||||
#define ESPRESSIF 25
|
||||
#define SHUTDOWN 26
|
||||
#define BEACON_LIST 27
|
||||
#define GENERATE 28
|
||||
#define CLEAR_ICO 29
|
||||
#define KEYBOARD_ICO 30
|
||||
#define JOIN_WIFI 31
|
||||
#define ESP_UPDATE_ICO 32
|
||||
#define BAD_USB_ICO 33
|
||||
#define TEST_BAD_USB_ICO 34
|
||||
|
||||
PROGMEM void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
|
||||
PROGMEM bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
|
||||
|
||||
PROGMEM static lv_disp_buf_t disp_buf;
|
||||
PROGMEM static lv_color_t buf[LV_HOR_RES_MAX * 10];
|
||||
|
||||
PROGMEM static void ta_event_cb(lv_obj_t * ta, lv_event_t event);
|
||||
PROGMEM static void join_wifi_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
PROGMEM static void add_ssid_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
PROGMEM static void write_bad_usb_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
PROGMEM static void load_btn_cb(lv_obj_t * load_btn, lv_event_t event);
|
||||
PROGMEM static void test_btn_cb(lv_obj_t * load_btn, lv_event_t event);
|
||||
PROGMEM static void ap_list_cb(lv_obj_t * btn, lv_event_t event);
|
||||
PROGMEM static void save_as_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
|
||||
// lvgl stuff
|
||||
PROGMEM static lv_obj_t *kb;
|
||||
PROGMEM static lv_obj_t * save_as_kb;
|
||||
|
||||
struct Menu;
|
||||
|
||||
// Individual Nodes of a menu
|
||||
|
||||
struct MenuNode {
|
||||
String name;
|
||||
uint16_t color;
|
||||
int icon;
|
||||
TFT_eSPI_Button* button;
|
||||
std::function<void()> callable;
|
||||
};
|
||||
|
||||
// Full Menus
|
||||
struct Menu {
|
||||
String name;
|
||||
LinkedList<MenuNode>* list;
|
||||
Menu * parentMenu;
|
||||
//uint8_t selected;
|
||||
};
|
||||
|
||||
|
||||
class MenuFunctions
|
||||
{
|
||||
private:
|
||||
|
||||
String u_result = "";
|
||||
|
||||
uint32_t initTime = 0;
|
||||
|
||||
//Menu* current_menu;
|
||||
|
||||
// Main menu stuff
|
||||
Menu mainMenu;
|
||||
|
||||
Menu wifiMenu;
|
||||
Menu bluetoothMenu;
|
||||
Menu badusbMenu;
|
||||
Menu generalMenu;
|
||||
Menu deviceMenu;
|
||||
|
||||
// Device menu stuff
|
||||
Menu whichUpdateMenu;
|
||||
Menu failedUpdateMenu;
|
||||
Menu confirmMenu;
|
||||
Menu espUpdateMenu;
|
||||
Menu updateMenu;
|
||||
Menu infoMenu;
|
||||
|
||||
// WiFi menu stuff
|
||||
Menu wifiSnifferMenu;
|
||||
Menu wifiAttackMenu;
|
||||
Menu wifiGeneralMenu;
|
||||
|
||||
// Bluetooth menu stuff
|
||||
Menu bluetoothSnifferMenu;
|
||||
Menu bluetoothGeneralMenu;
|
||||
|
||||
// Settings things menus
|
||||
Menu shutdownWiFiMenu;
|
||||
Menu shutdownBLEMenu;
|
||||
Menu generateSSIDsMenu;
|
||||
Menu clearSSIDsMenu;
|
||||
Menu clearAPsMenu;
|
||||
|
||||
static void lv_tick_handler();
|
||||
|
||||
// Menu icons
|
||||
|
||||
|
||||
//TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
|
||||
void addNodes(Menu* menu, String name, uint16_t color, Menu* child, int place, std::function<void()> callable);
|
||||
void drawStatusBar();
|
||||
void updateStatusBar();
|
||||
void battery(bool initial = false);
|
||||
void battery2(bool initial = false);
|
||||
void showMenuList(Menu* menu, int layer);
|
||||
|
||||
public:
|
||||
MenuFunctions();
|
||||
|
||||
Menu* current_menu;
|
||||
|
||||
Ticker tick;
|
||||
|
||||
uint16_t x = -1, y = -1;
|
||||
boolean pressed = false;
|
||||
|
||||
String loaded_file = "";
|
||||
|
||||
void initLVGL();
|
||||
void deinitLVGL();
|
||||
void joinWiFiGFX();
|
||||
void addSSIDGFX();
|
||||
void addAPGFX();
|
||||
void writeBadUSB();
|
||||
|
||||
void buildButtons(Menu* menu);
|
||||
void changeMenu(Menu* menu);
|
||||
void displayCurrentMenu();
|
||||
void main(uint32_t currentTime);
|
||||
void RunSetup();
|
||||
void orientDisplay();
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef MenuFunctions_h
|
||||
#define MenuFunctions_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
|
||||
#define BATTERY_ANALOG_ON 0
|
||||
|
||||
#include "WiFiScan.h"
|
||||
#include "Display.h"
|
||||
#include "BatteryInterface.h"
|
||||
#include "SDInterface.h"
|
||||
#include "Web.h"
|
||||
#include "esp_interface.h"
|
||||
#include "a32u4_interface.h"
|
||||
#include "settings.h"
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#include <SwitchLib.h>
|
||||
extern SwitchLib u_btn;
|
||||
extern SwitchLib d_btn;
|
||||
extern SwitchLib l_btn;
|
||||
extern SwitchLib r_btn;
|
||||
extern SwitchLib c_btn;
|
||||
#endif
|
||||
|
||||
extern Display display_obj;
|
||||
extern WiFiScan wifi_scan_obj;
|
||||
extern Web web_obj;
|
||||
extern SDInterface sd_obj;
|
||||
extern BatteryInterface battery_obj;
|
||||
extern EspInterface esp_obj;
|
||||
extern A32u4Interface a32u4_obj;
|
||||
extern Settings settings_obj;
|
||||
|
||||
#define FLASH_BUTTON 0
|
||||
|
||||
#if BATTERY_ANALOG_ON == 1
|
||||
#define BATTERY_PIN 13
|
||||
#define ANALOG_PIN 34
|
||||
#define CHARGING_PIN 27
|
||||
#endif
|
||||
|
||||
// Icon definitions
|
||||
#define ATTACKS 0
|
||||
#define BEACON_SNIFF 1
|
||||
#define BLUETOOTH 2
|
||||
#define BLUETOOTH_SNIFF 3
|
||||
#define DEAUTH_SNIFF 4
|
||||
#define DRAW 5
|
||||
#define PACKET_MONITOR 6
|
||||
#define PROBE_SNIFF 7
|
||||
#define SCANNERS 8
|
||||
#define CC_SKIMMERS 9
|
||||
#define SNIFFERS 10
|
||||
#define WIFI 11
|
||||
#define BEACON_SPAM 12
|
||||
#define RICK_ROLL 13
|
||||
#define REBOOT 14
|
||||
#define GENERAL_APPS 15
|
||||
#define UPDATE 16
|
||||
#define DEVICE 17
|
||||
#define DEVICE_INFO 18
|
||||
#define SD_UPDATE 19
|
||||
#define WEB_UPDATE 20
|
||||
#define EAPOL 21
|
||||
#define STATUS_BAT 22
|
||||
#define STATUS_SD 23
|
||||
#define PWNAGOTCHI 24
|
||||
#define ESPRESSIF 25
|
||||
#define SHUTDOWN 26
|
||||
#define BEACON_LIST 27
|
||||
#define GENERATE 28
|
||||
#define CLEAR_ICO 29
|
||||
#define KEYBOARD_ICO 30
|
||||
#define JOIN_WIFI 31
|
||||
#define ESP_UPDATE_ICO 32
|
||||
#define BAD_USB_ICO 33
|
||||
#define TEST_BAD_USB_ICO 34
|
||||
#define LANGUAGE 35
|
||||
|
||||
PROGMEM void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p);
|
||||
PROGMEM bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
|
||||
|
||||
PROGMEM static lv_disp_buf_t disp_buf;
|
||||
PROGMEM static lv_color_t buf[LV_HOR_RES_MAX * 10];
|
||||
|
||||
PROGMEM static void ta_event_cb(lv_obj_t * ta, lv_event_t event);
|
||||
PROGMEM static void join_wifi_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
PROGMEM static void add_ssid_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
PROGMEM static void write_bad_usb_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
PROGMEM static void load_btn_cb(lv_obj_t * load_btn, lv_event_t event);
|
||||
PROGMEM static void test_btn_cb(lv_obj_t * load_btn, lv_event_t event);
|
||||
PROGMEM static void ap_list_cb(lv_obj_t * btn, lv_event_t event);
|
||||
PROGMEM static void setting_dropdown_cb(lv_obj_t * btn, lv_event_t event);
|
||||
PROGMEM static void save_as_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
|
||||
|
||||
// lvgl stuff
|
||||
PROGMEM static lv_obj_t *kb;
|
||||
PROGMEM static lv_obj_t * save_as_kb;
|
||||
|
||||
struct Menu;
|
||||
|
||||
// Individual Nodes of a menu
|
||||
|
||||
struct MenuNode {
|
||||
String name;
|
||||
String command;
|
||||
uint16_t color;
|
||||
int icon;
|
||||
TFT_eSPI_Button* button;
|
||||
bool selected;
|
||||
std::function<void()> callable;
|
||||
};
|
||||
|
||||
// Full Menus
|
||||
struct Menu {
|
||||
String name;
|
||||
LinkedList<MenuNode>* list;
|
||||
Menu * parentMenu;
|
||||
uint8_t selected = 0;
|
||||
};
|
||||
|
||||
|
||||
class MenuFunctions
|
||||
{
|
||||
private:
|
||||
|
||||
String u_result = "";
|
||||
|
||||
uint32_t initTime = 0;
|
||||
|
||||
//Menu* current_menu;
|
||||
|
||||
// Main menu stuff
|
||||
Menu mainMenu;
|
||||
|
||||
Menu wifiMenu;
|
||||
Menu bluetoothMenu;
|
||||
Menu badusbMenu;
|
||||
Menu generalMenu;
|
||||
Menu deviceMenu;
|
||||
|
||||
// Device menu stuff
|
||||
Menu whichUpdateMenu;
|
||||
Menu failedUpdateMenu;
|
||||
Menu confirmMenu;
|
||||
Menu espUpdateMenu;
|
||||
Menu updateMenu;
|
||||
Menu settingsMenu;
|
||||
Menu specSettingMenu;
|
||||
Menu infoMenu;
|
||||
Menu languageMenu;
|
||||
|
||||
// WiFi menu stuff
|
||||
Menu wifiSnifferMenu;
|
||||
Menu wifiAttackMenu;
|
||||
Menu wifiGeneralMenu;
|
||||
|
||||
// Bluetooth menu stuff
|
||||
Menu bluetoothSnifferMenu;
|
||||
Menu bluetoothGeneralMenu;
|
||||
|
||||
// Settings things menus
|
||||
Menu shutdownWiFiMenu;
|
||||
Menu shutdownBLEMenu;
|
||||
Menu generateSSIDsMenu;
|
||||
Menu clearSSIDsMenu;
|
||||
Menu clearAPsMenu;
|
||||
|
||||
static void lv_tick_handler();
|
||||
|
||||
// Menu icons
|
||||
|
||||
|
||||
//TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||
|
||||
void addNodes(Menu* menu, String name, uint16_t color, Menu* child, int place, std::function<void()> callable, bool selected = false, String command = "");
|
||||
void updateStatusBar();
|
||||
void battery(bool initial = false);
|
||||
void battery2(bool initial = false);
|
||||
void showMenuList(Menu* menu, int layer);
|
||||
String callSetting(String key);
|
||||
void runBoolSetting(String ley);
|
||||
void displaySetting(String key, Menu* menu, int index);
|
||||
void buttonSelected(uint8_t b);
|
||||
void buttonNotSelected(uint8_t b);
|
||||
|
||||
public:
|
||||
MenuFunctions();
|
||||
|
||||
Menu* current_menu;
|
||||
|
||||
Ticker tick;
|
||||
|
||||
uint16_t x = -1, y = -1;
|
||||
boolean pressed = false;
|
||||
|
||||
String loaded_file = "";
|
||||
|
||||
void initLVGL();
|
||||
void deinitLVGL();
|
||||
void joinWiFiGFX();
|
||||
void addSSIDGFX();
|
||||
void addAPGFX();
|
||||
void displaySettingsGFX();
|
||||
void writeBadUSB();
|
||||
|
||||
void buildButtons(Menu* menu);
|
||||
void changeMenu(Menu* menu);
|
||||
void drawStatusBar();
|
||||
void displayCurrentMenu();
|
||||
void main(uint32_t currentTime);
|
||||
void RunSetup();
|
||||
void orientDisplay();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,7 +1,20 @@
|
||||
#include "SDInterface.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
bool SDInterface::initSD() {
|
||||
String display_string = "";
|
||||
|
||||
#ifdef KIT
|
||||
pinMode(SD_DET, INPUT);
|
||||
if (digitalRead(SD_DET) == LOW) {
|
||||
Serial.println(F("SD Card Detect Pin Detected"));
|
||||
}
|
||||
else {
|
||||
Serial.println(F("SD Card Detect Pin Not Detected"));
|
||||
this->supported = false;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!SD.begin(SD_CS)) {
|
||||
Serial.println(F("Failed to mount SD Card"));
|
||||
@@ -20,18 +33,11 @@ bool SDInterface::initSD() {
|
||||
else
|
||||
Serial.println(F("SD: UNKNOWN Card Mounted"));
|
||||
|
||||
//this->cardSizeBT = SD.cardSize();
|
||||
//this->cardSizeKB = SD.cardSize() / 1024;
|
||||
this->cardSizeMB = SD.cardSize() / (1024 * 1024);
|
||||
//this->cardSizeGB = SD.cardSize() / (1024 * 1024 * 1024);
|
||||
|
||||
//Serial.printf("SD Card Size: %llu Bytes\n", this->cardSizeBT);
|
||||
//Serial.printf("SD Card Size: %lluKB\n", this->cardSizeKB);
|
||||
Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB);
|
||||
//Serial.printf("SD Card Size: %lluGB\n", this->cardSizeGB);
|
||||
|
||||
if (this->supported) {
|
||||
//display_obj.tft.println((byte)(sd_obj.cardSizeMB % 10));
|
||||
const int NUM_DIGITS = log10(this->cardSizeMB) + 1;
|
||||
|
||||
char sz[NUM_DIGITS + 1];
|
||||
@@ -43,16 +49,11 @@ bool SDInterface::initSD() {
|
||||
display_string.concat((String)sz[i]);
|
||||
}
|
||||
|
||||
//this->card_sz = display_string;
|
||||
this->card_sz = sz;
|
||||
}
|
||||
|
||||
buffer_obj = Buffer();
|
||||
|
||||
//if (this->supported)
|
||||
// buffer_obj.open(&SD);
|
||||
|
||||
// Check for SCRIPTS folder
|
||||
|
||||
if (!SD.exists("/SCRIPTS")) {
|
||||
Serial.println("/SCRIPTS does not exist. Creating...");
|
||||
|
||||
@@ -66,7 +67,6 @@ bool SDInterface::initSD() {
|
||||
|
||||
void SDInterface::addPacket(uint8_t* buf, uint32_t len) {
|
||||
if ((this->supported) && (this->do_save)) {
|
||||
//Serial.println("Adding packet to buffer...");
|
||||
buffer_obj.addPacket(buf, len);
|
||||
}
|
||||
}
|
||||
@@ -77,21 +77,26 @@ void SDInterface::openCapture(String file_name) {
|
||||
}
|
||||
|
||||
void SDInterface::runUpdate() {
|
||||
//display_obj.clearScreen();
|
||||
display_obj.tft.setTextWrap(false);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
|
||||
display_obj.tft.println(F("Opening /update.bin..."));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextWrap(false);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
|
||||
display_obj.tft.println(F(text15));
|
||||
#endif
|
||||
File updateBin = SD.open("/update.bin");
|
||||
if (updateBin) {
|
||||
if(updateBin.isDirectory()){
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F("Error, could not find update.bin"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F(text_table2[0]));
|
||||
#endif
|
||||
Serial.println(F("Error, update.bin is not a file"));
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
updateBin.close();
|
||||
return;
|
||||
}
|
||||
@@ -99,82 +104,122 @@ void SDInterface::runUpdate() {
|
||||
size_t updateSize = updateBin.size();
|
||||
|
||||
if (updateSize > 0) {
|
||||
display_obj.tft.println(F("Starting SD Update..."));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table2[1]));
|
||||
#endif
|
||||
Serial.println(F("Try to start update"));
|
||||
this->performUpdate(updateBin, updateSize);
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F("Error, update.bin is empty"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F(text_table2[2]));
|
||||
#endif
|
||||
Serial.println(F("Error, file is empty"));
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
updateBin.close();
|
||||
|
||||
// whe finished remove the binary from sd card to indicate end of the process
|
||||
display_obj.tft.println(F("rebooting..."));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table2[3]));
|
||||
#endif
|
||||
Serial.println(F("rebooting..."));
|
||||
//SD.remove("/update.bin");
|
||||
delay(1000);
|
||||
ESP.restart();
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F("Could not load update.bin from /"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(F(text_table2[4]));
|
||||
#endif
|
||||
Serial.println(F("Could not load update.bin from sd root"));
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
|
||||
if (Update.begin(updateSize)) {
|
||||
display_obj.tft.println("File size: " + String(updateSize));
|
||||
display_obj.tft.println(F("Writing file to partition..."));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table2[5] + String(updateSize));
|
||||
display_obj.tft.println(F(text_table2[6]));
|
||||
#endif
|
||||
size_t written = Update.writeStream(updateSource);
|
||||
if (written == updateSize) {
|
||||
display_obj.tft.println("Written: " + String(written) + " successfully");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table2[7] + String(written) + text_table2[10]);
|
||||
#endif
|
||||
Serial.println("Written : " + String(written) + " successfully");
|
||||
}
|
||||
else {
|
||||
display_obj.tft.println("Written only : " + String(written) + "/" + String(updateSize) + ". Retry?");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table2[8] + String(written) + "/" + String(updateSize) + text_table2[9]);
|
||||
#endif
|
||||
Serial.println("Written only : " + String(written) + "/" + String(updateSize) + ". Retry?");
|
||||
}
|
||||
if (Update.end()) {
|
||||
Serial.println("OTA done!");
|
||||
if (Update.isFinished()) {
|
||||
display_obj.tft.println(F("Update complete"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table2[11]));
|
||||
#endif
|
||||
Serial.println(F("Update successfully completed. Rebooting."));
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println("Update could not complete");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED);
|
||||
display_obj.tft.println(text_table2[12]);
|
||||
#endif
|
||||
Serial.println("Update not finished? Something went wrong!");
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
display_obj.tft.println("Error Occurred. Error #: " + String(Update.getError()));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table2[13] + String(Update.getError()));
|
||||
#endif
|
||||
Serial.println("Error Occurred. Error #: " + String(Update.getError()));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
display_obj.tft.println("Not enough space to begin OTA");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(text_table2[14]);
|
||||
#endif
|
||||
Serial.println("Not enough space to begin OTA");
|
||||
}
|
||||
}
|
||||
|
||||
bool SDInterface::checkDetectPin() {
|
||||
#ifdef KIT
|
||||
if (digitalRead(SD_DET) == LOW)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SDInterface::main() {
|
||||
if ((this->supported) && (this->do_save)) {
|
||||
//Serial.println("Saving packet...");
|
||||
buffer_obj.forceSave(&SD);
|
||||
}
|
||||
else if (!this->supported) {
|
||||
if (checkDetectPin()) {
|
||||
delay(100);
|
||||
this->initSD();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//void SDInterface::savePacket(uint8_t* buf, uint32_t len) {
|
||||
// if (this->supported)
|
||||
// buffer_obj.save(
|
||||
//}
|
||||
|
||||
@@ -1,19 +1,28 @@
|
||||
#ifndef SDInterface_h
|
||||
#define SDInterface_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#include "SD.h"
|
||||
#include "Buffer.h"
|
||||
#include "Display.h"
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
#include <Update.h>
|
||||
|
||||
extern Buffer buffer_obj;
|
||||
extern Display display_obj;
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
#define SD_CS 12
|
||||
#ifdef KIT
|
||||
#define SD_DET 4
|
||||
#endif
|
||||
|
||||
class SDInterface {
|
||||
|
||||
private:
|
||||
bool checkDetectPin();
|
||||
|
||||
public:
|
||||
uint8_t cardType;
|
||||
|
||||
@@ -19,7 +19,10 @@ void TemperatureInterface::RunSetup() {
|
||||
}
|
||||
|
||||
uint8_t TemperatureInterface::getCurrentTemp() {
|
||||
return ((temprature_sens_read() - 32) / 1.8);
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
return ((temprature_sens_read() - 32) / 1.8);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
void TemperatureInterface::main(uint32_t currentTime) {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef TemperatureInterface_h
|
||||
#define TemperatureInterface_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
class TemperatureInterface {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "Web.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
WebServer server(80);
|
||||
|
||||
@@ -9,7 +10,6 @@ Web::Web()
|
||||
|
||||
void Web::main()
|
||||
{
|
||||
//Serial.println("Running the shits");
|
||||
// Notify if client has connected to the update server
|
||||
|
||||
|
||||
@@ -44,18 +44,24 @@ void Web::onJavaScript(void) {
|
||||
void Web::setupOTAupdate()
|
||||
{
|
||||
uint8_t newMACAddress[] = {0x06, 0x07, 0x0D, 0x09, 0x0E, 0x0D};
|
||||
|
||||
display_obj.tft.setTextWrap(false);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextWrap(false);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
display_obj.tft.print("Configuring update server...\n\n");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.print(text_table3[0]);
|
||||
#endif
|
||||
Serial.println("Configuring update server...");
|
||||
|
||||
display_obj.tft.setTextColor(TFT_YELLOW);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_YELLOW);
|
||||
#endif
|
||||
|
||||
// Start WiFi AP
|
||||
Serial.println("Initializing WiFi...");
|
||||
@@ -69,32 +75,23 @@ void Web::setupOTAupdate()
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
|
||||
Serial.println("Starting softAP...");
|
||||
esp_wifi_set_mac(ESP_IF_WIFI_AP, &newMACAddress[0]);
|
||||
esp_wifi_set_mac(WIFI_IF_AP, &newMACAddress[0]);
|
||||
WiFi.softAP(ssid, password);
|
||||
Serial.println("");
|
||||
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
|
||||
Serial.println("Displaying settings to TFT...");
|
||||
display_obj.tft.print("SSID: ");
|
||||
display_obj.tft.println(ssid);
|
||||
display_obj.tft.print("IP address: ");
|
||||
display_obj.tft.print(WiFi.softAPIP());
|
||||
display_obj.tft.print("\n");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.print(text_table1[2]);
|
||||
display_obj.tft.println(ssid);
|
||||
display_obj.tft.print(text_table3[1]);
|
||||
display_obj.tft.print(WiFi.softAPIP());
|
||||
display_obj.tft.print("\n");
|
||||
#endif
|
||||
Serial.print("IP address: ");
|
||||
Serial.println(WiFi.softAPIP());
|
||||
|
||||
/*use mdns for host name resolution*/
|
||||
/*
|
||||
if (!MDNS.begin(host)) { //http://esp32.local
|
||||
Serial.println("Error setting up MDNS responder!");
|
||||
while (1) {
|
||||
delay(1000);
|
||||
}
|
||||
}
|
||||
Serial.println("mDNS responder started");
|
||||
*/
|
||||
|
||||
// return javascript jquery
|
||||
Serial.println("Setting server behavior...");
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
@@ -116,11 +113,12 @@ void Web::setupOTAupdate()
|
||||
}, [this]() {
|
||||
HTTPUpload& upload = server.upload();
|
||||
if (upload.status == UPLOAD_FILE_START) {
|
||||
display_obj.tft.setTextColor(TFT_YELLOW);
|
||||
display_obj.tft.print("Update: ");
|
||||
display_obj.tft.print(upload.filename.c_str());
|
||||
display_obj.tft.print("\n");
|
||||
//display_obj.updateBanner(menu_function_obj.current_menu->name);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_YELLOW);
|
||||
display_obj.tft.print(text_table3[2]);
|
||||
display_obj.tft.print(upload.filename.c_str());
|
||||
display_obj.tft.print("\n");
|
||||
#endif
|
||||
Serial.printf("Update: %s\n", upload.filename.c_str());
|
||||
if (!Update.begin(UPDATE_SIZE_UNKNOWN)) { //start with max available size
|
||||
Update.printError(Serial);
|
||||
@@ -130,30 +128,23 @@ void Web::setupOTAupdate()
|
||||
if (Update.write(upload.buf, upload.currentSize) != upload.currentSize) {
|
||||
Update.printError(Serial);
|
||||
}
|
||||
//display_obj.tft.println(upload.totalSize);
|
||||
/*
|
||||
String display_string = "";
|
||||
display_obj.tft.setCursor(0, 164);
|
||||
for (int i = 0; i < 40; i++) {
|
||||
display_string.concat(" ");
|
||||
}
|
||||
*/
|
||||
display_obj.tft.setTextColor(TFT_CYAN);
|
||||
display_obj.tft.fillRect(0, 164, 240, 8, TFT_BLACK);
|
||||
//delay(1);
|
||||
//display_obj.tft.print(display_string);
|
||||
display_obj.tft.setCursor(0, 164);
|
||||
display_obj.tft.print("Bytes complete: ");
|
||||
display_obj.tft.print(upload.totalSize);
|
||||
display_obj.tft.print("\n");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_CYAN);
|
||||
display_obj.tft.fillRect(0, 164, 240, 8, TFT_BLACK);
|
||||
display_obj.tft.setCursor(0, 164);
|
||||
display_obj.tft.print(text_table3[3]);
|
||||
display_obj.tft.print(upload.totalSize);
|
||||
display_obj.tft.print("\n");
|
||||
#endif
|
||||
|
||||
//Serial.println(upload.totalSize);
|
||||
} else if (upload.status == UPLOAD_FILE_END) {
|
||||
if (Update.end(true)) { //true to set the size to the current progress
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
display_obj.tft.print("Update Success: ");
|
||||
display_obj.tft.print(upload.totalSize);
|
||||
display_obj.tft.print("\nRebooting...\n");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
display_obj.tft.print(text_table3[4]);
|
||||
display_obj.tft.print(upload.totalSize);
|
||||
display_obj.tft.print(text_table2[3]);
|
||||
#endif
|
||||
Serial.printf("Update Success: %u\nRebooting...\n", upload.totalSize);
|
||||
delay(1000);
|
||||
} else {
|
||||
@@ -168,8 +159,10 @@ void Web::setupOTAupdate()
|
||||
Serial.println("Starting server...");
|
||||
server.begin();
|
||||
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
display_obj.tft.println("\nCompleted update server setup");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
display_obj.tft.println(text_table3[5]);
|
||||
#endif
|
||||
Serial.println("Completed update server setup");
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
Code taken from espressif ESP32 OTA Update example
|
||||
*/
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <WiFiClient.h>
|
||||
#include <WebServer.h>
|
||||
@@ -12,10 +14,17 @@ Code taken from espressif ESP32 OTA Update example
|
||||
#include <Update.h>
|
||||
|
||||
#include "Assets.h"
|
||||
#include "Display.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
|
||||
#include "WiFiScan.h"
|
||||
|
||||
extern Display display_obj;
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
extern WiFiScan wifi_scan_obj;
|
||||
|
||||
class Web
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,8 @@
|
||||
#ifndef WiFiScan_h
|
||||
#define WiFiScan_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
//#include <BLEDevice.h>
|
||||
//#include <BLEUtils.h>
|
||||
//#include <BLEScan.h>
|
||||
@@ -8,19 +10,25 @@
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
// Testing NimBLE
|
||||
#include <NimBLEDevice.h>
|
||||
#include <NimBLEAdvertisedDevice.h>
|
||||
#ifdef HAS_BT
|
||||
#include <NimBLEDevice.h>
|
||||
#endif
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <math.h>
|
||||
#include "esp_wifi.h"
|
||||
#include "esp_wifi_types.h"
|
||||
#include "esp_bt.h"
|
||||
#include "Display.h"
|
||||
#ifdef HAS_BT
|
||||
#include "esp_bt.h"
|
||||
#endif
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
#include "SDInterface.h"
|
||||
#include "Buffer.h"
|
||||
#include "BatteryInterface.h"
|
||||
#include "TemperatureInterface.h"
|
||||
#include "settings.h"
|
||||
#include "Assets.h"
|
||||
//#include "MenuFunctions.h"
|
||||
|
||||
@@ -48,18 +56,24 @@
|
||||
#define WIFI_SCAN_TARGET_AP 16
|
||||
#define LV_SELECT_AP 17
|
||||
#define WIFI_ATTACK_AUTH 18
|
||||
#define WIFI_ATTACK_MIMIC 19
|
||||
#define WIFI_ATTACK_DEAUTH 20
|
||||
|
||||
#define GRAPH_REFRESH 100
|
||||
|
||||
#define MAX_CHANNEL 14
|
||||
|
||||
extern Display display_obj;
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
extern SDInterface sd_obj;
|
||||
extern Buffer buffer_obj;
|
||||
extern BatteryInterface battery_obj;
|
||||
extern TemperatureInterface temp_obj;
|
||||
extern Settings settings_obj;
|
||||
|
||||
esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq);
|
||||
//int ieee80211_raw_frame_sanity_check(int32_t arg, int32_t arg2, int32_t arg3);
|
||||
|
||||
struct ssid {
|
||||
String essid;
|
||||
@@ -76,6 +90,12 @@ struct AccessPoint {
|
||||
class WiFiScan
|
||||
{
|
||||
private:
|
||||
// Settings
|
||||
int channel_hop_delay = 1;
|
||||
bool force_pmkid = false;
|
||||
bool force_probe = false;
|
||||
bool save_pcap = false;
|
||||
|
||||
int x_pos; //position along the graph x axis
|
||||
float y_pos_x; //current graph y axis position of X value
|
||||
float y_pos_x_old = 120; //old y axis position of X value
|
||||
@@ -89,16 +109,21 @@ class WiFiScan
|
||||
|
||||
bool do_break = false;
|
||||
|
||||
bool wsl_bypass_enabled = false;
|
||||
|
||||
//int num_beacon = 0; // GREEN
|
||||
//int num_probe = 0; // BLUE
|
||||
//int num_deauth = 0; // RED
|
||||
|
||||
uint32_t initTime = 0;
|
||||
bool run_setup = true;
|
||||
void initWiFi(uint8_t scan_mode);
|
||||
int bluetoothScanTime = 5;
|
||||
int packets_sent = 0;
|
||||
const wifi_promiscuous_filter_t filt = {.filter_mask=WIFI_PROMIS_FILTER_MASK_MGMT | WIFI_PROMIS_FILTER_MASK_DATA};
|
||||
BLEScan* pBLEScan;
|
||||
#ifdef HAS_BT
|
||||
NimBLEScan* pBLEScan;
|
||||
#endif
|
||||
|
||||
//String connected_network = "";
|
||||
String alfa = "1234567890qwertyuiopasdfghjkklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM_";
|
||||
@@ -128,8 +153,8 @@ class WiFiScan
|
||||
} __attribute__((packed)) WifiMgmtHdr;
|
||||
|
||||
typedef struct {
|
||||
WifiMgmtHdr hdr;
|
||||
uint8_t payload[0];
|
||||
WifiMgmtHdr hdr;
|
||||
} wifi_ieee80211_packet_t;
|
||||
|
||||
// barebones packet
|
||||
@@ -181,9 +206,18 @@ class WiFiScan
|
||||
/* SSID */
|
||||
};
|
||||
|
||||
uint8_t deauth_frame_default[26] = {
|
||||
0xc0, 0x00, 0x3a, 0x01,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf0, 0xff, 0x02, 0x00
|
||||
};
|
||||
|
||||
void startWiFiAttacks(uint8_t scan_mode, uint16_t color, String title_string);
|
||||
|
||||
void packetMonitorMain(uint32_t currentTime);
|
||||
void eapolMonitorMain(uint32_t currentTime);
|
||||
void changeChannel();
|
||||
void updateMidway();
|
||||
void tftDrawXScalButtons();
|
||||
void tftDrawYScaleButtons();
|
||||
@@ -191,14 +225,17 @@ class WiFiScan
|
||||
void tftDrawColorKey();
|
||||
void tftDrawGraphObjects();
|
||||
void sendProbeAttack(uint32_t currentTime);
|
||||
void sendDeauthAttack(uint32_t currentTime);
|
||||
void broadcastRandomSSID(uint32_t currentTime);
|
||||
void broadcastCustomBeacon(uint32_t current_time, ssid custom_ssid);
|
||||
void broadcastSetSSID(uint32_t current_time, char* ESSID);
|
||||
void RunAPScan(uint8_t scan_mode, uint16_t color);
|
||||
void RunRickRoll(uint8_t scan_mode, uint16_t color);
|
||||
void RunBeaconSpam(uint8_t scan_mode, uint16_t color);
|
||||
void RunProbeFlood(uint8_t scan_mode, uint16_t color);
|
||||
void RunBeaconList(uint8_t scan_mode, uint16_t color);
|
||||
//void RunRickRoll(uint8_t scan_mode, uint16_t color);
|
||||
//void RunBeaconSpam(uint8_t scan_mode, uint16_t color);
|
||||
//void RunProbeFlood(uint8_t scan_mode, uint16_t color);
|
||||
//void RunDeauthFlood(uint8_t scan_mode, uint16_t color);
|
||||
void RunMimicFlood(uint8_t scan_mode, uint16_t color);
|
||||
//void RunBeaconList(uint8_t scan_mode, uint16_t color);
|
||||
void RunEspressifScan(uint8_t scan_mode, uint16_t color);
|
||||
void RunPwnScan(uint8_t scan_mode, uint16_t color);
|
||||
void RunBeaconScan(uint8_t scan_mode, uint16_t color);
|
||||
@@ -208,7 +245,11 @@ class WiFiScan
|
||||
void RunPacketMonitor(uint8_t scan_mode, uint16_t color);
|
||||
void RunBluetoothScan(uint8_t scan_mode, uint16_t color);
|
||||
void RunLvJoinWiFi(uint8_t scan_mode, uint16_t color);
|
||||
static void scanCompleteCB(BLEScanResults scanResults);
|
||||
#ifdef HAS_BT
|
||||
static void scanCompleteCB(BLEScanResults scanResults);
|
||||
#endif
|
||||
|
||||
//int ieee80211_raw_frame_sanity_check(int32_t arg, int32_t arg2, int32_t arg3);
|
||||
|
||||
public:
|
||||
WiFiScan();
|
||||
@@ -231,8 +272,9 @@ class WiFiScan
|
||||
|
||||
//lv_obj_t * scr = lv_cont_create(NULL, NULL);
|
||||
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
|
||||
char* stringToChar(String string);
|
||||
void RunSetup();
|
||||
int clearSSIDs();
|
||||
int clearAPs();
|
||||
@@ -240,10 +282,12 @@ class WiFiScan
|
||||
int generateSSIDs();
|
||||
bool shutdownWiFi();
|
||||
bool shutdownBLE();
|
||||
bool scanning();
|
||||
void joinWiFi(String ssid, String password);
|
||||
String getStaMAC();
|
||||
String getApMAC();
|
||||
String freeRAM();
|
||||
void changeChannel();
|
||||
void RunInfo();
|
||||
void RunShutdownWiFi();
|
||||
void RunShutdownBLE();
|
||||
|
||||
@@ -25,14 +25,18 @@ void A32u4Interface::begin() {
|
||||
|
||||
if (a32u4_rep != 0) {
|
||||
this->supported = true;
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.tft.println("ATmega32U4 Found!");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.tft.println("ATmega32U4 Found!");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println("ATmega32U4 Not Found");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println("ATmega32U4 Not Found");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
Serial.print("A32U4 Said: ");
|
||||
Serial.println(a32u4_rep);
|
||||
}
|
||||
@@ -62,5 +66,4 @@ void A32u4Interface::main(uint32_t current_time) {
|
||||
}
|
||||
}
|
||||
|
||||
//delay(1);*/
|
||||
}
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
#ifndef a32u4_interface_h
|
||||
#define a32u4_interface_h
|
||||
|
||||
#include "Display.h"
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#define BAUD32U4 115200
|
||||
|
||||
extern Display display_obj;
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
class A32u4Interface {
|
||||
public:
|
||||
|
||||
398
esp32_marauder/configs.h
Normal file
398
esp32_marauder/configs.h
Normal file
@@ -0,0 +1,398 @@
|
||||
#ifndef configs_h
|
||||
|
||||
#define configs_h
|
||||
|
||||
#define POLISH_POTATO
|
||||
|
||||
//#define MARAUDER_MINI
|
||||
#define MARAUDER_V4
|
||||
//#define MARAUDER_V6
|
||||
//#define MARAUDER_KIT
|
||||
//#define GENERIC_ESP32
|
||||
//#define MARAUDER_FLIPPER
|
||||
|
||||
#define MARAUDER_VERSION "v0.9.6"
|
||||
|
||||
//// BUTTON DEFINITIONS
|
||||
#ifdef MARAUDER_MINI
|
||||
#define L_BTN 13
|
||||
#define C_BTN 34
|
||||
#define U_BTN 36
|
||||
#define R_BTN 39
|
||||
#define D_BTN 35
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V4
|
||||
#endif
|
||||
//// END BUTTON DEFINITIONS
|
||||
|
||||
//// DISPLAY DEFINITIONS
|
||||
#ifdef MARAUDER_V4
|
||||
#define BANNER_TEXT_SIZE 2
|
||||
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 240
|
||||
#endif
|
||||
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 320
|
||||
#endif
|
||||
|
||||
#define TFT_SHIELD
|
||||
|
||||
#define SCREEN_WIDTH TFT_WIDTH
|
||||
#define SCREEN_HEIGHT TFT_HEIGHT
|
||||
#define HEIGHT_1 TFT_WIDTH
|
||||
#define WIDTH_1 TFT_HEIGHT
|
||||
#define STANDARD_FONT_CHAR_LIMIT (TFT_WIDTH/6) // number of characters on a single line with normal font
|
||||
#define TEXT_HEIGHT 16 // Height of text to be printed and scrolled
|
||||
#define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen)
|
||||
#define TOP_FIXED_AREA 48 // Number of lines in top fixed area (lines counted from top of screen)
|
||||
#define YMAX 320 // Bottom of screen area
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
//#define MENU_FONT NULL
|
||||
#define MENU_FONT &FreeMono9pt7b // Winner
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 9
|
||||
#define STATUS_BAR_WIDTH 16
|
||||
#define LVGL_TICK_PERIOD 6
|
||||
|
||||
#define FRAME_X 100
|
||||
#define FRAME_Y 64
|
||||
#define FRAME_W 120
|
||||
#define FRAME_H 50
|
||||
|
||||
// Red zone size
|
||||
#define REDBUTTON_X FRAME_X
|
||||
#define REDBUTTON_Y FRAME_Y
|
||||
#define REDBUTTON_W (FRAME_W/2)
|
||||
#define REDBUTTON_H FRAME_H
|
||||
|
||||
// Green zone size
|
||||
#define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W)
|
||||
#define GREENBUTTON_Y FRAME_Y
|
||||
#define GREENBUTTON_W (FRAME_W/2)
|
||||
#define GREENBUTTON_H FRAME_H
|
||||
|
||||
#define STATUSBAR_COLOR 0x4A49
|
||||
|
||||
#define KIT_LED_BUILTIN 13
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V6
|
||||
#define BANNER_TEXT_SIZE 2
|
||||
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 240
|
||||
#endif
|
||||
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 320
|
||||
#endif
|
||||
|
||||
#define TFT_DIY
|
||||
|
||||
#define SCREEN_WIDTH TFT_WIDTH
|
||||
#define SCREEN_HEIGHT TFT_HEIGHT
|
||||
#define HEIGHT_1 TFT_WIDTH
|
||||
#define WIDTH_1 TFT_HEIGHT
|
||||
#define STANDARD_FONT_CHAR_LIMIT (TFT_WIDTH/6) // number of characters on a single line with normal font
|
||||
#define TEXT_HEIGHT 16 // Height of text to be printed and scrolled
|
||||
#define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen)
|
||||
#define TOP_FIXED_AREA 48 // Number of lines in top fixed area (lines counted from top of screen)
|
||||
#define YMAX 320 // Bottom of screen area
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
//#define MENU_FONT NULL
|
||||
#define MENU_FONT &FreeMono9pt7b // Winner
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 9
|
||||
#define STATUS_BAR_WIDTH 16
|
||||
#define LVGL_TICK_PERIOD 6
|
||||
|
||||
#define FRAME_X 100
|
||||
#define FRAME_Y 64
|
||||
#define FRAME_W 120
|
||||
#define FRAME_H 50
|
||||
|
||||
// Red zone size
|
||||
#define REDBUTTON_X FRAME_X
|
||||
#define REDBUTTON_Y FRAME_Y
|
||||
#define REDBUTTON_W (FRAME_W/2)
|
||||
#define REDBUTTON_H FRAME_H
|
||||
|
||||
// Green zone size
|
||||
#define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W)
|
||||
#define GREENBUTTON_Y FRAME_Y
|
||||
#define GREENBUTTON_W (FRAME_W/2)
|
||||
#define GREENBUTTON_H FRAME_H
|
||||
|
||||
#define STATUSBAR_COLOR 0x4A49
|
||||
|
||||
#define KIT_LED_BUILTIN 13
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_KIT
|
||||
#define BANNER_TEXT_SIZE 2
|
||||
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 240
|
||||
#endif
|
||||
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 320
|
||||
#endif
|
||||
|
||||
#define TFT_DIY
|
||||
#define KIT
|
||||
|
||||
#define SCREEN_WIDTH TFT_WIDTH
|
||||
#define SCREEN_HEIGHT TFT_HEIGHT
|
||||
#define HEIGHT_1 TFT_WIDTH
|
||||
#define WIDTH_1 TFT_HEIGHT
|
||||
#define STANDARD_FONT_CHAR_LIMIT (TFT_WIDTH/6) // number of characters on a single line with normal font
|
||||
#define TEXT_HEIGHT 16 // Height of text to be printed and scrolled
|
||||
#define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen)
|
||||
#define TOP_FIXED_AREA 48 // Number of lines in top fixed area (lines counted from top of screen)
|
||||
#define YMAX 320 // Bottom of screen area
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
//#define MENU_FONT NULL
|
||||
#define MENU_FONT &FreeMono9pt7b // Winner
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 9
|
||||
#define STATUS_BAR_WIDTH 16
|
||||
#define LVGL_TICK_PERIOD 6
|
||||
|
||||
#define FRAME_X 100
|
||||
#define FRAME_Y 64
|
||||
#define FRAME_W 120
|
||||
#define FRAME_H 50
|
||||
|
||||
// Red zone size
|
||||
#define REDBUTTON_X FRAME_X
|
||||
#define REDBUTTON_Y FRAME_Y
|
||||
#define REDBUTTON_W (FRAME_W/2)
|
||||
#define REDBUTTON_H FRAME_H
|
||||
|
||||
// Green zone size
|
||||
#define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W)
|
||||
#define GREENBUTTON_Y FRAME_Y
|
||||
#define GREENBUTTON_W (FRAME_W/2)
|
||||
#define GREENBUTTON_H FRAME_H
|
||||
|
||||
#define STATUSBAR_COLOR 0x4A49
|
||||
|
||||
#define KIT_LED_BUILTIN 13
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#define TFT_MISO 19
|
||||
#define TFT_MOSI 23
|
||||
#define TFT_SCLK 18
|
||||
#define TFT_CS 27
|
||||
#define TFT_DC 26
|
||||
#define TFT_RST 5
|
||||
#define TFT_BL 32
|
||||
#define TOUCH_CS 21
|
||||
#define SD_CS 4
|
||||
|
||||
#define BANNER_TEXT_SIZE 1
|
||||
|
||||
#ifndef TFT_WIDTH
|
||||
#define TFT_WIDTH 128
|
||||
#endif
|
||||
|
||||
#ifndef TFT_HEIGHT
|
||||
#define TFT_HEIGHT 128
|
||||
#endif
|
||||
|
||||
#define SCREEN_WIDTH TFT_WIDTH // Originally 240
|
||||
#define SCREEN_HEIGHT TFT_HEIGHT // Originally 320
|
||||
#define HEIGHT_1 TFT_WIDTH
|
||||
#define WIDTH_1 TFT_WIDTH
|
||||
#define STANDARD_FONT_CHAR_LIMIT (TFT_WIDTH/6) // number of characters on a single line with normal font
|
||||
#define TEXT_HEIGHT (TFT_HEIGHT/10) // Height of text to be printed and scrolled
|
||||
#define BOT_FIXED_AREA 0 // Number of lines in bottom fixed area (lines counted from bottom of screen)
|
||||
#define TOP_FIXED_AREA 48 // Number of lines in top fixed area (lines counted from top of screen)
|
||||
#define YMAX TFT_HEIGHT // Bottom of screen area
|
||||
#define minimum(a,b) (((a) < (b)) ? (a) : (b))
|
||||
//#define MENU_FONT NULL
|
||||
#define MENU_FONT &FreeMono9pt7b // Winner
|
||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||
//#define MENU_FONT &FreeSans9pt7b
|
||||
//#define MENU_FONT &FreeSansBold9pt7b
|
||||
#define BUTTON_ARRAY_LEN 9
|
||||
#define STATUS_BAR_WIDTH (TFT_HEIGHT/16)
|
||||
#define LVGL_TICK_PERIOD 6
|
||||
|
||||
#define FRAME_X 100
|
||||
#define FRAME_Y 64
|
||||
#define FRAME_W 120
|
||||
#define FRAME_H 50
|
||||
|
||||
// Red zone size
|
||||
#define REDBUTTON_X FRAME_X
|
||||
#define REDBUTTON_Y FRAME_Y
|
||||
#define REDBUTTON_W (FRAME_W/2)
|
||||
#define REDBUTTON_H FRAME_H
|
||||
|
||||
// Green zone size
|
||||
#define GREENBUTTON_X (REDBUTTON_X + REDBUTTON_W)
|
||||
#define GREENBUTTON_Y FRAME_Y
|
||||
#define GREENBUTTON_W (FRAME_W/2)
|
||||
#define GREENBUTTON_H FRAME_H
|
||||
|
||||
#define STATUSBAR_COLOR 0x4A49
|
||||
#endif
|
||||
//// END DISPLAY DEFINITIONS
|
||||
|
||||
//// MENU DEFINITIONS
|
||||
#ifdef MARAUDER_V4
|
||||
#define BANNER_TIME 100
|
||||
|
||||
#define COMMAND_PREFIX "!"
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X 120 // Centre of key
|
||||
#define KEY_Y 50
|
||||
#define KEY_W 240 // Width and height
|
||||
#define KEY_H 22
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 22
|
||||
//#define BUTTON_ARRAY_LEN 5
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V6
|
||||
#define BANNER_TIME 100
|
||||
|
||||
#define COMMAND_PREFIX "!"
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X 120 // Centre of key
|
||||
#define KEY_Y 50
|
||||
#define KEY_W 240 // Width and height
|
||||
#define KEY_H 22
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 22
|
||||
//#define BUTTON_ARRAY_LEN 5
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_KIT
|
||||
#define BANNER_TIME 100
|
||||
|
||||
#define COMMAND_PREFIX "!"
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X 120 // Centre of key
|
||||
#define KEY_Y 50
|
||||
#define KEY_W 240 // Width and height
|
||||
#define KEY_H 22
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 22
|
||||
//#define BUTTON_ARRAY_LEN 5
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#define BANNER_TIME 50
|
||||
|
||||
#define COMMAND_PREFIX "!"
|
||||
|
||||
// Keypad start position, key sizes and spacing
|
||||
#define KEY_X (TFT_WIDTH/2) // Centre of key
|
||||
#define KEY_Y (TFT_HEIGHT/4.5)
|
||||
#define KEY_W TFT_WIDTH // Width and height
|
||||
#define KEY_H (TFT_HEIGHT/12.8)
|
||||
#define KEY_SPACING_X 0 // X and Y gap
|
||||
#define KEY_SPACING_Y 1
|
||||
#define KEY_TEXTSIZE 1 // Font size multiplier
|
||||
#define ICON_W 22
|
||||
#define ICON_H 22
|
||||
#define BUTTON_PADDING 10
|
||||
#endif
|
||||
//// END MENU DEFINITIONS
|
||||
|
||||
//// SD DEFINITIONS
|
||||
#ifdef MARAUDER_V4
|
||||
#define SD_CS 12
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V6
|
||||
#define SD_CS 12
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_KIT
|
||||
#define SD_CS 12
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#define SD_CS 4
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_FLIPPER
|
||||
#define SD_CS -1
|
||||
#endif
|
||||
//// END SD DEFINITIONS
|
||||
|
||||
//// SCREEN STUFF
|
||||
#ifdef MARAUDER_MINI
|
||||
#define HAS_SCREEN
|
||||
#define HAS_BT
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V4
|
||||
#define HAS_SCREEN
|
||||
#define HAS_BT
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_V6
|
||||
#define HAS_SCREEN
|
||||
#define HAS_BT
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_KIT
|
||||
#define HAS_SCREEN
|
||||
#define HAS_BT
|
||||
#endif
|
||||
|
||||
#ifdef GENERIC_ESP32
|
||||
#define HAS_BT
|
||||
#endif
|
||||
|
||||
#ifndef HAS_SCREEN
|
||||
#define TFT_CYAN 0
|
||||
#define TFT_BLUE 0
|
||||
#define TFT_RED 0
|
||||
#define TFT_GREEN 0
|
||||
#define TFT_GREY 0
|
||||
#define TFT_GRAY 0
|
||||
#define TFT_MAGENTA 0
|
||||
#define TFT_VIOLET 0
|
||||
#define STANDARD_FONT_CHAR_LIMIT 40
|
||||
#define FLASH_BUTTON -1
|
||||
|
||||
#include <FS.h>
|
||||
#include <functional>
|
||||
#include <LinkedList.h>
|
||||
#include "SPIFFS.h"
|
||||
#include "Assets.h"
|
||||
#endif
|
||||
//// END SCREEN STUFF
|
||||
|
||||
#endif
|
||||
BIN
esp32_marauder/data/marauder_mini.jpg
Normal file
BIN
esp32_marauder/data/marauder_mini.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.8 KiB |
@@ -5,6 +5,13 @@ Partition Scheme: Minimal SPIFFS
|
||||
https://www.online-utility.org/image/convert/to/XBM
|
||||
*/
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#ifndef HAS_SCREEN
|
||||
#define MenuFunctions_h
|
||||
#define Display_h
|
||||
#endif
|
||||
|
||||
#include <WiFi.h>
|
||||
#include <Wire.h>
|
||||
#include "esp_wifi.h"
|
||||
@@ -15,11 +22,8 @@ https://www.online-utility.org/image/convert/to/XBM
|
||||
#include "esp_system.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
#include "Assets.h"
|
||||
#include "Display.h"
|
||||
#include "WiFiScan.h"
|
||||
#include "MenuFunctions.h"
|
||||
#include "SDInterface.h"
|
||||
#include "Web.h"
|
||||
#include "Buffer.h"
|
||||
@@ -27,23 +31,26 @@ https://www.online-utility.org/image/convert/to/XBM
|
||||
#include "TemperatureInterface.h"
|
||||
#include "LedInterface.h"
|
||||
#include "esp_interface.h"
|
||||
#include "a32u4_interface.h"
|
||||
//#include "icons.h"
|
||||
#include "settings.h"
|
||||
#include "CommandLine.h"
|
||||
#include "lang_var.h"
|
||||
|
||||
/*
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#include "MenuFunctions.h"
|
||||
#include "a32u4_interface.h"
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
#include <SwitchLib.h>
|
||||
SwitchLib u_btn = SwitchLib(U_BTN, 1000, true);
|
||||
SwitchLib d_btn = SwitchLib(D_BTN, 1000, true);
|
||||
SwitchLib l_btn = SwitchLib(L_BTN, 1000, true);
|
||||
SwitchLib r_btn = SwitchLib(R_BTN, 1000, true);
|
||||
SwitchLib c_btn = SwitchLib(C_BTN, 1000, true);
|
||||
#endif
|
||||
uint8_t temprature_sens_read();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
uint8_t temprature_sens_read();
|
||||
*/
|
||||
|
||||
Display display_obj;
|
||||
WiFiScan wifi_scan_obj;
|
||||
MenuFunctions menu_function_obj;
|
||||
SDInterface sd_obj;
|
||||
Web web_obj;
|
||||
Buffer buffer_obj;
|
||||
@@ -51,199 +58,278 @@ BatteryInterface battery_obj;
|
||||
TemperatureInterface temp_obj;
|
||||
LedInterface led_obj;
|
||||
EspInterface esp_obj;
|
||||
A32u4Interface a32u4_obj;
|
||||
Settings settings_obj;
|
||||
CommandLine cli_obj;
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
Display display_obj;
|
||||
MenuFunctions menu_function_obj;
|
||||
A32u4Interface a32u4_obj;
|
||||
#endif
|
||||
|
||||
const String PROGMEM version_number = MARAUDER_VERSION;
|
||||
|
||||
Adafruit_NeoPixel strip = Adafruit_NeoPixel(Pixels, PIN, NEO_GRB + NEO_KHZ800);
|
||||
|
||||
uint32_t currentTime = 0;
|
||||
|
||||
|
||||
void backlightOn() {
|
||||
#ifdef HAS_SCREEN
|
||||
#ifdef MARAUDER_MINI
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
#endif
|
||||
|
||||
#ifndef MARAUDER_MINI
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void backlightOff() {
|
||||
#ifdef HAS_SCREEN
|
||||
#ifdef MARAUDER_MINI
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
#endif
|
||||
|
||||
#ifndef MARAUDER_MINI
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void setup()
|
||||
{
|
||||
pinMode(FLASH_BUTTON, INPUT);
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
pinMode(TFT_BL, OUTPUT);
|
||||
#endif
|
||||
|
||||
backlightOff();
|
||||
#if BATTERY_ANALOG_ON == 1
|
||||
pinMode(BATTERY_PIN, OUTPUT);
|
||||
pinMode(CHARGING_PIN, INPUT);
|
||||
#endif
|
||||
|
||||
// Preset SPI CS pins to avoid bus conflicts
|
||||
digitalWrite(TFT_CS, HIGH);
|
||||
#ifdef HAS_SCREEN
|
||||
digitalWrite(TFT_CS, HIGH);
|
||||
#endif
|
||||
|
||||
digitalWrite(SD_CS, HIGH);
|
||||
|
||||
Serial.begin(115200);
|
||||
|
||||
//Serial.begin(115200);
|
||||
|
||||
display_obj.RunSetup();
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
Serial.println("\n\nHello, World!\n");
|
||||
|
||||
Serial.println("ESP-IDF version is: " + String(esp_get_idf_version()));
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
Serial.println("Has Screen");
|
||||
#else
|
||||
Serial.println("Does not have screen");
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.RunSetup();
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
#endif
|
||||
|
||||
backlightOff();
|
||||
|
||||
// Draw the title screen
|
||||
display_obj.drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
|
||||
#endif
|
||||
|
||||
//showCenterText(version_number, 250);
|
||||
display_obj.tft.drawCentreString(display_obj.version_number, 120, 250, 2);
|
||||
#ifdef HAS_SCREEN
|
||||
//showCenterText(version_number, 250);
|
||||
#ifndef MARAUDER_MINI
|
||||
display_obj.tft.drawCentreString(display_obj.version_number, 120, 250, 2);
|
||||
#endif
|
||||
|
||||
#ifdef MARAUDER_MINI
|
||||
display_obj.tft.drawCentreString(display_obj.version_number, TFT_WIDTH/2, TFT_HEIGHT, 1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
digitalWrite(TFT_BL, HIGH); // Need this
|
||||
backlightOn(); // Need this
|
||||
|
||||
delay(2000);
|
||||
|
||||
display_obj.clearScreen();
|
||||
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
|
||||
display_obj.tft.println("Giving room for HardwareSerial...");
|
||||
|
||||
delay(2000);
|
||||
|
||||
display_obj.tft.println("Marauder " + display_obj.version_number + "\n");
|
||||
|
||||
display_obj.tft.println("Started Serial");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.clearScreen();
|
||||
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
|
||||
display_obj.tft.println(text_table0[0]);
|
||||
|
||||
delay(2000);
|
||||
|
||||
display_obj.tft.println("Marauder " + display_obj.version_number + "\n");
|
||||
|
||||
display_obj.tft.println(text_table0[1]);
|
||||
#endif
|
||||
|
||||
Serial.println(F("\n\n--------------------------------\n"));
|
||||
Serial.println(F(" ESP32 Marauder \n"));
|
||||
Serial.println(" " + display_obj.version_number + "\n");
|
||||
Serial.println(" " + version_number + "\n");
|
||||
Serial.println(F(" By: justcallmekoko\n"));
|
||||
Serial.println(F("--------------------------------\n\n"));
|
||||
|
||||
//Serial.println("Internal Temp: " + (String)((temprature_sens_read() - 32) / 1.8));
|
||||
|
||||
settings_obj.begin();
|
||||
|
||||
Serial.println("This is a test Channel: " + (String)settings_obj.loadSetting<uint8_t>("Channel"));
|
||||
if (settings_obj.loadSetting<bool>( "Force PMKID"))
|
||||
Serial.println("This is a test Force PMKID: true");
|
||||
else
|
||||
Serial.println("This is a test Force PMKID: false");
|
||||
|
||||
wifi_scan_obj.RunSetup();
|
||||
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
|
||||
display_obj.tft.println("Checked RAM");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[2]));
|
||||
#endif
|
||||
|
||||
// Do some SD stuff
|
||||
if(sd_obj.initSD()) {
|
||||
Serial.println(F("SD Card supported"));
|
||||
display_obj.tft.println(F("Initialized SD Card"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[3]));
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
Serial.println(F("SD Card NOT Supported"));
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println(F("Failed to Initialize SD Card"));
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println(F(text_table0[4]));
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Run display setup
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
//display_obj.RunSetup();
|
||||
|
||||
// Build menus
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
//menu_function_obj.RunSetup();
|
||||
|
||||
//display_obj.tft.println("Created Menu Structure");
|
||||
|
||||
// Battery stuff
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
battery_obj.RunSetup();
|
||||
|
||||
display_obj.tft.println(F("Checked battery configuration"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[5]));
|
||||
#endif
|
||||
|
||||
// Temperature stuff
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
temp_obj.RunSetup();
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
temp_obj.RunSetup();
|
||||
#endif
|
||||
|
||||
display_obj.tft.println(F("Initialized temperature interface"));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[6]));
|
||||
#endif
|
||||
|
||||
battery_obj.battery_level = battery_obj.getBatteryLevel();
|
||||
Serial.println("Bat lvl");
|
||||
|
||||
if (battery_obj.i2c_supported) {
|
||||
Serial.println(F("IP5306 I2C Supported: true"));
|
||||
}
|
||||
else
|
||||
Serial.println(F("IP5306 I2C Supported: false"));
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
battery_obj.battery_level = battery_obj.getBatteryLevel();
|
||||
|
||||
if (battery_obj.i2c_supported) {
|
||||
Serial.println(F("IP5306 I2C Supported: true"));
|
||||
}
|
||||
else
|
||||
Serial.println(F("IP5306 I2C Supported: false"));
|
||||
#endif
|
||||
|
||||
Serial.println(wifi_scan_obj.freeRAM());
|
||||
|
||||
// Do some LED stuff
|
||||
led_obj.RunSetup();
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
Serial.println("LED");
|
||||
led_obj.RunSetup();
|
||||
#endif
|
||||
|
||||
display_obj.tft.println(F("Initialized LED Interface"));
|
||||
|
||||
//display_obj.tft.println(F("Starting..."));
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[7]));
|
||||
#endif
|
||||
|
||||
delay(500);
|
||||
|
||||
//display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
// OG Logo Section
|
||||
/*
|
||||
digitalWrite(TFT_BL, LOW);
|
||||
|
||||
// Draw the title screen
|
||||
display_obj.drawJpeg("/marauder3L.jpg", 0 , 0); // 240 x 320 image
|
||||
|
||||
//showCenterText(version_number, 250);
|
||||
display_obj.tft.drawCentreString(display_obj.version_number, 120, 250, 2);
|
||||
|
||||
digitalWrite(TFT_BL, HIGH);
|
||||
*/
|
||||
|
||||
esp_obj.begin();
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println(F(text_table0[8]));
|
||||
|
||||
a32u4_obj.begin(); // This goes last to make sure nothing is messed up when reading serial
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
delay(2000);
|
||||
#endif
|
||||
|
||||
display_obj.tft.println(F("Starting..."));
|
||||
#ifdef HAS_SCREEN
|
||||
menu_function_obj.RunSetup();
|
||||
#endif
|
||||
|
||||
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||
|
||||
delay(2000);
|
||||
|
||||
menu_function_obj.RunSetup();
|
||||
Serial.println("CLI");
|
||||
cli_obj.RunSetup();
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
// get the current time
|
||||
//if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
|
||||
currentTime = millis();
|
||||
|
||||
// Update all of our objects
|
||||
//if ((!display_obj.draw_tft) &&
|
||||
// (wifi_scan_obj.currentScanMode != OTA_UPDATE))
|
||||
if ((!display_obj.draw_tft) && (wifi_scan_obj.currentScanMode != ESP_UPDATE))
|
||||
#ifdef HAS_SCREEN
|
||||
bool do_draw = display_obj.draw_tft;
|
||||
#else
|
||||
bool do_draw = false;
|
||||
#endif
|
||||
|
||||
if ((!do_draw) && (wifi_scan_obj.currentScanMode != ESP_UPDATE))
|
||||
{
|
||||
display_obj.main(wifi_scan_obj.currentScanMode);
|
||||
cli_obj.main(currentTime);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.main(wifi_scan_obj.currentScanMode);
|
||||
#endif
|
||||
wifi_scan_obj.main(currentTime);
|
||||
sd_obj.main();
|
||||
battery_obj.main(currentTime);
|
||||
temp_obj.main(currentTime);
|
||||
esp_obj.main(currentTime);
|
||||
a32u4_obj.main(currentTime);
|
||||
//led_obj.main(currentTime);
|
||||
//if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
|
||||
#ifndef MARAUDER_FLIPPER
|
||||
battery_obj.main(currentTime);
|
||||
temp_obj.main(currentTime);
|
||||
#endif
|
||||
settings_obj.main(currentTime);
|
||||
if ((wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) &&
|
||||
(wifi_scan_obj.currentScanMode != WIFI_SCAN_EAPOL))
|
||||
menu_function_obj.main(currentTime);
|
||||
(wifi_scan_obj.currentScanMode != WIFI_SCAN_EAPOL)) {
|
||||
#ifdef HAS_SCREEN
|
||||
menu_function_obj.main(currentTime);
|
||||
#endif
|
||||
//cli_obj.main(currentTime);
|
||||
}
|
||||
if (wifi_scan_obj.currentScanMode == OTA_UPDATE)
|
||||
web_obj.main();
|
||||
delay(1);
|
||||
}
|
||||
else if ((display_obj.draw_tft) &&
|
||||
(wifi_scan_obj.currentScanMode != OTA_UPDATE))
|
||||
{
|
||||
display_obj.drawStylus();
|
||||
}
|
||||
#ifdef HAS_SCREEN
|
||||
else if ((display_obj.draw_tft) &&
|
||||
(wifi_scan_obj.currentScanMode != OTA_UPDATE))
|
||||
{
|
||||
display_obj.drawStylus();
|
||||
}
|
||||
#endif
|
||||
else if (wifi_scan_obj.currentScanMode == ESP_UPDATE) {
|
||||
display_obj.main(wifi_scan_obj.currentScanMode);
|
||||
menu_function_obj.main(currentTime);
|
||||
esp_obj.program();
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.main(wifi_scan_obj.currentScanMode);
|
||||
menu_function_obj.main(currentTime);
|
||||
#endif
|
||||
//cli_obj.main(currentTime);
|
||||
delay(1);
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// web_obj.main();
|
||||
//}
|
||||
|
||||
//Serial.println(wifi_scan_obj.currentScanMode);
|
||||
|
||||
//Serial.print("Run Time: ");
|
||||
//Serial.print(millis() - currentTime);
|
||||
//Serial.println("ms");
|
||||
}
|
||||
|
||||
BIN
esp32_marauder/esp32_marauder_v0_9_7_20220528_flipper.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_7_20220528_flipper.bin
Normal file
Binary file not shown.
BIN
esp32_marauder/esp32_marauder_v0_9_7_20220528_kit.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_7_20220528_kit.bin
Normal file
Binary file not shown.
BIN
esp32_marauder/esp32_marauder_v0_9_7_20220528_mini.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_7_20220528_mini.bin
Normal file
Binary file not shown.
BIN
esp32_marauder/esp32_marauder_v0_9_7_20220528_new_hardware.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_7_20220528_new_hardware.bin
Normal file
Binary file not shown.
BIN
esp32_marauder/esp32_marauder_v0_9_7_20220528_old_hardware.bin
Normal file
BIN
esp32_marauder/esp32_marauder_v0_9_7_20220528_old_hardware.bin
Normal file
Binary file not shown.
@@ -16,7 +16,9 @@ void EspInterface::begin() {
|
||||
|
||||
delay(100);
|
||||
|
||||
display_obj.tft.println("Checking for ESP8266...");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.println("Checking for ESP8266...");
|
||||
#endif
|
||||
|
||||
this->bootRunMode();
|
||||
|
||||
@@ -40,16 +42,20 @@ void EspInterface::begin() {
|
||||
Serial.println("\nDisplay string: " + (String)display_string);
|
||||
|
||||
if (display_string == "ESP8266 Pong") {
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.tft.println("ESP8266 Found!");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.tft.println("ESP8266 Found!");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
Serial.println("ESP8266 Found!");
|
||||
this->supported = true;
|
||||
}
|
||||
else {
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println("ESP8266 Not Found");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextColor(TFT_RED, TFT_BLACK);
|
||||
display_obj.tft.println("ESP8266 Not Found");
|
||||
display_obj.tft.setTextColor(TFT_CYAN, TFT_BLACK);
|
||||
#endif
|
||||
}
|
||||
|
||||
this->initTime = millis();
|
||||
@@ -57,16 +63,17 @@ void EspInterface::begin() {
|
||||
|
||||
void EspInterface::RunUpdate() {
|
||||
this->bootProgramMode();
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.setTextWrap(true);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
|
||||
display_obj.tft.setTextWrap(true);
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setCursor(0, 100);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_GREEN);
|
||||
|
||||
display_obj.tft.println("Waiting for serial data...");
|
||||
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
display_obj.tft.println("Waiting for serial data...");
|
||||
|
||||
display_obj.tft.setTextColor(TFT_WHITE);
|
||||
#endif
|
||||
}
|
||||
|
||||
void EspInterface::bootProgramMode() {
|
||||
@@ -103,7 +110,9 @@ void EspInterface::program() {
|
||||
}
|
||||
|
||||
if (Serial.available()) {
|
||||
display_obj.tft.print(".");
|
||||
#ifdef HAS_SCREEN
|
||||
display_obj.tft.print(".");
|
||||
#endif
|
||||
while (Serial.available()) {
|
||||
MySerial.write((uint8_t)Serial.read());
|
||||
}
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
#ifndef esp_interface_h
|
||||
#define esp_interface_h
|
||||
|
||||
#include "Display.h"
|
||||
#include "configs.h"
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
#endif
|
||||
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
#define ESP_RST 14
|
||||
#define ESP_ZERO 13
|
||||
#define BAUD 115200
|
||||
|
||||
extern Display display_obj;
|
||||
#ifdef HAS_SCREEN
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
class EspInterface {
|
||||
public:
|
||||
|
||||
179
esp32_marauder/lang_var.h
Normal file
179
esp32_marauder/lang_var.h
Normal file
@@ -0,0 +1,179 @@
|
||||
#ifndef lang_var_h
|
||||
#define lang_var_h
|
||||
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
//Starting window texts
|
||||
PROGMEM const char text0_0[] = "Giving room for HardwareSerial...";
|
||||
PROGMEM const char text0_1[] = "Started Serial";
|
||||
PROGMEM const char text0_2[] = "Checked RAM";
|
||||
PROGMEM const char text0_3[] = "Initialized SD Card";
|
||||
PROGMEM const char text0_4[] = "Failed to Initialize SD Card";
|
||||
PROGMEM const char text0_5[] = "Checked battery configuration";
|
||||
PROGMEM const char text0_6[] = "Initialized temperature interface";
|
||||
PROGMEM const char text0_7[] = "Initialized LED Interface";
|
||||
PROGMEM const char text0_8[] = "Starting...";
|
||||
|
||||
//Single library (action) texts/Often used
|
||||
PROGMEM const char text00[] = "Battery Level changed: ";
|
||||
PROGMEM const char text01[] = "file closed";
|
||||
PROGMEM const char text02[] = "Failed to open file '";
|
||||
PROGMEM const char text03[] = "ON";
|
||||
PROGMEM const char text04[] = "OFF";
|
||||
PROGMEM const char text05[] = "Load";
|
||||
PROGMEM const char text06[] = "Save As";
|
||||
PROGMEM const char text07[] = "Exit";
|
||||
PROGMEM const char text08[] = "Settings";
|
||||
PROGMEM const char text09[] = "Back";
|
||||
PROGMEM const char text10[] = "Channel:";
|
||||
PROGMEM const char text11[] = "Touch screen to exit";
|
||||
PROGMEM const char text12[] = "Cancel";
|
||||
PROGMEM const char text13[] = "Save";
|
||||
PROGMEM const char text14[] = "Yes";
|
||||
PROGMEM const char text15[] = "Opening /update.bin...";
|
||||
PROGMEM const char text16[] = "Close";
|
||||
PROGMEM const char text17[] = "FAIL";
|
||||
PROGMEM const char text18[] = "packets/sec: ";
|
||||
|
||||
|
||||
//Menufunctions.cpp texts
|
||||
PROGMEM const char text1_0[] = "SSID List";
|
||||
PROGMEM const char text1_1[] = "Add SSIDs";
|
||||
PROGMEM const char text1_2[] = "SSID: ";
|
||||
PROGMEM const char text1_3[] = "Password:";
|
||||
PROGMEM const char text1_4[] = "Setting disabled";
|
||||
PROGMEM const char text1_5[] = "Setting on";
|
||||
PROGMEM const char text1_6[] = "ESP32 Marauder ";
|
||||
PROGMEM const char text1_7[] = "WiFi ";
|
||||
PROGMEM const char text1_8[] = "Bad USB ";
|
||||
PROGMEM const char text1_9[] = "Device ";
|
||||
PROGMEM const char text1_10[] = "General Apps ";
|
||||
PROGMEM const char text1_11[] = "Updating... ";
|
||||
PROGMEM const char text1_12[] = "Select Method ";
|
||||
PROGMEM const char text1_13[] = "Confirm Update ";
|
||||
PROGMEM const char text1_14[] = "ESP8266 Update ";
|
||||
PROGMEM const char text1_15[] = "Update Firmware ";
|
||||
PROGMEM const char text1_16[] = "Language ";
|
||||
PROGMEM const char text1_17[] = "Device Info ";
|
||||
PROGMEM const char text1_18[] = "Settings ";
|
||||
PROGMEM const char text1_19[] = "Bluetooth ";
|
||||
PROGMEM const char text1_20[] = "WiFi Sniffers ";
|
||||
PROGMEM const char text1_21[] = "WiFi Attacks ";
|
||||
PROGMEM const char text1_22[] = "WiFi General ";
|
||||
PROGMEM const char text1_23[] = "Bluetooth Sniffers ";
|
||||
PROGMEM const char text1_24[] = "Bluetooth General ";
|
||||
PROGMEM const char text1_25[] = "Shutdown WiFi ";
|
||||
PROGMEM const char text1_26[] = "Shutdown BLE ";
|
||||
PROGMEM const char text1_27[] = "Generate SSIDs ";
|
||||
PROGMEM const char text1_28[] = "Clear SSIDs ";
|
||||
PROGMEM const char text1_29[] = "Clear APs ";
|
||||
PROGMEM const char text1_30[] = "Reboot";
|
||||
PROGMEM const char text1_31[] = "Sniffers";
|
||||
PROGMEM const char text1_32[] = "Attacks";
|
||||
PROGMEM const char text1_33[] = "General";
|
||||
PROGMEM const char text1_34[] = "Bluetooth Sniffer";
|
||||
PROGMEM const char text1_35[] = "Detect Card Skimmers";
|
||||
PROGMEM const char text1_36[] = "Test BadUSB";
|
||||
PROGMEM const char text1_37[] = "Run Ducky Script";
|
||||
PROGMEM const char text1_38[] = "Draw";
|
||||
PROGMEM const char text1_39[] = "Web Update";
|
||||
PROGMEM const char text1_40[] = "SD Update";
|
||||
PROGMEM const char text1_41[] = "ESP8266 Update";
|
||||
PROGMEM const char text1_42[] = "Probe Request Sniff";
|
||||
PROGMEM const char text1_43[] = "Beacon Sniff";
|
||||
PROGMEM const char text1_44[] = "Deauth Sniff";
|
||||
PROGMEM const char text1_45[] = "Packet Monitor";
|
||||
PROGMEM const char text1_46[] = "EAPOL/PMKID Scan";
|
||||
PROGMEM const char text1_47[] = "Detect Pwnagotchi";
|
||||
PROGMEM const char text1_48[] = "Detect Espressif";
|
||||
PROGMEM const char text1_49[] = "Scan APs";
|
||||
PROGMEM const char text1_50[] = "Beacon Spam List";
|
||||
PROGMEM const char text1_51[] = "Beacon Spam Random";
|
||||
PROGMEM const char text1_52[] = "Rick Roll Beacon";
|
||||
PROGMEM const char text1_53[] = "Probe Req Flood";
|
||||
PROGMEM const char text1_54[] = "Deauth Flood";
|
||||
PROGMEM const char text1_55[] = "Join WiFi";
|
||||
PROGMEM const char text1_56[] = "Select APs";
|
||||
|
||||
|
||||
//SDInterface.cpp texts
|
||||
PROGMEM const char text2_0[] = "Error, could not find update.bin";
|
||||
PROGMEM const char text2_1[] = "Starting SD Update...";
|
||||
PROGMEM const char text2_2[] = "Error, update.bin is empty";
|
||||
PROGMEM const char text2_3[] = "\nRebooting...\n";
|
||||
PROGMEM const char text2_4[] = "Could not load update.bin from /";
|
||||
PROGMEM const char text2_5[] = "File size: ";
|
||||
PROGMEM const char text2_6[] = "Writing file to partition...";
|
||||
PROGMEM const char text2_7[] = "Written: ";
|
||||
PROGMEM const char text2_8[] = "Written only : ";
|
||||
PROGMEM const char text2_9[] = ". Retry?";
|
||||
PROGMEM const char text2_10[] = " successfully";
|
||||
PROGMEM const char text2_11[] = "Update complete";
|
||||
PROGMEM const char text2_12[] = "Update could not complete";
|
||||
PROGMEM const char text2_13[] = "Error Occurred. Error #: ";
|
||||
PROGMEM const char text2_14[] = "Not enough space to begin OTA";
|
||||
|
||||
//Web.cpp texts
|
||||
PROGMEM const char text3_0[] = "Configuring update server...\n\n";
|
||||
PROGMEM const char text3_1[] = "IP address: ";
|
||||
PROGMEM const char text3_2[] = "Update: ";
|
||||
PROGMEM const char text3_3[] = "Bytes complete: ";
|
||||
PROGMEM const char text3_4[] = "Update Success: ";
|
||||
PROGMEM const char text3_5[] = "\nCompleted update server setup";
|
||||
|
||||
//WiFiScan.cpp texts
|
||||
PROGMEM const char text4_0[] = " RSSI: ";
|
||||
PROGMEM const char text4_1[] = "Potential Skimmer: ";
|
||||
PROGMEM const char text4_2[] = "Already Connected";
|
||||
PROGMEM const char text4_3[] = "Failed to connect";
|
||||
PROGMEM const char text4_4[] = "Connected";
|
||||
PROGMEM const char text4_5[] = "Force PMKID";
|
||||
PROGMEM const char text4_6[] = "Force Probe";
|
||||
PROGMEM const char text4_7[] = "Save PCAP";
|
||||
PROGMEM const char text4_8[] = "Probe Flood";
|
||||
PROGMEM const char text4_9[] = "Clearing APs...";
|
||||
PROGMEM const char text4_10[] = "APs Cleared: ";
|
||||
PROGMEM const char text4_11[] = "Clearing SSIDs...";
|
||||
PROGMEM const char text4_12[] = "SSIDs Cleared: ";
|
||||
PROGMEM const char text4_13[] = "Generating SSIDs...";
|
||||
PROGMEM const char text4_14[] = "SSIDs Generated: "; //Add spaces before to match : [15]
|
||||
PROGMEM const char text4_15[] = " Total SSIDs: "; //Add spaces beforer to match : [14]
|
||||
PROGMEM const char text4_16[] = "Shutting down WiFi...";
|
||||
PROGMEM const char text4_17[] = "WiFi not currently initialized";
|
||||
PROGMEM const char text4_18[] = "Shutting down BLE...";
|
||||
PROGMEM const char text4_19[] = "BLE not currently initialized";
|
||||
PROGMEM const char text4_20[] = " Firmware: Marauder"; //From 20 to 35 add spaces so : is in line like it is now
|
||||
PROGMEM const char text4_21[] = " Version: ";
|
||||
PROGMEM const char text4_22[] = " ESP-IDF: ";
|
||||
PROGMEM const char text4_23[] = " WSL Bypass: enabled\n";
|
||||
PROGMEM const char text4_24[] = " WSL Bypass: disabled\n";
|
||||
PROGMEM const char text4_25[] = " Station MAC: ";
|
||||
PROGMEM const char text4_26[] = " AP MAC: ";
|
||||
PROGMEM const char text4_27[] = " ";
|
||||
PROGMEM const char text4_28[] = " SD Card: Connected";
|
||||
PROGMEM const char text4_29[] = " SD Card Size: ";
|
||||
PROGMEM const char text4_30[] = " SD Card: Not Connected";
|
||||
PROGMEM const char text4_31[] = " SD Card Size: 0";
|
||||
PROGMEM const char text4_32[] = " IP5306 I2C: supported";
|
||||
PROGMEM const char text4_33[] = " Battery Lvl: ";
|
||||
PROGMEM const char text4_34[] = " IP5306 I2C: not supported";
|
||||
PROGMEM const char text4_35[] = "Internal temp: ";
|
||||
PROGMEM const char text4_36[] = " Detect Espressif ";
|
||||
PROGMEM const char text4_37[] = " Detect Pwnagotchi ";
|
||||
PROGMEM const char text4_38[] = " Beacon Sniffer ";
|
||||
PROGMEM const char text4_39[] = " Deauthentication Sniffer ";
|
||||
PROGMEM const char text4_40[] = " Probe Request Sniffer ";
|
||||
PROGMEM const char text4_41[] = " Bluetooth Sniff ";
|
||||
PROGMEM const char text4_42[] = " Detect Card Skimmers ";
|
||||
PROGMEM const char text4_43[] = "Scanning for\nBluetooth-enabled skimmers\nHC-03, HC-05, and HC-06...";
|
||||
PROGMEM const char text4_44[] = " AP Scan ";
|
||||
|
||||
//Making tables
|
||||
PROGMEM const char *text_table0[] = {text0_0,text0_1, text0_2, text0_3, text0_4, text0_5, text0_6, text0_7, text0_8};
|
||||
PROGMEM const char *text_table1[] = {text1_0,text1_1,text1_2,text1_3,text1_4,text1_5,text1_6,text1_7,text1_8,text1_9,text1_10,text1_11,text1_12,text1_13,text1_14,text1_15,text1_16,text1_17,text1_18,text1_19,text1_20,text1_21,text1_22,text1_23,text1_24,text1_25,text1_26,text1_27,text1_28,text1_29,text1_30,text1_31,text1_32,text1_33,text1_34,text1_35,text1_36,text1_37,text1_38,text1_39,text1_40,text1_41,text1_42,text1_43,text1_44,text1_45,text1_46,text1_47,text1_48,text1_49,text1_50,text1_51,text1_52,text1_53,text1_54,text1_55,text1_56};
|
||||
PROGMEM const char *text_table2[] = {text2_0,text2_1,text2_2,text2_3,text2_4,text2_5,text2_6,text2_7,text2_8,text2_9,text2_10,text2_11,text2_12,text2_13,text2_14};
|
||||
PROGMEM const char *text_table3[] = {text3_0,text3_1,text3_2,text3_3,text3_4,text3_5};
|
||||
PROGMEM const char *text_table4[] = {text4_0,text4_1,text4_2,text4_3,text4_4,text4_5,text4_6,text4_7,text4_8,text4_9,text4_10,text4_11,text4_12,text4_13,text4_14,text4_15,text4_16,text4_17,text4_18,text4_19,text4_20,text4_21,text4_22,text4_23,text4_24,text4_25,text4_26,text4_27,text4_28,text4_29,text4_30,text4_31,text4_32,text4_33,text4_34,text4_35,text4_36,text4_37,text4_38,text4_39,text4_40,text4_41,text4_42,text4_43,text4_44};
|
||||
|
||||
#endif
|
||||
304
esp32_marauder/settings.cpp
Normal file
304
esp32_marauder/settings.cpp
Normal file
@@ -0,0 +1,304 @@
|
||||
#include "settings.h"
|
||||
|
||||
String Settings::getSettingsString() {
|
||||
return this->json_settings_string;
|
||||
}
|
||||
|
||||
bool Settings::begin() {
|
||||
if(!SPIFFS.begin(FORMAT_SPIFFS_IF_FAILED)){
|
||||
Serial.println("Settings SPIFFS Mount Failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
File settingsFile;
|
||||
|
||||
//SPIFFS.remove("/settings.json"); // NEED TO REMOVE THIS LINE
|
||||
|
||||
if (SPIFFS.exists("/settings.json")) {
|
||||
settingsFile = SPIFFS.open("/settings.json", FILE_READ);
|
||||
|
||||
if (!settingsFile) {
|
||||
settingsFile.close();
|
||||
Serial.println(F("Could not find settings file"));
|
||||
if (this->createDefaultSettings(SPIFFS))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Serial.println("Settings file does not exist");
|
||||
if (this->createDefaultSettings(SPIFFS))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
String json_string;
|
||||
DynamicJsonDocument jsonBuffer(1024);
|
||||
DeserializationError error = deserializeJson(jsonBuffer, settingsFile);
|
||||
serializeJson(jsonBuffer, json_string);
|
||||
Serial.println("Settings: " + (String)json_string + "\n");
|
||||
this->printJsonSettings(json_string);
|
||||
|
||||
this->json_settings_string = json_string;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T Settings::loadSetting(String key) {}
|
||||
|
||||
// Get type int settings
|
||||
template<>
|
||||
int Settings::loadSetting<int>(String key) {
|
||||
DynamicJsonDocument json(1024); // ArduinoJson v6
|
||||
|
||||
if (deserializeJson(json, this->json_settings_string)) {
|
||||
Serial.println("\nCould not parse json");
|
||||
}
|
||||
|
||||
for (int i = 0; i < json["Settings"].size(); i++) {
|
||||
if (json["Settings"][i]["name"].as<String>() == key)
|
||||
return json["Settings"][i]["value"];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Get type string settings
|
||||
template<>
|
||||
String Settings::loadSetting<String>(String key) {
|
||||
//return this->json_settings_string;
|
||||
|
||||
DynamicJsonDocument json(1024); // ArduinoJson v6
|
||||
|
||||
if (deserializeJson(json, this->json_settings_string)) {
|
||||
Serial.println("\nCould not parse json");
|
||||
}
|
||||
|
||||
for (int i = 0; i < json["Settings"].size(); i++) {
|
||||
if (json["Settings"][i]["name"].as<String>() == key)
|
||||
return json["Settings"][i]["value"];
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
// Get type bool settings
|
||||
template<>
|
||||
bool Settings::loadSetting<bool>(String key) {
|
||||
DynamicJsonDocument json(1024); // ArduinoJson v6
|
||||
|
||||
if (deserializeJson(json, this->json_settings_string)) {
|
||||
Serial.println("\nCould not parse json");
|
||||
}
|
||||
|
||||
for (int i = 0; i < json["Settings"].size(); i++) {
|
||||
if (json["Settings"][i]["name"].as<String>() == key)
|
||||
return json["Settings"][i]["value"];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//Get type uint8_t settings
|
||||
template<>
|
||||
uint8_t Settings::loadSetting<uint8_t>(String key) {
|
||||
DynamicJsonDocument json(1024); // ArduinoJson v6
|
||||
|
||||
if (deserializeJson(json, this->json_settings_string)) {
|
||||
Serial.println("\nCould not parse json");
|
||||
}
|
||||
|
||||
for (int i = 0; i < json["Settings"].size(); i++) {
|
||||
if (json["Settings"][i]["name"].as<String>() == key)
|
||||
return json["Settings"][i]["value"];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T Settings::saveSetting(String key, bool value) {}
|
||||
|
||||
template<>
|
||||
bool Settings::saveSetting<bool>(String key, bool value) {
|
||||
DynamicJsonDocument json(1024); // ArduinoJson v6
|
||||
|
||||
if (deserializeJson(json, this->json_settings_string)) {
|
||||
Serial.println("\nCould not parse json");
|
||||
}
|
||||
|
||||
String settings_string;
|
||||
|
||||
for (int i = 0; i < json["Settings"].size(); i++) {
|
||||
if (json["Settings"][i]["name"].as<String>() == key) {
|
||||
json["Settings"][i]["value"] = value;
|
||||
|
||||
Serial.println("Saving setting...");
|
||||
|
||||
File settingsFile = SPIFFS.open("/settings.json", FILE_WRITE);
|
||||
|
||||
if (!settingsFile) {
|
||||
Serial.println(F("Failed to create settings file"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (serializeJson(json, settingsFile) == 0) {
|
||||
Serial.println(F("Failed to write to file"));
|
||||
}
|
||||
if (serializeJson(json, settings_string) == 0) {
|
||||
Serial.println(F("Failed to write to string"));
|
||||
}
|
||||
|
||||
// Close the file
|
||||
settingsFile.close();
|
||||
|
||||
this->json_settings_string = settings_string;
|
||||
|
||||
this->printJsonSettings(settings_string);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Settings::toggleSetting(String key) {
|
||||
DynamicJsonDocument json(1024); // ArduinoJson v6
|
||||
|
||||
if (deserializeJson(json, this->json_settings_string)) {
|
||||
Serial.println("\nCould not parse json");
|
||||
}
|
||||
|
||||
for (int i = 0; i < json["Settings"].size(); i++) {
|
||||
if (json["Settings"][i]["name"].as<String>() == key) {
|
||||
if (json["Settings"][i]["value"]) {
|
||||
saveSetting<bool>(key, false);
|
||||
Serial.println("Setting value to false");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
saveSetting<bool>(key, true);
|
||||
Serial.println("Setting value to true");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String Settings::setting_index_to_name(int i) {
|
||||
DynamicJsonDocument json(1024); // ArduinoJson v6
|
||||
|
||||
if (deserializeJson(json, this->json_settings_string)) {
|
||||
Serial.println("\nCould not parse json");
|
||||
}
|
||||
|
||||
return json["Settings"][i]["name"];
|
||||
}
|
||||
|
||||
int Settings::getNumberSettings() {
|
||||
DynamicJsonDocument json(1024); // ArduinoJson v6
|
||||
|
||||
if (deserializeJson(json, this->json_settings_string)) {
|
||||
Serial.println("\nCould not parse json");
|
||||
}
|
||||
|
||||
return json["Settings"].size();
|
||||
}
|
||||
|
||||
String Settings::getSettingType(String key) {
|
||||
DynamicJsonDocument json(1024); // ArduinoJson v6
|
||||
|
||||
if (deserializeJson(json, this->json_settings_string)) {
|
||||
Serial.println("\nCould not parse json");
|
||||
}
|
||||
|
||||
for (int i = 0; i < json["Settings"].size(); i++) {
|
||||
if (json["Settings"][i]["name"].as<String>() == key)
|
||||
return json["Settings"][i]["type"];
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::printJsonSettings(String json_string) {
|
||||
DynamicJsonDocument json(1024); // ArduinoJson v6
|
||||
|
||||
if (deserializeJson(json, json_string)) {
|
||||
Serial.println("\nCould not parse json");
|
||||
}
|
||||
|
||||
Serial.println("Settings\n----------------------------------------------");
|
||||
for (int i = 0; i < json["Settings"].size(); i++) {
|
||||
Serial.println("Name: " + json["Settings"][i]["name"].as<String>());
|
||||
Serial.println("Type: " + json["Settings"][i]["type"].as<String>());
|
||||
Serial.println("Value: " + json["Settings"][i]["value"].as<String>());
|
||||
Serial.println("----------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
bool Settings::createDefaultSettings(fs::FS &fs) {
|
||||
Serial.println(F("Creating default settings file: settings.json"));
|
||||
|
||||
File settingsFile = fs.open("/settings.json", FILE_WRITE);
|
||||
|
||||
if (!settingsFile) {
|
||||
Serial.println(F("Failed to create settings file"));
|
||||
return false;
|
||||
}
|
||||
|
||||
DynamicJsonDocument jsonBuffer(1024);
|
||||
String settings_string;
|
||||
|
||||
//jsonBuffer["Settings"][0]["name"] = "Channel";
|
||||
//jsonBuffer["Settings"][0]["type"] = "uint8_t";
|
||||
//jsonBuffer["Settings"][0]["value"] = 11;
|
||||
//jsonBuffer["Settings"][0]["range"]["min"] = 1;
|
||||
//jsonBuffer["Settings"][0]["range"]["max"] = 14;
|
||||
|
||||
//jsonBuffer["Settings"][1]["name"] = "Channel Hop Delay";
|
||||
//jsonBuffer["Settings"][1]["type"] = "int";
|
||||
//jsonBuffer["Settings"][1]["value"] = 1;
|
||||
//jsonBuffer["Settings"][1]["range"]["min"] = 1;
|
||||
//jsonBuffer["Settings"][1]["range"]["max"] = 10;
|
||||
|
||||
jsonBuffer["Settings"][0]["name"] = "Force PMKID";
|
||||
jsonBuffer["Settings"][0]["type"] = "bool";
|
||||
jsonBuffer["Settings"][0]["value"] = true;
|
||||
jsonBuffer["Settings"][0]["range"]["min"] = false;
|
||||
jsonBuffer["Settings"][0]["range"]["max"] = true;
|
||||
|
||||
jsonBuffer["Settings"][1]["name"] = "Force Probe";
|
||||
jsonBuffer["Settings"][1]["type"] = "bool";
|
||||
jsonBuffer["Settings"][1]["value"] = true;
|
||||
jsonBuffer["Settings"][1]["range"]["min"] = false;
|
||||
jsonBuffer["Settings"][1]["range"]["max"] = true;
|
||||
|
||||
jsonBuffer["Settings"][2]["name"] = "Save PCAP";
|
||||
jsonBuffer["Settings"][2]["type"] = "bool";
|
||||
jsonBuffer["Settings"][2]["value"] = true;
|
||||
jsonBuffer["Settings"][2]["range"]["min"] = false;
|
||||
jsonBuffer["Settings"][2]["range"]["max"] = true;
|
||||
|
||||
//jsonBuffer.printTo(settingsFile);
|
||||
if (serializeJson(jsonBuffer, settingsFile) == 0) {
|
||||
Serial.println(F("Failed to write to file"));
|
||||
}
|
||||
if (serializeJson(jsonBuffer, settings_string) == 0) {
|
||||
Serial.println(F("Failed to write to string"));
|
||||
}
|
||||
|
||||
// Close the file
|
||||
settingsFile.close();
|
||||
|
||||
this->json_settings_string = settings_string;
|
||||
|
||||
this->printJsonSettings(settings_string);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Settings::main(uint32_t currentTime) {
|
||||
|
||||
}
|
||||
56
esp32_marauder/settings.h
Normal file
56
esp32_marauder/settings.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef Settings_h
|
||||
#define Settings_h
|
||||
|
||||
#include "configs.h"
|
||||
|
||||
#include "SPIFFS.h"
|
||||
#include <FS.h>
|
||||
#include <ArduinoJson.h>
|
||||
|
||||
#define FORMAT_SPIFFS_IF_FAILED true
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
#include "Display.h"
|
||||
|
||||
extern Display display_obj;
|
||||
#endif
|
||||
|
||||
class Settings {
|
||||
|
||||
private:
|
||||
String json_settings_string;
|
||||
|
||||
void printJsonSettings(String json_string);
|
||||
bool createDefaultSettings(fs::FS &fs);
|
||||
|
||||
public:
|
||||
bool begin();
|
||||
|
||||
template <typename T>
|
||||
T loadSetting(String name);
|
||||
|
||||
template <typename T>
|
||||
T saveSetting(String key, bool value);
|
||||
|
||||
bool toggleSetting(String key);
|
||||
String getSettingType(String key);
|
||||
String setting_index_to_name(int i);
|
||||
int getNumberSettings();
|
||||
|
||||
//template<>
|
||||
//int loadSetting<int>(String key);
|
||||
|
||||
//template<>
|
||||
//String loadSetting<String>(String key);
|
||||
|
||||
//template<>
|
||||
//bool loadSetting<bool>(String key);
|
||||
|
||||
//template<>
|
||||
//uint8_t loadSetting<uint8_t>(String key);
|
||||
|
||||
String getSettingsString();
|
||||
void main(uint32_t currentTime);
|
||||
};
|
||||
|
||||
#endif
|
||||
BIN
mechanical/Marauder-Mini/Marauder-Mini-Assembly.f3z
Normal file
BIN
mechanical/Marauder-Mini/Marauder-Mini-Assembly.f3z
Normal file
Binary file not shown.
137017
mechanical/Marauder-Mini/Marauder-Mini-Assembly.step
Normal file
137017
mechanical/Marauder-Mini/Marauder-Mini-Assembly.step
Normal file
File diff suppressed because it is too large
Load Diff
BIN
mechanical/Marauder-Mini/Marauder-Mini_Bottom.stl
Normal file
BIN
mechanical/Marauder-Mini/Marauder-Mini_Bottom.stl
Normal file
Binary file not shown.
BIN
mechanical/Marauder-Mini/Marauder-Mini_Top.stl
Normal file
BIN
mechanical/Marauder-Mini/Marauder-Mini_Top.stl
Normal file
Binary file not shown.
BIN
mechanical/Marauder-Mini/Marauder-Mini_Top_cutout.stl
Normal file
BIN
mechanical/Marauder-Mini/Marauder-Mini_Top_cutout.stl
Normal file
Binary file not shown.
BIN
pictures/IMG_3475 - Copy.jpg
Normal file
BIN
pictures/IMG_3475 - Copy.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
BIN
pictures/IMG_3484 - Copy.jpg
Normal file
BIN
pictures/IMG_3484 - Copy.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
BIN
pictures/IMG_3485 - Copy.jpg
Normal file
BIN
pictures/IMG_3485 - Copy.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 286 KiB |
BIN
pictures/IMG_3491 - Copy.jpg
Normal file
BIN
pictures/IMG_3491 - Copy.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 509 KiB |
Reference in New Issue
Block a user