diff --git a/esp8266_deauther/APScan.cpp b/esp8266_deauther/APScan.cpp index 79e9b08..74bd689 100644 --- a/esp8266_deauther/APScan.cpp +++ b/esp8266_deauther/APScan.cpp @@ -10,10 +10,17 @@ bool APScan::start() { Serial.println("MAC - Ch - RSSI - Encrypt. - SSID - Hidden");// - Vendor"); } aps._clear(); - for (int i = 0; i < maxAPScanResults; i++) selected[i] = false; + results = 0; + for (int i = 0; i < maxAPScanResults; i++){ + selected[i] = false; + String("").toCharArray(names[i], 33); + } results = WiFi.scanNetworks(false, settings.apScanHidden); // lets scanNetworks return hidden APs. (async = false & show_hidden = true) + if(results > maxAPScanResults) results = maxAPScanResults; - for (int i = 0; i < results && i < maxAPScanResults; i++) { + if (debug) Serial.println("Scan results: "+(String)results); + + for (int i = 0; i < results; i++) { Mac _ap; _ap.set(WiFi.BSSID(i)[0], WiFi.BSSID(i)[1], WiFi.BSSID(i)[2], WiFi.BSSID(i)[3], WiFi.BSSID(i)[4], WiFi.BSSID(i)[5]); aps.add(_ap); diff --git a/esp8266_deauther/esp8266_deauther.ino b/esp8266_deauther/esp8266_deauther.ino index db0deaa..3ffd63a 100644 --- a/esp8266_deauther/esp8266_deauther.ino +++ b/esp8266_deauther/esp8266_deauther.ino @@ -12,7 +12,7 @@ #include #define resetPin 4 /* <-- comment out or change if you need GPIO 4 for other purposes */ -//#define USE_DISPLAY /* <-- uncomment that if you want to use the display */ +#define USE_DISPLAY /* <-- uncomment that if you want to use the display */ //#define USE_LED16 /* <-- for the Pocket ESP8266 which has a LED on GPIO 16 to indicate if it's running */ #ifdef USE_DISPLAY @@ -94,7 +94,7 @@ void drawInterface() { if (i == 0) display.drawString(3, i * fontSize, " --> WiFi " + wifiMode); else if (i == 1) display.drawString(3, i * fontSize, " --> " + scanMode); else if (i == 2) display.drawString(3, i * fontSize, " --> " + attackMode + " attack"); - else if (i - 3 <= apScan.results) { + else if (i - 3 < apScan.results) { display.drawString(3, _lrow * fontSize, apScan.getAPName(i - 3)); if (apScan.getAPSelected(i - 3)) { display.drawVerticalLine(1, _lrow * fontSize, fontSize); @@ -603,7 +603,8 @@ void loop() { // ===== SELECT ===== } else if (buttonPressed == 2) { - //WiFi on/off + + // ===== WiFi on/off ===== if (curRow == 0) { if (wifiMode == "ON") stopWifi(); else startWifi();