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

Marauder logo

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 callable); void showMenuList(Menu* menu, int layer); + void orientDisplay(); public: MenuFunctions(); diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp index 5c64d0a84..b2b3b4fef 100644 --- a/esp32_marauder/WiFiScan.cpp +++ b/esp32_marauder/WiFiScan.cpp @@ -2,6 +2,11 @@ //esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, bool en_sys_seq); +//int num_beacon = 0; +int num_beacon = 0; +int num_deauth = 0; +int num_probe = 0; + class bluetoothScanAllCallback: public BLEAdvertisedDeviceCallbacks { void onResult(BLEAdvertisedDevice advertisedDevice) { String display_string = ""; @@ -122,6 +127,8 @@ void WiFiScan::StartScan(uint8_t scan_mode, uint16_t color) RunBeaconScan(scan_mode, color); else if (scan_mode == WIFI_SCAN_DEAUTH) RunDeauthScan(scan_mode, color); + else if (scan_mode == WIFI_PACKET_MONITOR) + RunPacketMonitor(scan_mode, color); else if (scan_mode == WIFI_ATTACK_BEACON_SPAM) RunBeaconSpam(scan_mode, color); else if (scan_mode == WIFI_ATTACK_RICK_ROLL) @@ -148,7 +155,6 @@ void WiFiScan::StopScan(uint8_t scan_mode) esp_wifi_set_promiscuous(false); WiFi.mode(WIFI_OFF); } - else if ((currentScanMode == BT_SCAN_ALL) || (currentScanMode == BT_SCAN_SKIMMERS)) { @@ -164,6 +170,41 @@ void WiFiScan::StopScan(uint8_t scan_mode) display_obj.tteBar = false; } +void WiFiScan::RunPacketMonitor(uint8_t scan_mode, uint16_t color) +{ + display_obj.tft.init(); + display_obj.tft.setRotation(1); + display_obj.tft.fillScreen(TFT_BLACK); + uint16_t calData[5] = { 391, 3491, 266, 3505, 7 }; + display_obj.tft.setTouch(calData); + + //display_obj.tft.setFreeFont(1); + display_obj.tft.setFreeFont(NULL); + display_obj.tft.setTextSize(1); + display_obj.tft.fillRect(127, 0, 193, 28, TFT_BLACK); // Buttons + display_obj.tft.fillRect(12, 0, 90, 32, TFT_BLACK); // color key + + delay(10); + + display_obj.tftDrawGraphObjects(x_scale); //draw graph objects + display_obj.tftDrawColorKey(); + display_obj.tftDrawXScaleButtons(x_scale); + display_obj.tftDrawYScaleButtons(y_scale); + display_obj.tftDrawChannelScaleButtons(set_channel); + display_obj.tftDrawExitScaleButtons(); + + Serial.println("Running packet scan..."); + wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); + esp_wifi_init(&cfg); + esp_wifi_set_storage(WIFI_STORAGE_RAM); + esp_wifi_set_mode(WIFI_MODE_NULL); + esp_wifi_set_promiscuous(true); + esp_wifi_set_promiscuous_filter(&filt); + esp_wifi_set_promiscuous_rx_cb(&wifiSnifferCallback); + esp_wifi_set_channel(set_channel, WIFI_SECOND_CHAN_NONE); + uint32_t initTime = millis(); +} + void WiFiScan::RunRickRoll(uint8_t scan_mode, uint16_t color) { //Serial.println("Rick Roll..."); @@ -643,11 +684,262 @@ void WiFiScan::broadcastRandomSSID(uint32_t currentTime) { } +void WiFiScan::wifiSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type) +{ + wifi_promiscuous_pkt_t *snifferPacket = (wifi_promiscuous_pkt_t*)buf; + WifiMgmtHdr *frameControl = (WifiMgmtHdr*)snifferPacket->payload; + wifi_pkt_rx_ctrl_t ctrl = (wifi_pkt_rx_ctrl_t)snifferPacket->rx_ctrl; + int len = snifferPacket->rx_ctrl.sig_len; + + if (type == WIFI_PKT_MGMT) + { + int fctl = ntohs(frameControl->fctl); + const wifi_ieee80211_packet_t *ipkt = (wifi_ieee80211_packet_t *)snifferPacket->payload; + const WifiMgmtHdr *hdr = &ipkt->hdr; + + // If we dont the buffer size is not 0, don't write or else we get CORRUPT_HEAP + if (snifferPacket->payload[0] == 0x80) + { + num_beacon++; + } + else if ((snifferPacket->payload[0] == 0xA0 || snifferPacket->payload[0] == 0xC0 )) + { + num_deauth++; + } + else if (snifferPacket->payload[0] == 0x40) + { + num_probe++; + } + } +} + +void WiFiScan::packetMonitorMain() +{ + //---------MAIN 'FOR' LOOP! THIS IS WHERE ALL THE ACTION HAPPENS! HAS TO BE FAST!!!!!---------\\ + + + for (x_pos = (11 + x_scale); x_pos <= 320; x_pos += x_scale) //go along every point on the x axis and do something, start over when finished + { + do_break = false; + + y_pos_x = 0; + y_pos_y = 0; + y_pos_z = 0; + boolean pressed = false; + + uint16_t t_x = 0, t_y = 0; // To store the touch coordinates + + // Do the touch stuff + pressed = display_obj.tft.getTouch(&t_x, &t_y); + + 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++) + { + 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 (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()) + { + do_break = true; + + // X - button pressed + if (b == 0) { + if (x_scale > 1) { + x_scale--; + delay(70); + display_obj.tft.fillRect(127, 0, 193, 28, TFT_BLACK); + display_obj.tftDrawXScaleButtons(x_scale); + display_obj.tftDrawYScaleButtons(y_scale); + display_obj.tftDrawChannelScaleButtons(set_channel); + display_obj.tftDrawExitScaleButtons(); + break; + } + } + // X + button pressed + else if (b == 1) { + if (x_scale < 6) { + x_scale++; + delay(70); + display_obj.tft.fillRect(127, 0, 193, 28, TFT_BLACK); + display_obj.tftDrawXScaleButtons(x_scale); + display_obj.tftDrawYScaleButtons(y_scale); + display_obj.tftDrawChannelScaleButtons(set_channel); + display_obj.tftDrawExitScaleButtons(); + break; + } + } + + // Y - button pressed + else if (b == 2) { + if (y_scale > 1) { + y_scale--; + delay(70); + display_obj.tft.fillRect(127, 0, 193, 28, TFT_BLACK); + display_obj.tftDrawXScaleButtons(x_scale); + display_obj.tftDrawYScaleButtons(y_scale); + display_obj.tftDrawChannelScaleButtons(set_channel); + display_obj.tftDrawExitScaleButtons(); + //updateMidway(); + break; + } + } + + // Y + button pressed + else if (b == 3) { + if (y_scale < 6) { + y_scale++; + delay(70); + display_obj.tft.fillRect(127, 0, 193, 28, TFT_BLACK); + display_obj.tftDrawXScaleButtons(x_scale); + display_obj.tftDrawYScaleButtons(y_scale); + display_obj.tftDrawChannelScaleButtons(set_channel); + display_obj.tftDrawExitScaleButtons(); + //updateMidway(); + break; + } + } + + // Channel - button pressed + else if (b == 4) { + if (set_channel > 1) { + Serial.println("Shit channel down"); + set_channel--; + delay(70); + display_obj.tft.fillRect(127, 0, 193, 28, TFT_BLACK); + display_obj.tftDrawXScaleButtons(x_scale); + display_obj.tftDrawYScaleButtons(y_scale); + display_obj.tftDrawChannelScaleButtons(set_channel); + display_obj.tftDrawExitScaleButtons(); + changeChannel(); + break; + } + } + + // Channel + button pressed + else if (b == 5) { + if (set_channel < MAX_CHANNEL) { + Serial.println("Shit channel up"); + set_channel++; + delay(70); + display_obj.tft.fillRect(127, 0, 193, 28, TFT_BLACK); + display_obj.tftDrawXScaleButtons(x_scale); + display_obj.tftDrawYScaleButtons(y_scale); + display_obj.tftDrawChannelScaleButtons(set_channel); + display_obj.tftDrawExitScaleButtons(); + changeChannel(); + break; + } + } + else if (b == 6) { + Serial.println("Exiting packet monitor..."); + this->StartScan(WIFI_SCAN_OFF); + //display_obj.tft.init(); + this->orient_display = true; + return; + } + } + } + + y_pos_x = ((-num_beacon * (y_scale * 10)) + (HEIGHT_1 - 2)); // GREEN + y_pos_y = ((-num_deauth * (y_scale * 10)) + (HEIGHT_1 - 2)); // RED + y_pos_z = ((-num_probe * (y_scale * 10)) + (HEIGHT_1 - 2)); // BLUE + + num_beacon = 0; + num_probe = 0; + num_deauth = 0; + + //CODE FOR PLOTTING CONTINUOUS LINES!!!!!!!!!!!! + //Plot "X" value + display_obj.tft.drawLine(x_pos - x_scale, y_pos_x_old, x_pos, y_pos_x, TFT_GREEN); + //Plot "Z" value + display_obj.tft.drawLine(x_pos - x_scale, y_pos_z_old, x_pos, y_pos_z, TFT_BLUE); + //Plot "Y" value + display_obj.tft.drawLine(x_pos - x_scale, y_pos_y_old, x_pos, y_pos_y, TFT_RED); + + //Draw preceding black 'boxes' to erase old plot lines, !!!WEIRD CODE TO COMPENSATE FOR BUTTONS AND COLOR KEY SO 'ERASER' DOESN'T ERASE BUTTONS AND COLOR KEY!!! + //if ((x_pos <= 90) || ((x_pos >= 198) && (x_pos <= 320))) //above x axis + if ((x_pos <= 90) || ((x_pos >= 117) && (x_pos <= 320))) //above x axis + { + display_obj.tft.fillRect(x_pos+1, 28, 10, 93, TFT_BLACK); //compensate for buttons! + } + else + { + display_obj.tft.fillRect(x_pos+1, 0, 10, 121, TFT_BLACK); //don't compensate for buttons! + } + //if ((x_pos >= 254) && (x_pos <= 320)) //below x axis + //if (x_pos <= 90) + if (x_pos < 0) // below x axis + { + //tft.fillRect(x_pos+1, 121, 10, 88, TFT_BLACK); + display_obj.tft.fillRect(x_pos+1, 121, 10, 88, TFT_CYAN); + } + else + { + //tft.fillRect(x_pos+1, 121, 10, 119, TFT_BLACK); + display_obj.tft.fillRect(x_pos+1, 121, 10, 118, TFT_BLACK); + } + + //tftDisplayTime(); + + if ( (y_pos_x == 120) || (y_pos_y == 120) || (y_pos_z == 120) ) + { + display_obj.tft.drawFastHLine(10, 120, 310, TFT_WHITE); // x axis + } + + y_pos_x_old = y_pos_x; //set old y pos values to current y pos values + y_pos_y_old = y_pos_y; + y_pos_z_old = y_pos_z; + + //delay(50); + + } + + display_obj.tft.fillRect(127, 0, 193, 28, TFT_BLACK); //erase XY buttons and any lines behind them + //tft.fillRect(56, 0, 66, 32, TFT_ORANGE); //erase time and color key and any stray lines behind them + display_obj.tft.fillRect(12, 0, 90, 32, TFT_BLACK); // key + + display_obj.tftDrawXScaleButtons(x_scale); //redraw stuff + display_obj.tftDrawYScaleButtons(y_scale); + display_obj.tftDrawChannelScaleButtons(set_channel); + display_obj.tftDrawExitScaleButtons(); + display_obj.tftDrawColorKey(); + display_obj.tftDrawGraphObjects(x_scale); +} + + //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() +{ + esp_wifi_set_channel(set_channel, WIFI_SECOND_CHAN_NONE); + delay(1); +} + // Function to cycle to the next channel void WiFiScan::channelHop() { @@ -676,6 +968,10 @@ void WiFiScan::main(uint32_t currentTime) channelHop(); } } + else if (currentScanMode == WIFI_PACKET_MONITOR) + { + packetMonitorMain(); + } else if ((currentScanMode == WIFI_ATTACK_BEACON_SPAM)) { // Need this for loop because getTouch causes ~10ms delay diff --git a/esp32_marauder/WiFiScan.h b/esp32_marauder/WiFiScan.h index 67ac54c59..9b2d16013 100644 --- a/esp32_marauder/WiFiScan.h +++ b/esp32_marauder/WiFiScan.h @@ -20,10 +20,13 @@ #define WIFI_SCAN_ST 3 #define WIFI_SCAN_DEAUTH 4 #define WIFI_SCAN_ALL 5 -#define WIFI_ATTACK_BEACON_SPAM 6 -#define WIFI_ATTACK_RICK_ROLL 7 -#define BT_SCAN_ALL 8 -#define BT_SCAN_SKIMMERS 9 +#define WIFI_PACKET_MONITOR 6 +#define WIFI_ATTACK_BEACON_SPAM 7 +#define WIFI_ATTACK_RICK_ROLL 8 +#define BT_SCAN_ALL 9 +#define BT_SCAN_SKIMMERS 10 + +#define MAX_CHANNEL 14 extern Display display_obj; @@ -32,6 +35,23 @@ esp_err_t esp_wifi_80211_tx(wifi_interface_t ifx, const void *buffer, int len, b class WiFiScan { private: + 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 + float y_pos_y; //current graph y axis position of Y value + float y_pos_y_old = 120; //old y axis position of Y value + float y_pos_z; //current graph y axis position of Z value + float y_pos_z_old = 120; //old y axis position of Z value + int midway = 0; + byte x_scale = 1; //scale of graph x axis, controlled by touchscreen buttons + byte y_scale = 1; + + bool do_break = false; + + //int num_beacon = 0; // GREEN + //int num_probe = 0; // BLUE + //int num_deauth = 0; // RED + uint32_t initTime = 0; bool run_setup = true; int set_channel = 1; @@ -84,6 +104,14 @@ class WiFiScan /*36*/ 0x00 }; + void packetMonitorMain(); + void changeChannel(); + void updateMidway(); + void tftDrawXScalButtons(); + void tftDrawYScaleButtons(); + void tftDrawChannelScaleButtons(); + void tftDrawColorKey(); + void tftDrawGraphObjects(); void broadcastRandomSSID(uint32_t currentTime); void broadcastSetSSID(uint32_t current_time, char* ESSID); void RunRickRoll(uint8_t scan_mode, uint16_t color); @@ -91,12 +119,15 @@ class WiFiScan void RunBeaconScan(uint8_t scan_mode, uint16_t color); void RunDeauthScan(uint8_t scan_mode, uint16_t color); void RunProbeScan(uint8_t scan_mode, uint16_t color); + void RunPacketMonitor(uint8_t scan_mode, uint16_t color); void RunBluetoothScan(uint8_t scan_mode, uint16_t color); static void scanCompleteCB(BLEScanResults scanResults); public: WiFiScan(); + bool orient_display = false; + void channelHop(); @@ -109,5 +140,6 @@ class WiFiScan static void beaconSnifferCallback(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 wifiSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type); }; #endif diff --git a/esp32_marauder/esp32_marauder.ino b/esp32_marauder/esp32_marauder.ino index 01111c223..996dc539d 100644 --- a/esp32_marauder/esp32_marauder.ino +++ b/esp32_marauder/esp32_marauder.ino @@ -56,7 +56,8 @@ void loop() display_obj.main(); wifi_scan_obj.main(currentTime); //if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM)) - menu_function_obj.main(); + if (wifi_scan_obj.currentScanMode != WIFI_PACKET_MONITOR) + menu_function_obj.main(); delay(1); } else