mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-23 07:29:14 -08:00
Remove scan ap and scan sta from ili9341 devices
To save menu space, remove these because we have scan all now
This commit is contained in:
@@ -189,31 +189,56 @@ void Display::tftDrawYScaleButtons(byte y_scale)
|
||||
key[3].drawButton();
|
||||
}
|
||||
|
||||
void Display::tftDrawChannelScaleButtons(int set_channel)
|
||||
void Display::tftDrawChannelScaleButtons(int set_channel, bool lnd_an)
|
||||
{
|
||||
tft.drawFastVLine(178, 0, 20, TFT_WHITE);
|
||||
tft.setCursor(145, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print(text10); tft.print(set_channel);
|
||||
if (lnd_an) {
|
||||
tft.drawFastVLine(178, 0, 20, TFT_WHITE);
|
||||
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,
|
||||
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].initButton(&tft, // channel - box
|
||||
164,
|
||||
10, // x, y, w, h, outline, fill, text
|
||||
EXT_BUTTON_WIDTH,
|
||||
EXT_BUTTON_WIDTH,
|
||||
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
|
||||
EXT_BUTTON_WIDTH,
|
||||
EXT_BUTTON_WIDTH,
|
||||
TFT_BLACK, // Outline
|
||||
TFT_BLUE, // Fill
|
||||
TFT_BLACK, // Text
|
||||
"+",
|
||||
2);
|
||||
}
|
||||
|
||||
else {
|
||||
key[4].initButton(&tft, // channel - box
|
||||
(EXT_BUTTON_WIDTH / 2) * 6,
|
||||
(STATUS_BAR_WIDTH * 2) + CHAR_WIDTH - 1, // x, y, w, h, outline, fill, text
|
||||
EXT_BUTTON_WIDTH,
|
||||
EXT_BUTTON_WIDTH,
|
||||
TFT_BLACK, // Outline
|
||||
TFT_BLUE, // Fill
|
||||
TFT_BLACK, // Text
|
||||
"-",
|
||||
2);
|
||||
key[5].initButton(&tft, // channel + box
|
||||
(EXT_BUTTON_WIDTH / 2) * 10,
|
||||
(STATUS_BAR_WIDTH * 2) + CHAR_WIDTH - 1, // x, y, w, h, outline, fill, text
|
||||
EXT_BUTTON_WIDTH,
|
||||
EXT_BUTTON_WIDTH,
|
||||
TFT_BLACK, // Outline
|
||||
TFT_BLUE, // Fill
|
||||
TFT_BLACK, // Text
|
||||
"+",
|
||||
2);
|
||||
}
|
||||
|
||||
key[4].setLabelDatum(1, 5, MC_DATUM);
|
||||
key[5].setLabelDatum(1, 5, MC_DATUM);
|
||||
@@ -226,13 +251,14 @@ void Display::tftDrawExitScaleButtons(bool lnd_an)
|
||||
{
|
||||
//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);
|
||||
|
||||
if (lnd_an) {
|
||||
|
||||
key[6].initButton(&tft, // Exit box
|
||||
137,
|
||||
10, // x, y, w, h, outline, fill, text
|
||||
20,
|
||||
20,
|
||||
EXT_BUTTON_WIDTH,
|
||||
EXT_BUTTON_WIDTH,
|
||||
TFT_ORANGE, // Outline
|
||||
TFT_RED, // Fill
|
||||
TFT_BLACK, // Text
|
||||
|
||||
@@ -112,8 +112,8 @@ class Display
|
||||
void tftDrawColorKey();
|
||||
void tftDrawXScaleButtons(byte x_scale);
|
||||
void tftDrawYScaleButtons(byte y_scale);
|
||||
void tftDrawChannelScaleButtons(int set_channel);
|
||||
void tftDrawExitScaleButtons(bool lnd_an = false);
|
||||
void tftDrawChannelScaleButtons(int set_channel, bool lnd_an = true);
|
||||
void tftDrawExitScaleButtons(bool lnd_an = true);
|
||||
void buildBanner(String msg, int xpos);
|
||||
void clearScreen();
|
||||
void displayBuffer(bool do_clear = false);
|
||||
|
||||
@@ -705,19 +705,6 @@ void MenuFunctions::main(uint32_t currentTime)
|
||||
}
|
||||
}
|
||||
|
||||
// Do channel analyzer stuff
|
||||
/*if (wifi_scan_obj.currentScanMode == WIFI_SCAN_CHAN_ANALYZER) {
|
||||
if (currentTime - this->initTime >= GRAPH_REFRESH) {
|
||||
Serial.println("Refreshing graph: " + (String)currentTime);
|
||||
|
||||
this->initTime = millis();
|
||||
|
||||
this->setGraphScale(this->graphScaleCheck(wifi_scan_obj._analyzer_values));
|
||||
|
||||
this->drawGraph(wifi_scan_obj._analyzer_values);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
boolean pressed = false;
|
||||
// This is code from bodmer's keypad example
|
||||
@@ -893,6 +880,8 @@ void MenuFunctions::main(uint32_t currentTime)
|
||||
|
||||
// Check if any key coordinate boxes contain the touch coordinates
|
||||
// This is for when on a menu
|
||||
// Make sure to add certain scanning functions here or else
|
||||
// menu items will be selected while scans and attacks are running
|
||||
#ifdef HAS_ILI9341
|
||||
if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM) &&
|
||||
(wifi_scan_obj.currentScanMode != WIFI_ATTACK_AP_SPAM) &&
|
||||
@@ -901,6 +890,7 @@ void MenuFunctions::main(uint32_t currentTime)
|
||||
(wifi_scan_obj.currentScanMode != WIFI_ATTACK_DEAUTH_MANUAL) &&
|
||||
(wifi_scan_obj.currentScanMode != WIFI_ATTACK_DEAUTH_TARGETED) &&
|
||||
(wifi_scan_obj.currentScanMode != WIFI_ATTACK_MIMIC) &&
|
||||
(wifi_scan_obj.currentScanMode != WIFI_SCAN_PACKET_RATE) &&
|
||||
(wifi_scan_obj.currentScanMode != WIFI_ATTACK_RICK_ROLL))
|
||||
{
|
||||
// Need this to set all keys to false
|
||||
@@ -1630,11 +1620,13 @@ void MenuFunctions::RunSetup()
|
||||
this->drawStatusBar();
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_PROBE, TFT_CYAN);
|
||||
});
|
||||
this->addNodes(&wifiSnifferMenu, text_table1[43], TFTMAGENTA, NULL, BEACON_SNIFF, [this]() {
|
||||
display_obj.clearScreen();
|
||||
this->drawStatusBar();
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_AP, TFT_MAGENTA);
|
||||
});
|
||||
#ifndef HAS_ILI9341
|
||||
this->addNodes(&wifiSnifferMenu, text_table1[43], TFTMAGENTA, NULL, BEACON_SNIFF, [this]() {
|
||||
display_obj.clearScreen();
|
||||
this->drawStatusBar();
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_AP, TFT_MAGENTA);
|
||||
});
|
||||
#endif
|
||||
this->addNodes(&wifiSnifferMenu, text_table1[44], TFTRED, NULL, DEAUTH_SNIFF, [this]() {
|
||||
display_obj.clearScreen();
|
||||
this->drawStatusBar();
|
||||
@@ -1699,11 +1691,13 @@ void MenuFunctions::RunSetup()
|
||||
this->drawStatusBar();
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_AP_STA, 0x97e0);
|
||||
});
|
||||
this->addNodes(&wifiSnifferMenu, text_table1[59], TFTORANGE, NULL, PACKET_MONITOR, [this]() {
|
||||
display_obj.clearScreen();
|
||||
this->drawStatusBar();
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_STATION, TFT_WHITE);
|
||||
});
|
||||
#ifndef HAS_ILI9341
|
||||
this->addNodes(&wifiSnifferMenu, text_table1[59], TFTORANGE, NULL, PACKET_MONITOR, [this]() {
|
||||
display_obj.clearScreen();
|
||||
this->drawStatusBar();
|
||||
wifi_scan_obj.StartScan(WIFI_SCAN_STATION, TFT_WHITE);
|
||||
});
|
||||
#endif
|
||||
//#ifdef HAS_ILI9341
|
||||
this->addNodes(&wifiSnifferMenu, "Signal Monitor", TFTCYAN, NULL, PACKET_MONITOR, [this]() {
|
||||
display_obj.clearScreen();
|
||||
|
||||
@@ -2203,9 +2203,11 @@ void WiFiScan::RunPacketMonitor(uint8_t scan_mode, uint16_t color)
|
||||
else if (scan_mode == WIFI_SCAN_PACKET_RATE)
|
||||
display_obj.tft.drawCentreString("Packet Rate", 120, 16, 2);
|
||||
#endif
|
||||
display_obj.tft.setFreeFont(NULL);
|
||||
display_obj.tft.setTextSize(1);
|
||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
|
||||
display_obj.tftDrawChannelScaleButtons(set_channel);
|
||||
display_obj.tftDrawChannelScaleButtons(set_channel, false);
|
||||
display_obj.tftDrawExitScaleButtons(false);
|
||||
}
|
||||
#else // Non touch
|
||||
@@ -5390,6 +5392,37 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
buffer_obj.append(snifferPacket, len);
|
||||
}
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
int8_t WiFiScan::checkAnalyzerButtons(uint32_t currentTime) {
|
||||
boolean pressed = false;
|
||||
|
||||
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
|
||||
|
||||
// Do the touch stuff
|
||||
#ifdef HAS_ILI9341
|
||||
pressed = display_obj.tft.getTouch(&t_x, &t_y);
|
||||
#endif
|
||||
|
||||
// Check buttons for presses
|
||||
for (int8_t b = 0; b < BUTTON_ARRAY_LEN; b++)
|
||||
{
|
||||
if (pressed && display_obj.key[b].contains(t_x, t_y))
|
||||
{
|
||||
display_obj.key[b].press(true);
|
||||
} else {
|
||||
display_obj.key[b].press(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Which buttons pressed
|
||||
for (int8_t b = 0; b < BUTTON_ARRAY_LEN; b++)
|
||||
{
|
||||
if (display_obj.key[b].justReleased()) return b;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
void WiFiScan::eapolMonitorMain(uint32_t currentTime)
|
||||
{
|
||||
@@ -5405,7 +5438,7 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
y_pos_x = 0;
|
||||
y_pos_y = 0;
|
||||
y_pos_z = 0;
|
||||
boolean pressed = false;
|
||||
/*boolean pressed = false;
|
||||
|
||||
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
|
||||
|
||||
@@ -5414,14 +5447,6 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
pressed = display_obj.tft.getTouch(&t_x, &t_y);
|
||||
#endif
|
||||
|
||||
if (pressed) {
|
||||
Serial.print("Got touch | X: ");
|
||||
Serial.print(t_x);
|
||||
Serial.print(" Y: ");
|
||||
Serial.println(t_y);
|
||||
}
|
||||
|
||||
|
||||
// Check buttons for presses
|
||||
for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++)
|
||||
{
|
||||
@@ -5431,20 +5456,16 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
} else {
|
||||
display_obj.key[b].press(false);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Which buttons pressed
|
||||
for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++)
|
||||
{
|
||||
if (display_obj.key[b].justPressed())
|
||||
{
|
||||
Serial.println("Bro, key pressed");
|
||||
//do_break = true;
|
||||
}
|
||||
//for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++)
|
||||
//{
|
||||
// if (display_obj.key[b].justReleased())
|
||||
// {
|
||||
// do_break = true;
|
||||
|
||||
if (display_obj.key[b].justReleased())
|
||||
{
|
||||
do_break = true;
|
||||
int8_t b = this->checkAnalyzerButtons(currentTime);
|
||||
|
||||
// Channel - button pressed
|
||||
if (b == 4) {
|
||||
@@ -5480,8 +5501,8 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
this->orient_display = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
|
||||
if (currentTime - initTime >= (GRAPH_REFRESH * 5)) {
|
||||
x_pos += x_scale;
|
||||
@@ -5558,7 +5579,7 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
y_pos_x = 0;
|
||||
y_pos_y = 0;
|
||||
y_pos_z = 0;
|
||||
boolean pressed = false;
|
||||
/*boolean pressed = false;
|
||||
|
||||
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates
|
||||
|
||||
@@ -5584,20 +5605,17 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
} else {
|
||||
display_obj.key[b].press(false);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
// Which buttons pressed
|
||||
for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++)
|
||||
{
|
||||
if (display_obj.key[b].justPressed())
|
||||
{
|
||||
Serial.println("Bro, key pressed");
|
||||
//do_break = true;
|
||||
}
|
||||
//for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++)
|
||||
//{
|
||||
|
||||
if (display_obj.key[b].justReleased())
|
||||
{
|
||||
do_break = true;
|
||||
// if (display_obj.key[b].justReleased())
|
||||
// {
|
||||
// do_break = true;
|
||||
|
||||
int8_t b = this->checkAnalyzerButtons(currentTime);
|
||||
|
||||
// X - button pressed
|
||||
if (b == 0) {
|
||||
@@ -5694,8 +5712,8 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
this->orient_display = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
//}
|
||||
|
||||
if (currentTime - initTime >= GRAPH_REFRESH) {
|
||||
//Serial.println("-----------------------------------------");
|
||||
@@ -5778,11 +5796,6 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
|
||||
}
|
||||
#endif
|
||||
|
||||
//void WiFiScan::sniffer_callback(void* buf, wifi_promiscuous_pkt_type_t type) {
|
||||
// wifi_promiscuous_pkt_t *snifferPacket = (wifi_promiscuous_pkt_t*)buf;
|
||||
// showMetadata(snifferPacket, type);
|
||||
//}
|
||||
|
||||
void WiFiScan::changeChannel(int chan) {
|
||||
this->set_channel = chan;
|
||||
esp_wifi_set_channel(this->set_channel, WIFI_SECOND_CHAN_NONE);
|
||||
@@ -5903,9 +5916,9 @@ void WiFiScan::renderPacketRate() {
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAS_ILI9341
|
||||
/*#ifdef HAS_ILI9341
|
||||
display_obj.key[6].drawButton();
|
||||
#endif
|
||||
#endif*/
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5918,11 +5931,40 @@ void WiFiScan::packetRateLoop(uint32_t tick) {
|
||||
else if (this->currentScanMode == WIFI_SCAN_RAW_CAPTURE)
|
||||
this->renderRawStats();
|
||||
|
||||
#ifdef HAS_ILI9341
|
||||
initTime = millis();
|
||||
channelHop();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAS_ILI9341
|
||||
int8_t b = this->checkAnalyzerButtons(millis());
|
||||
|
||||
if (b == 6) {
|
||||
Serial.println("Exiting packet monitor...");
|
||||
this->StartScan(WIFI_SCAN_OFF);
|
||||
this->orient_display = true;
|
||||
return;
|
||||
}
|
||||
else if (b == 4) {
|
||||
if (set_channel > 1) {
|
||||
set_channel--;
|
||||
delay(70);
|
||||
display_obj.tftDrawChannelScaleButtons(set_channel, false);
|
||||
display_obj.tftDrawExitScaleButtons(false);
|
||||
changeChannel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Channel + button pressed
|
||||
else if (b == 5) {
|
||||
if (set_channel < MAX_CHANNEL) {
|
||||
set_channel++;
|
||||
delay(70);
|
||||
display_obj.tftDrawChannelScaleButtons(set_channel, false);
|
||||
display_obj.tftDrawExitScaleButtons(false);
|
||||
changeChannel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -442,6 +442,9 @@ class WiFiScan
|
||||
|
||||
wifi_config_t ap_config;
|
||||
|
||||
#ifdef HAS_SCREEN
|
||||
int8_t checkAnalyzerButtons(uint32_t currentTime);
|
||||
#endif
|
||||
void setMac();
|
||||
void renderRawStats();
|
||||
void renderPacketRate();
|
||||
|
||||
Reference in New Issue
Block a user