Compare commits

...

72 Commits

Author SHA1 Message Date
Just Call Me Koko
07b57ae7b8 Release v0.9.13 2022-08-06 12:57:07 -04:00
Just Call Me Koko
2e469d1410 Add rssi and setting reset 2022-08-06 12:37:09 -04:00
improving-rigmarole
d0d3c40ad3 fix sniffpmkid SSID visible (#140) 2022-08-04 18:55:57 -04:00
Just Call Me Koko
9c0f627176 Fix stopscan and sniffpmkid 2022-08-04 09:07:11 -04:00
Just Call Me Koko
3d602d7555 Release v0.9.13-rc1 2022-08-02 14:19:22 -04:00
Just Call Me Koko
e8693c95f4 Fix mini update menu 2022-08-02 14:03:43 -04:00
Just Call Me Koko
cebfc5b5c1 Release v0.9.12 2022-08-01 18:03:48 -04:00
Just Call Me Koko
1291c7f322 Add settings command and SD CS 2022-08-01 17:03:07 -04:00
Just Call Me Koko
b234cee7ea Update README.md 2022-07-31 15:50:59 -04:00
Just Call Me Koko
792b4e5ac9 Release v0.9.11 2022-07-31 15:42:56 -04:00
Just Call Me Koko
09de10d95c packet monitor eapol scan formatting 2022-07-31 14:53:21 -04:00
Just Call Me Koko
898dd1242d Fix screen buffer formatting 2022-07-31 11:45:28 -04:00
Just Call Me Koko
4f04e91d0a Add screen buffer for mini 2022-07-30 20:48:25 -04:00
Just Call Me Koko
b7c2d668b5 Select all and flipper LED 2022-07-30 14:12:51 -04:00
Just Call Me Koko
cbcfa10330 v0.9.10 Release 2022-07-18 18:50:30 -04:00
Just Call Me Koko
88777524e0 Release v0.9.9 2022-06-28 15:26:44 -04:00
Just Call Me Koko
f2d48d229a PMKID deauth optional 2022-06-22 19:17:25 -04:00
Just Call Me Koko
4aa93e2cc3 Send deauth for pmkid 2022-06-20 21:17:06 -04:00
Just Call Me Koko
00a785343c Update README.md 2022-06-18 19:55:01 -04:00
Just Call Me Koko
01b0520aec AP obfuscation attack 2022-06-18 03:22:13 -04:00
Just Call Me Koko
2468abba22 Save a beacon packet 2022-06-14 23:09:58 -04:00
Just Call Me Koko
355236dc42 Add targeted ap beacon spam 2022-06-13 20:18:20 -04:00
Just Call Me Koko
80f99f78a7 Add channel arg to pmkid sniff 2022-06-13 19:36:51 -04:00
Just Call Me Koko
809f0fb19d Release v0.9.8 2022-06-10 16:34:43 -04:00
Just Call Me Koko
71d5391066 Add help command 2022-06-03 21:02:20 -04:00
Just Call Me Koko
1988ec5808 Fix OTA update shutdown via CLI 2022-06-03 15:31:44 -04:00
Just Call Me Koko
2b130b9d11 Add more sniff and attack commands 2022-06-03 15:21:57 -04:00
Just Call Me Koko
0091c5642a print eapol when received 2022-06-03 12:39:44 -04:00
Just Call Me Koko
a80bba9b18 Add SSID commands 2022-06-02 17:13:54 -04:00
Just Call Me Koko
d686353322 Add attack command to CLI 2022-06-01 18:11:47 -04:00
Just Call Me Koko
ae8f8e870f Add more cmd, clean serial, add ascii 2022-05-31 22:46:28 -04:00
Gregor Hermani
d11faf5996 add OG-Marauder enclosure (#124)
* add Marauder Mini Case and rearrange files

* Add OG-Marauder Enclosure
2022-05-31 12:26:21 -04:00
Just Call Me Koko
6ae350dded Re-release v0.9.7 2022-05-28 14:50:00 -04:00
Just Call Me Koko
9a1ee15345 v0.9.7 Release 2022-05-28 14:29:15 -04:00
Just Call Me Koko
da538934e3 Trims serial input for PuTTY 2022-05-28 13:51:12 -04:00
Just Call Me Koko
e2b52f74e5 Merge pull request #122 from justcallmekoko/develop
Fix Marauder OTA for Flipper Zero
2022-05-28 09:51:00 -04:00
Just Call Me Koko
546afc63a7 Fix Marauder OTA for Flipper Zero 2022-05-28 09:47:06 -04:00
Just Call Me Koko
2f0d05a538 Develop (#121)
* Adding new library, changing way of displaying texts (#118)

* Adding custom icon for language button

* Adding new library, changing way of displaying texts

Added new library to make incoming translation possible to exists at the same time.

* Prepare for flipper integration

* More flipper wifi dev board work

* Add command parse

* Add set channel

* Create bins for release v0.9.6

Co-authored-by: mlodawy <105587112+mlodawy@users.noreply.github.com>
2022-05-28 09:06:59 -04:00
mlodawy
9f013d3d52 Adding custom icon for language button (#117) 2022-05-16 11:10:54 -04:00
mlodawy
45db8f3c22 Merge pull request #1 from justcallmekoko/master (#116) 2022-05-15 11:04:36 -04:00
Just Call Me Koko
e490b40196 Merge branch 'master' into master 2022-05-15 11:01:25 -04:00
mlodawy
72edd3d43d Add langauge button 2022-05-15 16:54:53 +02:00
Just Call Me Koko
bc6a07f5cb Add polish potato 2022-05-15 10:17:32 -04:00
Just Call Me Koko
bd7a350a9b Resize Marauder logo 2022-05-11 23:48:30 -04:00
Just Call Me Koko
cdd0ee5976 Add sniff deauth command 2022-05-11 18:53:55 -04:00
Just Call Me Koko
d7aac68866 Center click exit scan 2022-05-09 20:30:08 -04:00
Just Call Me Koko
0f58a0657b PROGMEM commands and remove mini lv_arduino 2022-05-07 14:36:44 -04:00
Gregor Hermani
d9a6966574 add Marauder Mini Case and rearrange files (#112) 2022-05-04 10:12:57 -04:00
Just Call Me Koko
5341c559be Add come cli commands 2022-05-03 00:44:07 -04:00
Just Call Me Koko
2c4edd012d Add some command line stuff 2022-05-03 00:22:11 -04:00
Just Call Me Koko
3b09650363 Merge branch 'master' of https://github.com/justcallmekoko/ESP32Marauder 2022-05-02 21:44:43 -04:00
Just Call Me Koko
7d6d0517e1 Add Marauder Mini Configuration 2022-05-02 21:44:42 -04:00
Just Call Me Koko
30020dd710 Add files via upload 2022-04-29 11:51:46 -04:00
Just Call Me Koko
3d2bb75081 Add files via upload 2022-04-29 11:51:29 -04:00
Just Call Me Koko
95841e5384 Add files via upload 2022-04-29 11:50:14 -04:00
Just Call Me Koko
a73ae2bbcb Create README.md 2022-04-29 11:48:52 -04:00
Just Call Me Koko
ae1aebde50 Add files via upload 2022-04-29 11:46:44 -04:00
Just Call Me Koko
9134280c6a Add files via upload 2022-04-29 11:45:23 -04:00
Just Call Me Koko
93d0f2e1d2 Create PCB_ESP32 Marauder 3.5 Kit V3 PCB_2022-04-29.json 2022-04-29 11:40:20 -04:00
Just Call Me Koko
e3f365febf Create PCB_ESP32 Marauder 3.7 OG PCB_2022-04-29.json 2022-04-29 11:38:31 -04:00
Just Call Me Koko
66576c1908 Create PCB_ESP32 Marauder 6 PCB_2022-04-29.json 2022-04-29 11:28:22 -04:00
Just Call Me Koko
8c53ac679f Update README.md 2022-01-19 11:36:25 -05:00
Just Call Me Koko
2d33c0b5ab Re-release v0.9.5
Fix some screen issues I guess?
2022-01-19 11:30:18 -05:00
Just Call Me Koko
ec4fc7487f Release v0.9.5 2022-01-18 23:30:10 -05:00
Just Call Me Koko
71ced23041 Settings actually work 2022-01-18 23:20:42 -05:00
Just Call Me Koko
8e874c493b Actually made settings work 2022-01-18 03:29:45 -05:00
Just Call Me Koko
373482822a Make settings available on Menu 2021-07-28 23:24:18 -04:00
Just Call Me Koko
bca0f70073 Add specific setting retrieval 2021-07-27 22:06:04 -04:00
Just Call Me Koko
37c65bf6f1 Add settings function 2021-07-25 21:33:21 -04:00
Just Call Me Koko
b7be44d5ea Update Display.h 2021-07-25 11:54:29 -04:00
Just Call Me Koko
503e65e012 Update README.md for version 0.9.3 2021-07-24 12:23:56 -04:00
Just Call Me Koko
a78d5b792c Create MarauderOTA firmware 2021-07-24 12:00:11 -04:00
112 changed files with 543853 additions and 6288 deletions

309
MarauderOTA/MarauderOTA.ino Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

1
PCBs/v4(OG)/README.md Normal file
View File

@@ -0,0 +1 @@
Further resources can be found [here](http://www.lcdwiki.com/2.8inch_SPI_Module_ILI9341_SKU:MSP2807)

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -3,7 +3,7 @@
<!---[![Build Status](https://travis-ci.com/justcallmekoko/ESP32Marauder.svg?branch=master)](https://travis-ci.com/justcallmekoko/ESP32Marauder)--->
<!---Shields/Badges https://shields.io/--->
# ESP32 Marauder v0.9.1
# ESP32 Marauder v0.9.13
<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>

File diff suppressed because one or more lines are too long

View File

@@ -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
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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

View File

@@ -0,0 +1,609 @@
#include "CommandLine.h"
CommandLine::CommandLine() {
}
void CommandLine::RunSetup() {
Serial.println(this->ascii_art);
Serial.println(F("\n\n--------------------------------\n"));
Serial.println(F(" ESP32 Marauder \n"));
Serial.println(" " + version_number + "\n");
Serial.println(F(" By: justcallmekoko\n"));
Serial.println(F("--------------------------------\n\n"));
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, char* delim) {
LinkedList<String> cmd_args;
if (input != "") {
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);
}
}
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;
}
bool CommandLine::checkValueExists(LinkedList<String>* cmd_args_list, int index) {
if (index < cmd_args_list->size() - 1)
return true;
return false;
}
bool CommandLine::inRange(int max, int index) {
if ((index >= 0) && (index < max))
return true;
return false;
}
bool CommandLine::apSelected() {
for (int i = 0; i < access_points->size(); i++) {
if (access_points->get(i).selected)
return true;
}
return false;
}
bool CommandLine::hasSSIDs() {
if (ssids->size() == 0)
return false;
return true;
}
void CommandLine::runCommand(String input) {
if (input != "")
Serial.println("#" + input);
else
return;
LinkedList<String> cmd_args = this->parseCommand(input, " ");
//// Admin commands
// Help
if (cmd_args.get(0) == HELP_CMD) {
Serial.println(HELP_HEAD);
Serial.println(HELP_CH_CMD);
Serial.println(HELP_SETTINGS_CMD);
Serial.println(HELP_CLEARAP_CMD_A);
Serial.println(HELP_CLEARAP_CMD_B);
Serial.println(HELP_REBOOT_CMD);
Serial.println(HELP_UPDATE_CMD_A);
Serial.println(HELP_UPDATE_CMD_B);
// WiFi sniff/scan
Serial.println(HELP_SCANAP_CMD);
Serial.println(HELP_SNIFF_BEACON_CMD);
Serial.println(HELP_SNIFF_PROBE_CMD);
Serial.println(HELP_SNIFF_PWN_CMD);
Serial.println(HELP_SNIFF_ESP_CMD);
Serial.println(HELP_SNIFF_DEAUTH_CMD);
Serial.println(HELP_SNIFF_PMKID_CMD);
Serial.println(HELP_STOPSCAN_CMD);
// WiFi attack
Serial.println(HELP_ATTACK_CMD);
// WiFi Aux
Serial.println(HELP_LIST_AP_CMD_A);
Serial.println(HELP_LIST_AP_CMD_B);
Serial.println(HELP_SEL_CMD_A);
Serial.println(HELP_SEL_CMD_B);
Serial.println(HELP_SSID_CMD_A);
Serial.println(HELP_SSID_CMD_B);
// Bluetooth sniff/scan
Serial.println(HELP_BT_SNIFF_CMD);
Serial.println(HELP_BT_SKIM_CMD);
Serial.println(HELP_FOOT);
return;
}
// Stop Scan
if (cmd_args.get(0) == STOPSCAN_CMD) {
if (wifi_scan_obj.currentScanMode == OTA_UPDATE) {
wifi_scan_obj.currentScanMode = WIFI_SCAN_OFF;
//#ifdef HAS_SCREEN
// menu_function_obj.changeMenu(menu_function_obj.updateMenu.parentMenu);
//#endif
WiFi.softAPdisconnect(true);
web_obj.shutdownServer();
return;
}
wifi_scan_obj.StartScan(WIFI_SCAN_OFF);
Serial.println("Stopping WiFi tran/recv");
// 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) {
int ap_sw = this->argSearch(&cmd_args, "-a"); // APs
int ss_sw = this->argSearch(&cmd_args, "-s"); // SSIDs
if (ap_sw != -1)
wifi_scan_obj.RunClearAPs();
if (ss_sw != -1)
wifi_scan_obj.RunClearSSIDs();
}
else if (cmd_args.get(0) == SETTINGS_CMD) {
int ss_sw = this->argSearch(&cmd_args, "-s"); // Set setting
int re_sw = this->argSearch(&cmd_args, "-r"); // Reset setting
int en_sw = this->argSearch(&cmd_args, "enable"); // enable setting
int da_sw = this->argSearch(&cmd_args, "disable"); // disable setting
if (re_sw != -1) {
settings_obj.createDefaultSettings(SPIFFS);
return;
}
if (ss_sw == -1) {
settings_obj.printJsonSettings(settings_obj.getSettingsString());
}
else {
bool result = false;
String setting_name = cmd_args.get(ss_sw + 1);
if (en_sw != -1)
result = settings_obj.saveSetting<bool>(setting_name, true);
else if (da_sw != -1)
result = settings_obj.saveSetting<bool>(setting_name, false);
else {
Serial.println("You did not properly enable/disable this setting.");
return;
}
if (!result) {
Serial.println("Could not successfully update setting \"" + setting_name + "\"");
return;
}
}
}
else if (cmd_args.get(0) == REBOOT_CMD) {
Serial.println("Rebooting...");
ESP.restart();
}
//// WiFi/Bluetooth Scan/Attack commands
if (!wifi_scan_obj.scanning()) {
// AP Scan
if (cmd_args.get(0) == SCANAP_CMD) {
int full_sw = -1;
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
if (full_sw == -1) {
Serial.println("Starting AP scan. Stop with " + (String)STOPSCAN_CMD);
wifi_scan_obj.StartScan(WIFI_SCAN_TARGET_AP, TFT_MAGENTA);
}
else {
Serial.println("Starting Full AP scan. Stop with " + (String)STOPSCAN_CMD);
wifi_scan_obj.StartScan(WIFI_SCAN_TARGET_AP_FULL, TFT_MAGENTA);
}
}
// Beacon sniff
else if (cmd_args.get(0) == SNIFF_BEACON_CMD) {
Serial.println("Starting Beacon sniff. Stop with " + (String)STOPSCAN_CMD);
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
wifi_scan_obj.StartScan(WIFI_SCAN_AP, TFT_MAGENTA);
}
// Probe sniff
else if (cmd_args.get(0) == SNIFF_PROBE_CMD) {
Serial.println("Starting Probe sniff. Stop with " + (String)STOPSCAN_CMD);
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
wifi_scan_obj.StartScan(WIFI_SCAN_PROBE, TFT_MAGENTA);
}
// Deauth sniff
else if (cmd_args.get(0) == SNIFF_DEAUTH_CMD) {
Serial.println("Starting Deauth sniff. Stop with " + (String)STOPSCAN_CMD);
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
wifi_scan_obj.StartScan(WIFI_SCAN_DEAUTH, TFT_RED);
}
// Pwn sniff
else if (cmd_args.get(0) == SNIFF_PWN_CMD) {
Serial.println("Starting Pwnagotchi sniff. Stop with " + (String)STOPSCAN_CMD);
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
wifi_scan_obj.StartScan(WIFI_SCAN_PWN, TFT_MAGENTA);
}
// Espressif sniff
else if (cmd_args.get(0) == SNIFF_ESP_CMD) {
Serial.println("Starting Espressif device sniff. Stop with " + (String)STOPSCAN_CMD);
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
wifi_scan_obj.StartScan(WIFI_SCAN_ESPRESSIF, TFT_MAGENTA);
}
// PMKID sniff
else if (cmd_args.get(0) == SNIFF_PMKID_CMD) {
int ch_sw = this->argSearch(&cmd_args, "-c");
int d_sw = this->argSearch(&cmd_args, "-d"); // Deauth for pmkid
if (ch_sw != -1) {
wifi_scan_obj.set_channel = cmd_args.get(ch_sw + 1).toInt();
wifi_scan_obj.changeChannel();
Serial.println("Set channel: " + (String)wifi_scan_obj.set_channel);
}
if (d_sw == -1) {
Serial.println("Starting PMKID sniff on channel " + (String)wifi_scan_obj.set_channel + ". Stop with " + (String)STOPSCAN_CMD);
wifi_scan_obj.StartScan(WIFI_SCAN_EAPOL, TFT_VIOLET);
}
else {
Serial.println("Starting PMKID sniff with deauthentication on channel " + (String)wifi_scan_obj.set_channel + ". Stop with " + (String)STOPSCAN_CMD);
wifi_scan_obj.StartScan(WIFI_SCAN_ACTIVE_EAPOL, TFT_VIOLET);
}
}
//// WiFi attack commands
// attack
if (cmd_args.get(0) == ATTACK_CMD) {
int attack_type_switch = this->argSearch(&cmd_args, "-t"); // Required
int list_beacon_sw = this->argSearch(&cmd_args, "-l");
int rand_beacon_sw = this->argSearch(&cmd_args, "-r");
int ap_beacon_sw = this->argSearch(&cmd_args, "-a");
if (attack_type_switch == -1) {
Serial.println("You must specify an attack type");
return;
}
else {
String attack_type = cmd_args.get(attack_type_switch + 1);
// Branch on attack type
// Deauth
if (attack_type == ATTACK_TYPE_DEAUTH) {
if (!this->apSelected()) {
Serial.println("You don't have any targets selected. Use " + (String)SEL_CMD);
return;
}
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
Serial.println("Starting Deauthentication attack. Stop with " + (String)STOPSCAN_CMD);
wifi_scan_obj.StartScan(WIFI_ATTACK_DEAUTH, TFT_RED);
}
// Beacon
else if (attack_type == ATTACK_TYPE_BEACON) {
// spam by list
if (list_beacon_sw != -1) {
if (!this->hasSSIDs()) {
Serial.println("You don't have any SSIDs in your list. Use " + (String)SSID_CMD);
return;
}
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
Serial.println("Starting Beacon list spam. Stop with " + (String)STOPSCAN_CMD);
wifi_scan_obj.StartScan(WIFI_ATTACK_BEACON_LIST, TFT_RED);
}
// spam with random
else if (rand_beacon_sw != -1) {
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
Serial.println("Starting random Beacon spam. Stop with " + (String)STOPSCAN_CMD);
wifi_scan_obj.StartScan(WIFI_ATTACK_BEACON_SPAM, TFT_ORANGE);
}
// Spam from AP list
else if (ap_beacon_sw != -1) {
if (!this->apSelected()) {
Serial.println("You don't have any targets selected. Use " + (String)SEL_CMD);
return;
}
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
Serial.println("Starting Targeted AP Beacon spam. Stop with " + (String)STOPSCAN_CMD);
wifi_scan_obj.StartScan(WIFI_ATTACK_AP_SPAM, TFT_MAGENTA);
}
else {
Serial.println("You did not specify a beacon attack type");
}
}
else if (attack_type == ATTACK_TYPE_PROBE) {
if (!this->apSelected()) {
Serial.println("You don't have any targets selected. Use " + (String)SEL_CMD);
return;
}
Serial.println("Starting Probe spam. Stop with " + (String)STOPSCAN_CMD);
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
wifi_scan_obj.StartScan(WIFI_ATTACK_AUTH, TFT_RED);
}
else if (attack_type == ATTACK_TYPE_RR) {
Serial.println("Starting Rick Roll Beacon spam. Stop with " + (String)STOPSCAN_CMD);
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
wifi_scan_obj.StartScan(WIFI_ATTACK_RICK_ROLL, TFT_YELLOW);
}
else {
Serial.println("Attack type not properly defined");
return;
}
}
}
//// Bluetooth scan/attack commands
// Bluetooth scan
if (cmd_args.get(0) == BT_SNIFF_CMD) {
Serial.println("Starting Bluetooth scan. Stop with " + (String)STOPSCAN_CMD);
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
wifi_scan_obj.StartScan(BT_SCAN_ALL, TFT_GREEN);
}
// Bluetooth CC Skimmer scan
else if (cmd_args.get(0) == BT_SKIM_CMD) {
Serial.println("Starting Bluetooth CC Skimmer scan. Stop with " + (String)STOPSCAN_CMD);
#ifdef HAS_SCREEN
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
#endif
wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA);
}
// Update command
if (cmd_args.get(0) == UPDATE_CMD) {
int w_sw = this->argSearch(&cmd_args, "-w"); // Web update
int sd_sw = this->argSearch(&cmd_args, "-s"); // SD Update
// Update via OTA
if (w_sw != -1) {
Serial.println("Starting Marauder OTA Update. Stop with " + (String)STOPSCAN_CMD);
wifi_scan_obj.currentScanMode = OTA_UPDATE;
//#ifdef HAS_SCREEN
// menu_function_obj.changeMenu(menu_function_obj.updateMenu);
//#endif
web_obj.setupOTAupdate();
}
// Update via SD
else if (sd_sw != -1) {
if (!sd_obj.supported) {
Serial.println("SD card is not connected. Cannot perform SD Update");
return;
}
}
}
}
//// WiFi aux commands
// List access points
if (cmd_args.get(0) == LIST_AP_CMD) {
int ap_sw = this->argSearch(&cmd_args, "-a");
int ss_sw = this->argSearch(&cmd_args, "-s");
// List APs
if (ap_sw != -1) {
for (int i = 0; i < access_points->size(); i++) {
if (access_points->get(i).selected)
Serial.println("[" + (String)i + "] " + access_points->get(i).essid + " " + (String)access_points->get(i).rssi + " (selected)");
else
Serial.println("[" + (String)i + "] " + access_points->get(i).essid + " " + (String)access_points->get(i).rssi);
}
}
// List SSIDs
else if (ss_sw != -1) {
for (int i = 0; i < ssids->size(); i++) {
if (ssids->get(i).selected)
Serial.println("[" + (String)i + "] " + ssids->get(i).essid + " (selected)");
else
Serial.println("[" + (String)i + "] " + ssids->get(i).essid);
}
}
else {
Serial.println("You did not specify which list to show");
return;
}
}
// Select access points or stations
else if (cmd_args.get(0) == SEL_CMD) {
// Get switches
int ap_sw = this->argSearch(&cmd_args, "-a");
int ss_sw = this->argSearch(&cmd_args, "-s");
// select Access points
if (ap_sw != -1) {
// Get list of indices
LinkedList<String> ap_index = this->parseCommand(cmd_args.get(ap_sw + 1), ",");
// Select ALL APs
if (cmd_args.get(ap_sw + 1) == "all") {
for (int i = 0; i < access_points->size(); i++) {
if (access_points->get(i).selected) {
// Unselect "selected" ap
AccessPoint new_ap = access_points->get(i);
new_ap.selected = false;
access_points->set(i, new_ap);
}
else {
// Select "unselected" ap
AccessPoint new_ap = access_points->get(i);
new_ap.selected = true;
access_points->set(i, new_ap);
}
}
}
// Select specific APs
else {
// Mark APs as selected
for (int i = 0; i < ap_index.size(); i++) {
int index = ap_index.get(i).toInt();
if (!this->inRange(access_points->size(), index)) {
Serial.println("Index not in range: " + (String)index);
continue;
}
if (access_points->get(index).selected) {
// Unselect "selected" ap
AccessPoint new_ap = access_points->get(index);
new_ap.selected = false;
access_points->set(index, new_ap);
}
else {
// Select "unselected" ap
AccessPoint new_ap = access_points->get(index);
new_ap.selected = true;
access_points->set(index, new_ap);
}
}
}
}
// select ssids
else if (ss_sw != -1) {
// Get list of indices
LinkedList<String> ss_index = this->parseCommand(cmd_args.get(ss_sw + 1), ",");
// Mark APs as selected
for (int i = 0; i < ss_index.size(); i++) {
int index = ss_index.get(i).toInt();
if (!this->inRange(ssids->size(), index)) {
Serial.println("Index not in range: " + (String)index);
continue;
}
if (ssids->get(index).selected) {
// Unselect "selected" ap
ssid new_ssid = ssids->get(index);
new_ssid.selected = false;
ssids->set(index, new_ssid);
}
else {
// Select "unselected" ap
ssid new_ssid = ssids->get(index);
new_ssid.selected = true;
ssids->set(index, new_ssid);
}
}
}
else {
Serial.println("You did not specify which list to select from");
return;
}
}
// SSID stuff
else if (cmd_args.get(0) == SSID_CMD) {
int add_sw = this->argSearch(&cmd_args, "-a");
int gen_sw = this->argSearch(&cmd_args, "-g");
int spc_sw = this->argSearch(&cmd_args, "-n");
int rem_sw = this->argSearch(&cmd_args, "-r");
// Add ssid
if (add_sw != -1) {
// Generate random
if (gen_sw != -1) {
int gen_count = cmd_args.get(gen_sw + 1).toInt();
wifi_scan_obj.generateSSIDs(gen_count);
}
// Add specific
else if (spc_sw != -1) {
String essid = cmd_args.get(spc_sw + 1);
wifi_scan_obj.addSSID(essid);
}
else {
Serial.println("You did not specify how to add SSIDs");
}
}
// Remove SSID
else if (rem_sw != -1) {
int index = cmd_args.get(rem_sw + 1).toInt();
if (!this->inRange(ssids->size(), index)) {
Serial.println("Index not in range: " + (String)index);
return;
}
ssids->remove(index);
}
else {
Serial.println("You did not specify whether to add or remove SSIDs");
return;
}
}
}

View File

@@ -0,0 +1,149 @@
#ifndef CommandLine_h
#define CommandLine_h
#include "configs.h"
#ifdef HAS_SCREEN
#include "MenuFunctions.h"
#include "Display.h"
#endif
#include "WiFiScan.h"
#include "Web.h"
#include "SDInterface.h"
#include "settings.h"
#ifdef HAS_SCREEN
extern MenuFunctions menu_function_obj;
extern Display display_obj;
#endif
extern WiFiScan wifi_scan_obj;
extern Web web_obj;
extern SDInterface sd_obj;
extern Settings settings_obj;
extern LinkedList<AccessPoint>* access_points;
extern LinkedList<ssid>* ssids;
extern const String PROGMEM version_number;
//// Commands
// Admin
const char PROGMEM CH_CMD[] = "channel";
const char PROGMEM CLEARAP_CMD[] = "clearlist";
const char PROGMEM REBOOT_CMD[] = "reboot";
const char PROGMEM UPDATE_CMD[] = "update";
const char PROGMEM HELP_CMD[] = "help";
const char PROGMEM SETTINGS_CMD[] = "settings";
// WiFi sniff/scan
const char PROGMEM SCANAP_CMD[] = "scanap";
const char PROGMEM SNIFF_BEACON_CMD[] = "sniffbeacon";
const char PROGMEM SNIFF_PROBE_CMD[] = "sniffprobe";
const char PROGMEM SNIFF_PWN_CMD[] = "sniffpwn";
const char PROGMEM SNIFF_ESP_CMD[] = "sniffesp";
const char PROGMEM SNIFF_DEAUTH_CMD[] = "sniffdeauth";
const char PROGMEM SNIFF_PMKID_CMD[] = "sniffpmkid";
const char PROGMEM STOPSCAN_CMD[] = "stopscan";
// WiFi attack
const char PROGMEM ATTACK_CMD[] = "attack";
const char PROGMEM ATTACK_TYPE_DEAUTH[] = "deauth";
const char PROGMEM ATTACK_TYPE_BEACON[] = "beacon";
const char PROGMEM ATTACK_TYPE_PROBE[] = "probe";
const char PROGMEM ATTACK_TYPE_RR[] = "rickroll";
// WiFi Aux
const char PROGMEM LIST_AP_CMD[] = "list";
const char PROGMEM SEL_CMD[] = "select";
const char PROGMEM SSID_CMD[] = "ssid";
// Bluetooth sniff/scan
const char PROGMEM BT_SNIFF_CMD[] = "sniffbt";
const char PROGMEM BT_SKIM_CMD[] = "sniffskim";
//// Command help messages
// Admin
const char PROGMEM HELP_HEAD[] = "============ Commands ============";
const char PROGMEM HELP_CH_CMD[] = "channel [-s <channel>]";
const char PROGMEM HELP_CLEARAP_CMD_A[] = "clearlist -a";
const char PROGMEM HELP_CLEARAP_CMD_B[] = "clearlist -s";
const char PROGMEM HELP_REBOOT_CMD[] = "reboot";
const char PROGMEM HELP_UPDATE_CMD_A[] = "update -s";
const char PROGMEM HELP_UPDATE_CMD_B[] = "update -w";
const char PROGMEM HELP_SETTINGS_CMD[] = "settings [-s <setting> enable/disable>]/[-r]";
// WiFi sniff/scan
const char PROGMEM HELP_SCANAP_CMD[] = "scanap";
const char PROGMEM HELP_SNIFF_BEACON_CMD[] = "sniffbeacon";
const char PROGMEM HELP_SNIFF_PROBE_CMD[] = "sniffprobe";
const char PROGMEM HELP_SNIFF_PWN_CMD[] = "sniffpwn";
const char PROGMEM HELP_SNIFF_ESP_CMD[] = "sniffesp";
const char PROGMEM HELP_SNIFF_DEAUTH_CMD[] = "sniffdeauth";
const char PROGMEM HELP_SNIFF_PMKID_CMD[] = "sniffpmkid [-c <channel>]";
const char PROGMEM HELP_STOPSCAN_CMD[] = "stopscan";
// WiFi attack
const char PROGMEM HELP_ATTACK_CMD[] = "attack -t <beacon [-l/-r/-a]/deauth/probe/rickroll>";
// WiFi Aux
const char PROGMEM HELP_LIST_AP_CMD_A[] = "list -s";
const char PROGMEM HELP_LIST_AP_CMD_B[] = "list -a";
const char PROGMEM HELP_SEL_CMD_A[] = "select -a <index (comma separated)>";
const char PROGMEM HELP_SEL_CMD_B[] = "select -s <index (comma separated)>";
const char PROGMEM HELP_SSID_CMD_A[] = "ssid -a [-g <count>/-n <name>]";
const char PROGMEM HELP_SSID_CMD_B[] = "ssid -r <index>";
// Bluetooth sniff/scan
const char PROGMEM HELP_BT_SNIFF_CMD[] = "sniffbt";
const char PROGMEM HELP_BT_SKIM_CMD[] = "sniffskim";
const char PROGMEM HELP_FOOT[] = "==================================";
class CommandLine {
private:
String getSerialInput();
LinkedList<String> parseCommand(String input, char* delim);
void runCommand(String input);
bool checkValueExists(LinkedList<String>* cmd_args_list, int index);
bool inRange(int max, int index);
bool apSelected();
bool hasSSIDs();
int argSearch(LinkedList<String>* cmd_args, String key);
const char* ascii_art =
"\r\n"
" @@@@@@ \r\n"
" @@@@@@@@ \r\n"
" @@@@@@@@@@@ \r\n"
" @@@@@@ @@@@@@ \r\n"
" @@@@@@@ @@@@@@@ \r\n"
" @@@@@@ @@@@@@ \r\n"
" @@@@@@@ @@@@@@@ \r\n"
" @@@@@@ @@@@@@ \r\n"
"@@@@@@@ @@@@@@@@@@@@@@@@ \r\n"
"@@@@@ @@@@@@@@@@@@@@@ \r\n"
"@@@@@ @@@@@@@ \r\n"
"@@@@@ @@@@@@ \r\n"
"@@@@@@ @@@@@@@ \r\n"
" @@@@@@ @@@@@@@@@@@@\r\n"
" @@@@@@@ @@@@@@ \r\n"
" @@@@@@ @@@@@@ \r\n"
" @@@@@@@ @@@@@@ \r\n"
" @@@@@@ @@@@@@ \r\n"
" @@@@@@@ @@@@@@ \r\n"
" @@@@@@ @@@@@@ \r\n"
" @@@@@@@@@ \r\n"
" @@@@@@ \r\n"
" @@@@ \r\n"
"\r\n";
public:
CommandLine();
void RunSetup();
void main(uint32_t currentTime);
};
#endif

View File

@@ -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()
{
@@ -22,127 +14,67 @@ void Display::RunSetup()
// Need to declare new
display_buffer = new LinkedList<String>();
#ifdef SCREEN_BUFFER
screen_buffer = new LinkedList<String>();
#endif
tft.init();
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_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);
//Serial.println("SPI_FREQUENCY: " + (String)SPI_FREQUENCY);
//Serial.println("SPI_READ_FREQUENCY:" + (String)SPI_READ_FREQUENCY);
//Serial.println("SPI_TOUCH_FREQUENCY: " + (String)SPI_TOUCH_FREQUENCY);
#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)
{
@@ -242,7 +174,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,
@@ -312,42 +244,69 @@ 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);
}
// Function to just draw the screen black
void Display::clearScreen()
{
Serial.println(F("clearScreen()"));
//Serial.println(F("clearScreen()"));
tft.fillScreen(TFT_BLACK);
tft.setCursor(0, 0);
}
#ifdef SCREEN_BUFFER
void Display::scrollScreenBuffer(bool down) {
// Scroll screen normal direction (Up)
if (!down) {
this->screen_buffer->shift();
}
}
#endif
void Display::displayBuffer(bool do_clear)
{
if (this->display_buffer->size() > 0)
{
delay(1);
while (display_buffer->size() > 0)
{
xPos = 0;
if ((display_buffer->size() > 0) && (!loading))
{
printing = true;
delay(print_delay_1);
yDraw = scroll_line(TFT_RED);
tft.setCursor(xPos, yDraw);
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.print(display_buffer->shift());
printing = false;
delay(print_delay_2);
}
if (!tteBar)
blank[(18+(yStart - TOP_FIXED_AREA) / TEXT_HEIGHT)%19] = xPos;
else
blank[(18+(yStart - TOP_FIXED_AREA_2) / TEXT_HEIGHT)%19] = xPos;
#ifndef SCREEN_BUFFER
xPos = 0;
if ((display_buffer->size() > 0) && (!loading))
{
printing = true;
delay(print_delay_1);
yDraw = scroll_line(TFT_RED);
tft.setCursor(xPos, yDraw);
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.print(display_buffer->shift());
printing = false;
delay(print_delay_2);
}
if (!tteBar)
blank[(18+(yStart - TOP_FIXED_AREA) / TEXT_HEIGHT)%19] = xPos;
else
blank[(18+(yStart - TOP_FIXED_AREA_2) / TEXT_HEIGHT)%19] = xPos;
#else
xPos = 0;
if (this->screen_buffer->size() >= MAX_SCREEN_BUFFER)
this->scrollScreenBuffer();
screen_buffer->add(display_buffer->shift());
for (int i = 0; i < this->screen_buffer->size(); i++) {
tft.setCursor(xPos, (i * 12) + (SCREEN_HEIGHT / 6));
for (int x = 0; x < TFT_WIDTH / CHAR_WIDTH; x++)
tft.print(" ");
tft.setCursor(xPos, (i * 12) + (SCREEN_HEIGHT / 6));
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.print(this->screen_buffer->get(i));
}
#endif
}
}
}
@@ -361,7 +320,7 @@ void Display::showCenterText(String text, int y)
void Display::initScrollValues(bool tte)
{
Serial.println(F("initScrollValues()"));
//Serial.println(F("initScrollValues()"));
yDraw = YMAX - BOT_FIXED_AREA - TEXT_HEIGHT;
xPos = 0;
@@ -417,24 +376,28 @@ int Display::scroll_line(uint32_t color) {
// Function to setup hardware scroll for TFT screen
void Display::setupScrollArea(uint16_t tfa, uint16_t bfa) {
Serial.println(F("setupScrollArea()"));
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);
//Serial.println(F("setupScrollArea()"));
//Serial.println(" tfa: " + (String)tfa);
//Serial.println(" bfa: " + (String)bfa);
//Serial.println("yStart: " + (String)this->yStart);
#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
}
@@ -444,7 +407,9 @@ 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 ) {
@@ -465,9 +430,9 @@ void Display::drawJpeg(const char *filename, int xpos, int ypos) {
// render the image onto the screen at given coordinates
jpegRender(xpos, ypos);
}
else {
Serial.println(F("Jpeg file format not supported!"));
}
//else {
// Serial.println(F("Jpeg file format not supported!"));
//}
}
void Display::setupDraw() {
@@ -487,7 +452,7 @@ void Display::drawStylus()
boolean pressed = tft.getTouch(&x, &y);
if ((x <= 10) && (y <= 10) && (pressed)) {
Serial.println(F("Exit draw function"));
//Serial.println(F("Exit draw function"));
this->draw_tft = false;
this->exit_draw = true;
return;
@@ -620,7 +585,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("===============");
@@ -634,7 +599,7 @@ void Display::jpegInfo() {
Serial.print ("MCU height :"); Serial.println(JpegDec.MCUHeight);
Serial.println("===============");
Serial.println("");
*/
}
//====================================================================================
@@ -811,7 +776,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
@@ -824,112 +789,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) ||
@@ -938,3 +797,5 @@ void Display::main(uint8_t scan_mode)
return;
}
// End SPIFFS_functions
#endif

View File

@@ -1,182 +1,165 @@
#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 KIT
#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
#define KIT_LED_BUILTIN 13
/*
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.3";
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();
#ifdef SCREEN_BUFFER
void scrollScreenBuffer(bool down = false);
#endif
//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;
#ifdef SCREEN_BUFFER
LinkedList<String>* screen_buffer;
#endif
// 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

View File

@@ -5,7 +5,7 @@ LedInterface::LedInterface() {
}
void LedInterface::RunSetup() {
Serial.println("Setting neopixel to black...");
//Serial.println("Setting neopixel to black...");
strip.setBrightness(0);
strip.begin();
strip.setPixelColor(0, strip.Color(0, 0, 0));

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -1,4 +1,5 @@
#include "SDInterface.h"
#include "lang_var.h"
bool SDInterface::initSD() {
String display_string = "";
@@ -23,27 +24,20 @@ bool SDInterface::initSD() {
else {
this->supported = true;
this->cardType = SD.cardType();
if (cardType == CARD_MMC)
Serial.println(F("SD: MMC Mounted"));
else if(cardType == CARD_SD)
Serial.println(F("SD: SDSC Mounted"));
else if(cardType == CARD_SDHC)
Serial.println(F("SD: SDHC Mounted"));
else
Serial.println(F("SD: UNKNOWN Card Mounted"));
//if (cardType == CARD_MMC)
// Serial.println(F("SD: MMC Mounted"));
//else if(cardType == CARD_SD)
// Serial.println(F("SD: SDSC Mounted"));
//else if(cardType == CARD_SDHC)
// Serial.println(F("SD: SDHC Mounted"));
//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);
//Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB);
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];
@@ -55,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...");
@@ -78,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);
}
}
@@ -89,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;
}
@@ -111,70 +104,98 @@ 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");
}
}
@@ -202,8 +223,3 @@ void SDInterface::main() {
}
}
}
//void SDInterface::savePacket(uint8_t* buf, uint32_t len) {
// if (this->supported)
// buffer_obj.save(
//}

View File

@@ -1,15 +1,19 @@
#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;
#define SD_CS 12
#ifdef HAS_SCREEN
extern Display display_obj;
#endif
#ifdef KIT
#define SD_DET 4

View File

@@ -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) {

View File

@@ -1,6 +1,8 @@
#ifndef TemperatureInterface_h
#define TemperatureInterface_h
#include "configs.h"
#include <Arduino.h>
class TemperatureInterface {

View File

@@ -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...");
@@ -76,25 +82,16 @@ void Web::setupOTAupdate()
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());
}

View File

@@ -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

View File

@@ -1,6 +1,8 @@
#ifndef WiFiScan_h
#define WiFiScan_h
#include "configs.h"
//#include <BLEDevice.h>
//#include <BLEUtils.h>
//#include <BLEScan.h>
@@ -8,20 +10,27 @@
#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 "flipperLED.h"
//#include "MenuFunctions.h"
#define bad_list_length 3
@@ -50,16 +59,23 @@
#define WIFI_ATTACK_AUTH 18
#define WIFI_ATTACK_MIMIC 19
#define WIFI_ATTACK_DEAUTH 20
#define WIFI_ATTACK_AP_SPAM 21
#define WIFI_SCAN_TARGET_AP_FULL 22
#define WIFI_SCAN_ACTIVE_EAPOL 23
#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;
extern flipperLED flipper_led;
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);
@@ -67,6 +83,7 @@ esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, b
struct ssid {
String essid;
int bssid[6];
bool selected;
};
struct AccessPoint {
@@ -74,11 +91,19 @@ struct AccessPoint {
int channel;
int bssid[6];
bool selected;
LinkedList<char>* beacon;
int rssi;
};
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
@@ -100,10 +125,13 @@ class WiFiScan
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};
NimBLEScan* pBLEScan;
#ifdef HAS_BT
NimBLEScan* pBLEScan;
#endif
//String connected_network = "";
String alfa = "1234567890qwertyuiopasdfghjkklzxcvbnm QWERTYUIOPASDFGHJKLZXCVBNM_";
@@ -198,7 +226,6 @@ class WiFiScan
void packetMonitorMain(uint32_t currentTime);
void eapolMonitorMain(uint32_t currentTime);
void changeChannel();
void updateMidway();
void tftDrawXScalButtons();
void tftDrawYScaleButtons();
@@ -207,8 +234,10 @@ class WiFiScan
void tftDrawGraphObjects();
void sendProbeAttack(uint32_t currentTime);
void sendDeauthAttack(uint32_t currentTime);
void sendDeauthFrame(uint8_t bssid[6], int channel);
void broadcastRandomSSID(uint32_t currentTime);
void broadcastCustomBeacon(uint32_t current_time, ssid custom_ssid);
void broadcastCustomBeacon(uint32_t current_time, AccessPoint 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);
@@ -226,7 +255,9 @@ 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);
@@ -258,17 +289,20 @@ class WiFiScan
int clearSSIDs();
int clearAPs();
bool addSSID(String essid);
int generateSSIDs();
int generateSSIDs(int count = 20);
bool shutdownWiFi();
bool shutdownBLE();
bool scanning();
void joinWiFi(String ssid, String password);
String getStaMAC();
String getApMAC();
String freeRAM();
void changeChannel();
void changeChannel(int chan);
void RunInfo();
void RunShutdownWiFi();
void RunShutdownBLE();
void RunGenerateSSIDs();
void RunGenerateSSIDs(int count = 20);
void RunClearSSIDs();
void RunClearAPs();
void channelHop();
@@ -282,9 +316,11 @@ class WiFiScan
static void pwnSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void beaconSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void apSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void apSnifferCallbackFull(void* buf, wifi_promiscuous_pkt_type_t type);
static void deauthSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void probeSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void beaconListSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void eapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
static void wifiSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type);
};

View File

@@ -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);*/
}

View File

@@ -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:

405
esp32_marauder/configs.h Normal file
View File

@@ -0,0 +1,405 @@
#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.13"
//// 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 SCREEN_BUFFER
#define MAX_SCREEN_BUFFER 9
#define BANNER_TEXT_SIZE 1
#ifndef TFT_WIDTH
#define TFT_WIDTH 128
#endif
#ifndef TFT_HEIGHT
#define TFT_HEIGHT 128
#endif
#define CHAR_WIDTH 6
#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 10
#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 TFT_ORANGE 0
#define TFT_YELLOW 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

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@@ -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,27 @@ 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"
#include "flipperLED.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,201 +59,278 @@ BatteryInterface battery_obj;
TemperatureInterface temp_obj;
LedInterface led_obj;
EspInterface esp_obj;
A32u4Interface a32u4_obj;
Settings settings_obj;
CommandLine cli_obj;
flipperLED flipper_led;
#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);
Serial.println("ESP-IDF version is: " + String(esp_get_idf_version()));
display_obj.RunSetup();
display_obj.tft.setTextColor(TFT_WHITE, TFT_BLACK);
//Serial.println("\n\nHello, World!\n");
digitalWrite(TFT_BL, LOW);
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 MARAUDER_FLIPPER
flipper_led.RunSetup();
#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);
digitalWrite(TFT_BL, HIGH); // 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
//showCenterText(version_number, 250);
#ifndef MARAUDER_MINI
display_obj.tft.drawCentreString(display_obj.version_number, 120, 250, 2);
#endif
Serial.println(F("\n\n--------------------------------\n"));
Serial.println(F(" ESP32 Marauder \n"));
Serial.println(" " + display_obj.version_number + "\n");
Serial.println(F(" By: justcallmekoko\n"));
Serial.println(F("--------------------------------\n\n"));
#ifdef MARAUDER_MINI
display_obj.tft.drawCentreString(display_obj.version_number, TFT_WIDTH/2, TFT_HEIGHT, 1);
#endif
#endif
backlightOn(); // Need this
#ifdef HAS_SCREEN
delay(2000);
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("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());
//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"));
//Serial.println(F("SD Card supported"));
#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();
if (battery_obj.i2c_supported) {
Serial.println(F("IP5306 I2C Supported: true"));
}
else
Serial.println(F("IP5306 I2C Supported: false"));
Serial.println(wifi_scan_obj.freeRAM());
#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
// Do some LED stuff
led_obj.RunSetup();
#ifndef MARAUDER_FLIPPER
led_obj.RunSetup();
#endif
display_obj.tft.println(F("Initialized LED Interface"));
#ifdef HAS_SCREEN
display_obj.tft.println(F(text_table0[7]));
//display_obj.tft.println(F("Starting..."));
delay(500);
#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(F("\n\n--------------------------------\n"));
//Serial.println(F(" ESP32 Marauder \n"));
//Serial.println(" " + version_number + "\n");
//Serial.println(F(" By: justcallmekoko\n"));
//Serial.println(F("--------------------------------\n\n"));
Serial.println("CLI Ready");
cli_obj.RunSetup();
}
void loop()
{
// get the current time
//if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
currentTime = millis();
bool mini = false;
#ifdef MARAUDER_MINI
mini = true;
#endif
// 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))
if ((wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) &&
(wifi_scan_obj.currentScanMode != WIFI_SCAN_EAPOL))
menu_function_obj.main(currentTime);
#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)) ||
(mini)) {
#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
delay(1);
#else
delay(50);
#endif
}
#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");
}

Binary file not shown.

View File

@@ -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());
}

View File

@@ -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:

View File

@@ -0,0 +1,41 @@
#include "flipperLED.h"
void flipperLED::RunSetup() {
pinMode(B_PIN, OUTPUT);
pinMode(G_PIN, OUTPUT);
pinMode(R_PIN, OUTPUT);
delay(50);
digitalWrite(B_PIN, LOW);
delay(500);
digitalWrite(B_PIN, HIGH);
digitalWrite(G_PIN, LOW);
delay(500);
digitalWrite(G_PIN, HIGH);
digitalWrite(R_PIN, LOW);
delay(500);
digitalWrite(R_PIN, HIGH);
}
void flipperLED::attackLED() {
digitalWrite(B_PIN, HIGH);
digitalWrite(G_PIN, HIGH);
digitalWrite(R_PIN, HIGH);
delay(10);
digitalWrite(R_PIN, LOW);
}
void flipperLED::sniffLED() {
digitalWrite(B_PIN, HIGH);
digitalWrite(G_PIN, HIGH);
digitalWrite(R_PIN, HIGH);
delay(10);
digitalWrite(B_PIN, LOW);
}
void flipperLED::offLED() {
digitalWrite(B_PIN, HIGH);
digitalWrite(G_PIN, HIGH);
digitalWrite(R_PIN, HIGH);
}

View File

@@ -0,0 +1,19 @@
#ifndef flipperLED_h
#define flipperLED_h
#include <Arduino.h>
#define B_PIN 4
#define G_PIN 5
#define R_PIN 6
class flipperLED {
public:
void RunSetup();
void attackLED();
void sniffLED();
void offLED();
};
#endif

180
esp32_marauder/lang_var.h Normal file
View File

@@ -0,0 +1,180 @@
#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";
PROGMEM const char text1_57[] = "AP Clone Spam";
//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";
PROGMEM const char text4_24[] = "WSL Bypass: disabled";
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,text1_57};
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,text1_54,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

305
esp32_marauder/settings.cpp Normal file
View File

@@ -0,0 +1,305 @@
#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;
}
}
return false;
}
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"] = "ForcePMKID";
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"] = "ForceProbe";
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"] = "SavePCAP";
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) {
}

55
esp32_marauder/settings.h Normal file
View File

@@ -0,0 +1,55 @@
#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;
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();
bool createDefaultSettings(fs::FS &fs);
void printJsonSettings(String json_string);
void main(uint32_t currentTime);
};
#endif

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More