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:
Just Call Me Koko
2025-04-04 10:17:12 -04:00
parent e662f917bc
commit d3299474c6
6 changed files with 165 additions and 100 deletions

View File

@@ -189,31 +189,56 @@ void Display::tftDrawYScaleButtons(byte y_scale)
key[3].drawButton(); 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); if (lnd_an) {
tft.setCursor(145, 21); tft.setTextColor(TFT_WHITE); tft.setTextSize(1); tft.print(text10); tft.print(set_channel); 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 key[4].initButton(&tft, // channel - box
164, 164,
10, // x, y, w, h, outline, fill, text 10, // x, y, w, h, outline, fill, text
20, EXT_BUTTON_WIDTH,
20, EXT_BUTTON_WIDTH,
TFT_BLACK, // Outline TFT_BLACK, // Outline
TFT_BLUE, // Fill TFT_BLUE, // Fill
TFT_BLACK, // Text TFT_BLACK, // Text
"-", "-",
2); 2);
key[5].initButton(&tft, // channel + box key[5].initButton(&tft, // channel + box
193, 193,
10, // x, y, w, h, outline, fill, text 10, // x, y, w, h, outline, fill, text
20, EXT_BUTTON_WIDTH,
20, EXT_BUTTON_WIDTH,
TFT_BLACK, // Outline TFT_BLACK, // Outline
TFT_BLUE, // Fill TFT_BLUE, // Fill
TFT_BLACK, // Text TFT_BLACK, // Text
"+", "+",
2); 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[4].setLabelDatum(1, 5, MC_DATUM);
key[5].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.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("Channel:"); tft.print(set_channel);
if (lnd_an) { if (lnd_an) {
key[6].initButton(&tft, // Exit box key[6].initButton(&tft, // Exit box
137, 137,
10, // x, y, w, h, outline, fill, text 10, // x, y, w, h, outline, fill, text
20, EXT_BUTTON_WIDTH,
20, EXT_BUTTON_WIDTH,
TFT_ORANGE, // Outline TFT_ORANGE, // Outline
TFT_RED, // Fill TFT_RED, // Fill
TFT_BLACK, // Text TFT_BLACK, // Text

View File

@@ -112,8 +112,8 @@ class Display
void tftDrawColorKey(); void tftDrawColorKey();
void tftDrawXScaleButtons(byte x_scale); void tftDrawXScaleButtons(byte x_scale);
void tftDrawYScaleButtons(byte y_scale); void tftDrawYScaleButtons(byte y_scale);
void tftDrawChannelScaleButtons(int set_channel); void tftDrawChannelScaleButtons(int set_channel, bool lnd_an = true);
void tftDrawExitScaleButtons(bool lnd_an = false); void tftDrawExitScaleButtons(bool lnd_an = true);
void buildBanner(String msg, int xpos); void buildBanner(String msg, int xpos);
void clearScreen(); void clearScreen();
void displayBuffer(bool do_clear = false); void displayBuffer(bool do_clear = false);

View File

@@ -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; boolean pressed = false;
// This is code from bodmer's keypad example // 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 // Check if any key coordinate boxes contain the touch coordinates
// This is for when on a menu // 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 #ifdef HAS_ILI9341
if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM) && if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM) &&
(wifi_scan_obj.currentScanMode != WIFI_ATTACK_AP_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_MANUAL) &&
(wifi_scan_obj.currentScanMode != WIFI_ATTACK_DEAUTH_TARGETED) && (wifi_scan_obj.currentScanMode != WIFI_ATTACK_DEAUTH_TARGETED) &&
(wifi_scan_obj.currentScanMode != WIFI_ATTACK_MIMIC) && (wifi_scan_obj.currentScanMode != WIFI_ATTACK_MIMIC) &&
(wifi_scan_obj.currentScanMode != WIFI_SCAN_PACKET_RATE) &&
(wifi_scan_obj.currentScanMode != WIFI_ATTACK_RICK_ROLL)) (wifi_scan_obj.currentScanMode != WIFI_ATTACK_RICK_ROLL))
{ {
// Need this to set all keys to false // Need this to set all keys to false
@@ -1630,11 +1620,13 @@ void MenuFunctions::RunSetup()
this->drawStatusBar(); this->drawStatusBar();
wifi_scan_obj.StartScan(WIFI_SCAN_PROBE, TFT_CYAN); wifi_scan_obj.StartScan(WIFI_SCAN_PROBE, TFT_CYAN);
}); });
this->addNodes(&wifiSnifferMenu, text_table1[43], TFTMAGENTA, NULL, BEACON_SNIFF, [this]() { #ifndef HAS_ILI9341
display_obj.clearScreen(); this->addNodes(&wifiSnifferMenu, text_table1[43], TFTMAGENTA, NULL, BEACON_SNIFF, [this]() {
this->drawStatusBar(); display_obj.clearScreen();
wifi_scan_obj.StartScan(WIFI_SCAN_AP, TFT_MAGENTA); this->drawStatusBar();
}); wifi_scan_obj.StartScan(WIFI_SCAN_AP, TFT_MAGENTA);
});
#endif
this->addNodes(&wifiSnifferMenu, text_table1[44], TFTRED, NULL, DEAUTH_SNIFF, [this]() { this->addNodes(&wifiSnifferMenu, text_table1[44], TFTRED, NULL, DEAUTH_SNIFF, [this]() {
display_obj.clearScreen(); display_obj.clearScreen();
this->drawStatusBar(); this->drawStatusBar();
@@ -1699,11 +1691,13 @@ void MenuFunctions::RunSetup()
this->drawStatusBar(); this->drawStatusBar();
wifi_scan_obj.StartScan(WIFI_SCAN_AP_STA, 0x97e0); wifi_scan_obj.StartScan(WIFI_SCAN_AP_STA, 0x97e0);
}); });
this->addNodes(&wifiSnifferMenu, text_table1[59], TFTORANGE, NULL, PACKET_MONITOR, [this]() { #ifndef HAS_ILI9341
display_obj.clearScreen(); this->addNodes(&wifiSnifferMenu, text_table1[59], TFTORANGE, NULL, PACKET_MONITOR, [this]() {
this->drawStatusBar(); display_obj.clearScreen();
wifi_scan_obj.StartScan(WIFI_SCAN_STATION, TFT_WHITE); this->drawStatusBar();
}); wifi_scan_obj.StartScan(WIFI_SCAN_STATION, TFT_WHITE);
});
#endif
//#ifdef HAS_ILI9341 //#ifdef HAS_ILI9341
this->addNodes(&wifiSnifferMenu, "Signal Monitor", TFTCYAN, NULL, PACKET_MONITOR, [this]() { this->addNodes(&wifiSnifferMenu, "Signal Monitor", TFTCYAN, NULL, PACKET_MONITOR, [this]() {
display_obj.clearScreen(); display_obj.clearScreen();

View File

@@ -2203,9 +2203,11 @@ void WiFiScan::RunPacketMonitor(uint8_t scan_mode, uint16_t color)
else if (scan_mode == WIFI_SCAN_PACKET_RATE) else if (scan_mode == WIFI_SCAN_PACKET_RATE)
display_obj.tft.drawCentreString("Packet Rate", 120, 16, 2); display_obj.tft.drawCentreString("Packet Rate", 120, 16, 2);
#endif #endif
display_obj.tft.setFreeFont(NULL);
display_obj.tft.setTextSize(1);
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK); display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA); display_obj.setupScrollArea(display_obj.TOP_FIXED_AREA_2, BOT_FIXED_AREA);
display_obj.tftDrawChannelScaleButtons(set_channel); display_obj.tftDrawChannelScaleButtons(set_channel, false);
display_obj.tftDrawExitScaleButtons(false); display_obj.tftDrawExitScaleButtons(false);
} }
#else // Non touch #else // Non touch
@@ -5390,6 +5392,37 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
buffer_obj.append(snifferPacket, len); 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 #ifdef HAS_SCREEN
void WiFiScan::eapolMonitorMain(uint32_t currentTime) 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_x = 0;
y_pos_y = 0; y_pos_y = 0;
y_pos_z = 0; y_pos_z = 0;
boolean pressed = false; /*boolean pressed = false;
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates 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); pressed = display_obj.tft.getTouch(&t_x, &t_y);
#endif #endif
if (pressed) {
Serial.print("Got touch | X: ");
Serial.print(t_x);
Serial.print(" Y: ");
Serial.println(t_y);
}
// Check buttons for presses // Check buttons for presses
for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++) 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 { } else {
display_obj.key[b].press(false); display_obj.key[b].press(false);
} }
} }*/
// Which buttons pressed // Which buttons pressed
for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++) //for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++)
{ //{
if (display_obj.key[b].justPressed()) // if (display_obj.key[b].justReleased())
{ // {
Serial.println("Bro, key pressed"); // do_break = true;
//do_break = true;
} int8_t b = this->checkAnalyzerButtons(currentTime);
if (display_obj.key[b].justReleased())
{
do_break = true;
// Channel - button pressed // Channel - button pressed
if (b == 4) { if (b == 4) {
@@ -5480,8 +5501,8 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
this->orient_display = true; this->orient_display = true;
return; return;
} }
} // }
} //}
if (currentTime - initTime >= (GRAPH_REFRESH * 5)) { if (currentTime - initTime >= (GRAPH_REFRESH * 5)) {
x_pos += x_scale; x_pos += x_scale;
@@ -5558,7 +5579,7 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
y_pos_x = 0; y_pos_x = 0;
y_pos_y = 0; y_pos_y = 0;
y_pos_z = 0; y_pos_z = 0;
boolean pressed = false; /*boolean pressed = false;
uint16_t t_x = 0, t_y = 0; // To store the touch coordinates 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 { } else {
display_obj.key[b].press(false); display_obj.key[b].press(false);
} }
} }*/
// Which buttons pressed // Which buttons pressed
for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++) //for (uint8_t b = 0; b < BUTTON_ARRAY_LEN; b++)
{ //{
if (display_obj.key[b].justPressed())
{
Serial.println("Bro, key pressed");
//do_break = true;
}
if (display_obj.key[b].justReleased()) // if (display_obj.key[b].justReleased())
{ // {
do_break = true; // do_break = true;
int8_t b = this->checkAnalyzerButtons(currentTime);
// X - button pressed // X - button pressed
if (b == 0) { if (b == 0) {
@@ -5694,8 +5712,8 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
this->orient_display = true; this->orient_display = true;
return; return;
} }
} // }
} //}
if (currentTime - initTime >= GRAPH_REFRESH) { if (currentTime - initTime >= GRAPH_REFRESH) {
//Serial.println("-----------------------------------------"); //Serial.println("-----------------------------------------");
@@ -5778,11 +5796,6 @@ void WiFiScan::activeEapolSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t
} }
#endif #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) { void WiFiScan::changeChannel(int chan) {
this->set_channel = chan; this->set_channel = chan;
esp_wifi_set_channel(this->set_channel, WIFI_SECOND_CHAN_NONE); 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(); display_obj.key[6].drawButton();
#endif #endif*/
#endif #endif
} }
@@ -5918,11 +5931,40 @@ void WiFiScan::packetRateLoop(uint32_t tick) {
else if (this->currentScanMode == WIFI_SCAN_RAW_CAPTURE) else if (this->currentScanMode == WIFI_SCAN_RAW_CAPTURE)
this->renderRawStats(); 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 #endif
} }

View File

@@ -442,6 +442,9 @@ class WiFiScan
wifi_config_t ap_config; wifi_config_t ap_config;
#ifdef HAS_SCREEN
int8_t checkAnalyzerButtons(uint32_t currentTime);
#endif
void setMac(); void setMac();
void renderRawStats(); void renderRawStats();
void renderPacketRate(); void renderPacketRate();

View File

@@ -399,7 +399,7 @@ void loop()
//temp_obj.main(currentTime); //temp_obj.main(currentTime);
#endif #endif
settings_obj.main(currentTime); settings_obj.main(currentTime);
if (((wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) && (wifi_scan_obj.currentScanMode != WIFI_SCAN_EAPOL)) || if (((wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) && (wifi_scan_obj.currentScanMode != WIFI_SCAN_EAPOL)) ||
(mini)) { (mini)) {
#ifdef HAS_SCREEN #ifdef HAS_SCREEN
menu_function_obj.main(currentTime); menu_function_obj.main(currentTime);