From 691bf30dbea0276d96e28c20b497b5fe69c32db7 Mon Sep 17 00:00:00 2001 From: Just Call Me Koko Date: Thu, 25 Apr 2024 13:32:05 -0400 Subject: [PATCH] Show essid or bssid for ap scans --- esp32_marauder/WiFiScan.cpp | 41 +++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/esp32_marauder/WiFiScan.cpp b/esp32_marauder/WiFiScan.cpp index f1d0eb3dc..b19320ebb 100644 --- a/esp32_marauder/WiFiScan.cpp +++ b/esp32_marauder/WiFiScan.cpp @@ -2601,16 +2601,25 @@ void WiFiScan::apSnifferCallbackFull(void* buf, wifi_promiscuous_pkt_type_t type Serial.print(snifferPacket->rx_ctrl.channel); Serial.print(" BSSID: "); Serial.print(addr); - display_string.concat(addr); + //display_string.concat(addr); + //Serial.print(" ESSID: "); + //display_string.concat(" -> "); + //for (int i = 0; i < snifferPacket->payload[37]; i++) + //{ + // Serial.print((char)snifferPacket->payload[i + 38]); + // display_string.concat((char)snifferPacket->payload[i + 38]); + // essid.concat((char)snifferPacket->payload[i + 38]); + //} Serial.print(" ESSID: "); - display_string.concat(" -> "); - for (int i = 0; i < snifferPacket->payload[37]; i++) - { - Serial.print((char)snifferPacket->payload[i + 38]); - display_string.concat((char)snifferPacket->payload[i + 38]); - essid.concat((char)snifferPacket->payload[i + 38]); - - + if (snifferPacket->payload[37] <= 0) + display_string.concat(addr); + else { + for (int i = 0; i < snifferPacket->payload[37]; i++) + { + Serial.print((char)snifferPacket->payload[i + 38]); + display_string.concat((char)snifferPacket->payload[i + 38]); + essid.concat((char)snifferPacket->payload[i + 38]); + } } bssid.concat(addr); @@ -2910,13 +2919,15 @@ void WiFiScan::beaconSnifferCallback(void* buf, wifi_promiscuous_pkt_type_t type char addr[] = "00:00:00:00:00:00"; getMAC(addr, snifferPacket->payload, 10); Serial.print(addr); - display_string.concat(addr); Serial.print(" ESSID: "); - display_string.concat(" -> "); - for (int i = 0; i < snifferPacket->payload[37]; i++) - { - Serial.print((char)snifferPacket->payload[i + 38]); - display_string.concat((char)snifferPacket->payload[i + 38]); + if (snifferPacket->payload[37] <= 0) + display_string.concat(addr); + else { + for (int i = 0; i < snifferPacket->payload[37]; i++) + { + Serial.print((char)snifferPacket->payload[i + 38]); + display_string.concat((char)snifferPacket->payload[i + 38]); + } } int temp_len = display_string.length();