diff --git a/README.md b/README.md index 6c6daa700..fc61d9b82 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ESP32 Marauder v0.2.1 +# ESP32 Marauder v0.3.0
A suite of WiFi/Bluetooth offensive and defensive tools for the ESP32
diff --git a/esp32_marauder/Display.cpp b/esp32_marauder/Display.cpp
index bf11dca87..f288cef12 100644
--- a/esp32_marauder/Display.cpp
+++ b/esp32_marauder/Display.cpp
@@ -52,6 +52,137 @@ void Display::RunSetup()
delay(5000);
}
+void Display::tftDrawGraphObjects(byte x_scale)
+{
+ //draw the graph objects
+ tft.fillRect(11, 5, x_scale+1, 120, TFT_BLACK); // positive start point
+ tft.fillRect(11, 121, x_scale+1, 119, TFT_BLACK); // negative start point
+ tft.drawFastVLine(10, 5, 230, TFT_WHITE); // y axis
+ tft.drawFastHLine(10, HEIGHT_1 - 1, 310, TFT_WHITE); // x axis
+ tft.setTextColor(TFT_YELLOW); tft.setTextSize(1); // set parameters for y axis labels
+ //tft.setCursor(3, 116); tft.print(midway); // "0" at center of ya axis
+ tft.setCursor(3, 6); tft.print("+"); // "+' at top of y axis
+ tft.setCursor(3, 228); tft.print("0"); // "-" at bottom of y axis
+}
+
+void Display::tftDrawColorKey()
+{
+ //Display color key
+ tft.setTextSize(1); tft.setTextColor(TFT_WHITE);
+ tft.fillRect(14, 0, 15, 8, TFT_GREEN); tft.setCursor(30, 0); tft.print(" - Beacons");
+ tft.fillRect(14, 8, 15, 8, TFT_RED); tft.setCursor(30, 8); tft.print(" - Deauths");
+ tft.fillRect(14, 16, 15, 8, TFT_BLUE); tft.setCursor(30, 16); tft.print(" - Probes");
+}
+
+void Display::tftDrawXScaleButtons(byte x_scale)
+{
+ tft.drawFastVLine(234, 0, 20, TFT_WHITE);
+ tft.setCursor(208, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print("X Scale:"); tft.print(x_scale);
+
+ key[0].initButton(&tft, // x - box
+ 220,
+ 10, // x, y, w, h, outline, fill, text
+ 20,
+ 20,
+ TFT_BLACK, // Outline
+ TFT_CYAN, // Fill
+ TFT_BLACK, // Text
+ "-",
+ 2);
+ key[1].initButton(&tft, // x + box
+ 249,
+ 10, // x, y, w, h, outline, fill, text
+ 20,
+ 20,
+ TFT_BLACK, // Outline
+ TFT_CYAN, // Fill
+ TFT_BLACK, // Text
+ "+",
+ 2);
+
+ key[0].drawButton();
+ key[1].drawButton();
+}
+
+void Display::tftDrawYScaleButtons(byte y_scale)
+{
+ tft.drawFastVLine(290, 0, 20, TFT_WHITE);
+ tft.setCursor(265, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print("Y Scale:"); tft.print(y_scale);
+
+ key[2].initButton(&tft, // y - box
+ 276,
+ 10, // x, y, w, h, outline, fill, text
+ 20,
+ 20,
+ TFT_BLACK, // Outline
+ TFT_MAGENTA, // Fill
+ TFT_BLACK, // Text
+ "-",
+ 2);
+ key[3].initButton(&tft, // y + box
+ 305,
+ 10, // x, y, w, h, outline, fill, text
+ 20,
+ 20,
+ TFT_BLACK, // Outline
+ TFT_MAGENTA, // Fill
+ TFT_BLACK, // Text
+ "+",
+ 2);
+
+ key[2].drawButton();
+ key[3].drawButton();
+}
+
+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);
+
+ key[4].initButton(&tft, // channel - box
+ 164,
+ 10, // x, y, w, h, outline, fill, text
+ 20,
+ 20,
+ TFT_BLACK, // Outline
+ TFT_BLUE, // Fill
+ TFT_BLACK, // Text
+ "-",
+ 2);
+ key[5].initButton(&tft, // channel + box
+ 193,
+ 10, // x, y, w, h, outline, fill, text
+ 20,
+ 20,
+ TFT_BLACK, // Outline
+ TFT_BLUE, // Fill
+ TFT_BLACK, // Text
+ "+",
+ 2);
+
+ key[4].drawButton();
+ key[5].drawButton();
+}
+
+void Display::tftDrawExitScaleButtons()
+{
+ //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);
+
+ key[6].initButton(&tft, // Exit box
+ 137,
+ 10, // x, y, w, h, outline, fill, text
+ 20,
+ 20,
+ TFT_ORANGE, // Outline
+ TFT_RED, // Fill
+ TFT_BLACK, // Text
+ "X",
+ 2);
+
+ key[6].drawButton();
+}
+
void Display::twoPartDisplay(String center_text)
{
tft.setTextColor(TFT_BLACK, TFT_YELLOW);
diff --git a/esp32_marauder/Display.h b/esp32_marauder/Display.h
index 52a0a3df7..488fdedbf 100644
--- a/esp32_marauder/Display.h
+++ b/esp32_marauder/Display.h
@@ -14,6 +14,8 @@
#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)
@@ -25,6 +27,7 @@
//#define MENU_FONT &FreeMonoBold9pt7b
//#define MENU_FONT &FreeSans9pt7b
//#define MENU_FONT &FreeSansBold9pt7b
+#define BUTTON_ARRAY_LEN 7
class Display
@@ -48,7 +51,8 @@ class Display
Display();
TFT_eSPI tft = TFT_eSPI();
TFT_eSprite img = TFT_eSprite(&tft);
- String version_number = "v0.2.1";
+ TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
+ String version_number = "v0.3.0";
bool printing = false;
bool loading = false;
@@ -83,6 +87,12 @@ class Display
// 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 tftDrawGraphObjects(byte x_scale);
+ 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);
diff --git a/esp32_marauder/MenuFunctions.cpp b/esp32_marauder/MenuFunctions.cpp
index ac632c280..22faa623e 100644
--- a/esp32_marauder/MenuFunctions.cpp
+++ b/esp32_marauder/MenuFunctions.cpp
@@ -8,8 +8,13 @@ MenuFunctions::MenuFunctions()
// Function to check menu input
void MenuFunctions::main()
{
- if (wifi_scan_obj.currentScanMode == WIFI_SCAN_OFF)
+ if (wifi_scan_obj.currentScanMode == WIFI_SCAN_OFF) {
+ if (wifi_scan_obj.orient_display) {
+ this->orientDisplay();
+ wifi_scan_obj.orient_display = false;
+ }
display_obj.updateBanner(current_menu->name);
+ }
//this->displayCurrentMenu();
@@ -74,24 +79,24 @@ void MenuFunctions::main()
{
// Need this to set all keys to false
for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++) {
- if (pressed && key[b].contains(t_x, t_y)) {
- key[b].press(true); // tell the button it is pressed
+ if (pressed && display_obj.key[b].contains(t_x, t_y)) {
+ display_obj.key[b].press(true); // tell the button it is pressed
} else {
- key[b].press(false); // tell the button it is NOT pressed
+ display_obj.key[b].press(false); // tell the button it is NOT pressed
}
}
// Check if any key has changed state
for (uint8_t b = 0; b < current_menu->list->size(); b++) {
display_obj.tft.setFreeFont(MENU_FONT);
- if (key[b].justPressed()) {
- key[b].drawButton2(current_menu->list->get(b).name, true); // draw invert
+ if (display_obj.key[b].justPressed()) {
+ display_obj.key[b].drawButton2(current_menu->list->get(b).name, true); // draw invert
}
// If button was just release, execute the button's function
- if (key[b].justReleased())
+ if (display_obj.key[b].justReleased())
{
- key[b].drawButton2(current_menu->list->get(b).name); // draw normal
+ display_obj.key[b].drawButton2(current_menu->list->get(b).name); // draw normal
current_menu->list->get(b).callable();
}
display_obj.tft.setFreeFont(NULL);
@@ -101,6 +106,23 @@ void MenuFunctions::main()
y = -1;
}
+void MenuFunctions::orientDisplay()
+{
+ display_obj.tft.init();
+
+ display_obj.tft.setRotation(0); // Portrait
+
+ display_obj.tft.setCursor(0, 0);
+
+ uint16_t calData[5] = { 275, 3494, 361, 3528, 4 }; // tft.setRotation(0); // Portrait
+
+ display_obj.tft.setTouch(calData);
+
+ //display_obj.clearScreen();
+
+ changeMenu(current_menu);
+}
+
// Function to build the menus
void MenuFunctions::RunSetup()
@@ -156,7 +178,8 @@ void MenuFunctions::RunSetup()
// Build WiFi scanner Menu
wifiScannerMenu.parentMenu = &wifiMenu; // Main Menu is second menu parent
- addNodes(&wifiScannerMenu, "Back", TFT_RED, NULL, 0, [this](){changeMenu(wifiScannerMenu.parentMenu);});
+ addNodes(&wifiScannerMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this](){changeMenu(wifiScannerMenu.parentMenu);});
+ addNodes(&wifiScannerMenu, "Packet Monitor", TFT_BLUE, NULL, 1, [this](){wifi_scan_obj.StartScan(WIFI_PACKET_MONITOR, TFT_BLUE);});
// Build WiFi attack menu
wifiAttackMenu.parentMenu = &wifiMenu; // Main Menu is second menu parent
@@ -241,7 +264,7 @@ void MenuFunctions::buildButtons(Menu* menu)
TFT_eSPI_Button new_button;
char buf[menu->list->get(i).name.length() + 1] = {};
menu->list->get(i).name.toCharArray(buf, menu->list->get(i).name.length() + 1);
- key[i].initButton(&display_obj.tft,
+ display_obj.key[i].initButton(&display_obj.tft,
KEY_X + 0 * (KEY_W + KEY_SPACING_X),
KEY_Y + i * (KEY_H + KEY_SPACING_Y), // x, y, w, h, outline, fill, text
KEY_W,
@@ -275,7 +298,7 @@ void MenuFunctions::displayCurrentMenu()
display_obj.tft.setFreeFont(MENU_FONT);
for (int i = 0; i < current_menu->list->size(); i++)
{
- key[i].drawButton2(current_menu->list->get(i).name);
+ display_obj.key[i].drawButton2(current_menu->list->get(i).name);
}
display_obj.tft.setFreeFont(NULL);
}
diff --git a/esp32_marauder/MenuFunctions.h b/esp32_marauder/MenuFunctions.h
index fe6355ccf..281e34f72 100644
--- a/esp32_marauder/MenuFunctions.h
+++ b/esp32_marauder/MenuFunctions.h
@@ -15,7 +15,7 @@ extern WiFiScan wifi_scan_obj;
#define KEY_SPACING_X 0 // X and Y gap
#define KEY_SPACING_Y 1
#define KEY_TEXTSIZE 1 // Font size multiplier
-#define BUTTON_ARRAY_LEN 5
+//#define BUTTON_ARRAY_LEN 5
#define FLASH_BUTTON 0
@@ -62,10 +62,11 @@ class MenuFunctions
Menu bluetoothSnifferMenu;
Menu bluetoothScannerMenu;
- TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
+ //TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
void addNodes(Menu* menu, String name, uint16_t color, Menu* child, int place, std::function