/********* Pleasedontcode.com ********** Pleasedontcode thanks you for automatic code generation! Enjoy your code! - Terms and Conditions: You have a non-exclusive, revocable, worldwide, royalty-free license for personal and commercial use. Attribution is optional; modifications are allowed, but you're responsible for code maintenance. We're not liable for any loss or damage. For full terms, please visit pleasedontcode.com/termsandconditions. - Project: WiFi Scanner - Source Code compiled for: ESP32 DevKit V1 - Source Code created on: 2024-02-13 08:19:09 ********* Pleasedontcode.com **********/ /****** SYSTEM REQUIREMENTS *****/ /****** SYSTEM REQUIREMENT 1 *****/ /* in promiscuous mode scan wifi for SSID */ /* "Lastmanstanding" and capture its 4-way handshake */ /* and store results to sd card */ /****** END SYSTEM REQUIREMENTS *****/ /****** DEFINITION OF LIBRARIES *****/ #include #include #include /****** DEFINITION OF SYSTEM REQUIREMENTS *****/ // System Requirement 1: Scan WiFi for SSID "Lastmanstanding" and capture its 4-way handshake const char* ssid = "Lastmanstanding"; const char* password = "password"; // System Requirement 2: Store results to SD card File datafile; /***** DEFINITION OF SPI PINS *****/ const uint8_t SD_SCK_PIN = 18; const uint8_t SD_MISO_PIN = 19; const uint8_t SD_MOSI_PIN = 23; const uint8_t SD_SS_PIN = 5; void setup() { // Initialize serial communication Serial.begin(9600); // Set SD chip select pin as an output pinMode(SD_SS_PIN, OUTPUT); // Start the SPI library SPI.begin(SD_SCK_PIN, SD_MISO_PIN, SD_MOSI_PIN, SD_SS_PIN); // Check if SD card exists and can be initialized if (!SD.begin(SD_SS_PIN)) { Serial.println("SD card initialization failed!"); while (1); } // Connect to WiFi network WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(1000); Serial.println("Connecting to WiFi..."); } // Open the data file on SD card if (SD.exists("data.txt")) { datafile = SD.open("data.txt", FILE_APPEND); } else { datafile = SD.open("data.txt", FILE_WRITE); datafile.println("SSID,SIGNAL_STRENGTH,TIME"); } } void loop() { // System Requirement 1: Scan WiFi for SSID "Lastmanstanding" and capture its 4-way handshake if (WiFi.status() == WL_CONNECTED) { // Get the SSID and signal strength String ssid = WiFi.SSID(); int signalStrength = WiFi.RSSI(); // Get the current date and time unsigned long currentTime = millis(); // Print and store the data Serial.print("SSID: "); Serial.println(ssid); Serial.print("Signal Strength: "); Serial.println(signalStrength); datafile.print(ssid); datafile.print(","); datafile.print(signalStrength); datafile.print(","); datafile.println(currentTime); delay(5000); // Delay for 5 seconds } }