WiFi Auto Auth now supports multiple network profiles, allowing you to automatically connect to different WiFi networks (home, work, school, etc.) with different credentials and settings.
- Auto-Detection: Automatically detects current network SSID and selects appropriate profile
- Manual Selection: Override auto-detection by specifying a network profile
- Network-Specific Logging: Track login attempts per network
- Dashboard Integration: View network-specific statistics in the web dashboard
- Backward Compatibility: Existing single-network configurations continue to work
Create or update your config.json file with the new multi-network format:
{
"default_network": "home",
"networks": {
"home": {
"ssid": "HomeWiFi",
"wifi_url": "http://192.168.1.1/login",
"username": "your_home_username",
"password": "your_home_password",
"product_type": "router",
"description": "Home WiFi network"
},
"work": {
"ssid": "OfficeWiFi",
"wifi_url": "http://10.0.0.1/login",
"username": "your_work_username",
"password": "your_work_password",
"product_type": "enterprise",
"description": "Work WiFi network"
},
"school": {
"ssid": "SchoolWiFi",
"wifi_url": "http://172.16.1.1/login",
"username": "your_school_username",
"password": "your_school_password",
"product_type": "edu",
"description": "School WiFi network"
}
},
"dashboard": {
"host": "127.0.0.1",
"port": 8000,
"username": "admin",
"password": "admin123"
}
}Existing single-network configurations will continue to work:
{
"wifi_url": "http://192.168.1.1/login",
"username": "your_username",
"password": "your_password",
"product_type": "router"
}The script automatically detects your current network SSID and selects the appropriate profile:
# Auto-detect current network and login
python wifi_auto_login.py --login
# Auto-detect and show recent logs
python wifi_auto_login.pyOverride auto-detection by specifying a network profile:
# Login using specific network profile
python wifi_auto_login.py --login --network work
# Test connection for specific network
python wifi_auto_login.py --test --network home# List all configured network profiles
python wifi_auto_login.py --list-networks
# Detect current network and show matching profile
python wifi_auto_login.py --detect-network
# View logs for specific network
python wifi_auto_login.py --view-logs 10 --network-filter work| Command | Description |
|---|---|
--network PROFILE |
Use specific network profile |
--list-networks |
List all configured networks |
--detect-network |
Detect current network |
--network-filter PROFILE |
Filter logs by network |
| Command | Description |
|---|---|
--login |
Auto-detects network or uses --network |
--test |
Tests connection for detected/specified network |
--view-logs N |
Shows network info in logs |
The script uses platform-specific methods to detect your current WiFi network:
- Uses
netsh wlan show interfacescommand - Requires WiFi adapter to be connected
- Uses
networksetup -getairportnetwork en0command - Falls back to
airport -Iutility
- Tries multiple methods:
iwgetid,nmcli,iwconfig - Requires appropriate network utilities installed
The database now includes network information:
CREATE TABLE login_attempts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
timestamp TEXT,
network_name TEXT, -- New: Network profile name
network_ssid TEXT, -- New: Actual SSID
username TEXT,
password TEXT,
a TEXT,
response_status TEXT,
response_message TEXT
);Existing databases are automatically upgraded with new columns.
- Per-network success rates
- Network-specific attempt counts
- Last login time per network
- Filter logs by network profile
- Network-specific historical data
- Multi-network overview
| Endpoint | Description |
|---|---|
/api/network-stats |
Get per-network statistics |
/api/attempts?network_filter=PROFILE |
Filtered login attempts |
-
Backup your current config.json:
cp config.json config.json.backup
-
Update configuration format:
# Use the new example as template cp config.example.json config.json # Edit config.json with your networks
-
Test the configuration:
python wifi_auto_login.py --list-networks python wifi_auto_login.py --detect-network
You can keep using legacy format while adding new networks:
{
"wifi_url": "http://192.168.1.1/login",
"username": "legacy_user",
"password": "legacy_pass",
"networks": {
"work": {
"ssid": "OfficeWiFi",
"wifi_url": "http://10.0.0.1/login",
"username": "work_user",
"password": "work_pass"
}
}
}-
No SSID detected:
# Check if WiFi is connected python wifi_auto_login.py --detect-network # Manually specify network python wifi_auto_login.py --login --network home
-
Platform not supported:
- Windows: Ensure you have admin privileges for netsh
- macOS: Check if networksetup is available
- Linux: Install wireless-tools or network-manager
-
Profile not found:
# List available profiles python wifi_auto_login.py --list-networks # Check SSID matches exactly python wifi_auto_login.py --detect-network
-
Invalid JSON:
# Validate JSON syntax python -m json.tool config.json -
Missing network profile:
- Add the network to your config.json
- Ensure SSID matches exactly (case-sensitive)
-
Legacy compatibility:
- Old format still works
- Gradually migrate to new format
- Use descriptive names:
home,work,coffee-shop - Include descriptions: Help identify networks later
- Set default network: For fallback when detection fails
- Test each profile: Verify credentials before deployment
- Protect config.json: Contains passwords in plain text
- Use different passwords: Don't reuse across networks
- Regular updates: Change passwords periodically
- Backup configurations: Keep secure backups
- Use dashboard: Monitor per-network success rates
- Check logs regularly: Identify authentication issues
- Network-specific analysis: Filter logs by network
- Set up alerts: Monitor for failure patterns
# 1. Set up configuration
cp config.example.json config.json
# Edit config.json with your networks
# 2. Test configuration
python wifi_auto_login.py --list-networks
python wifi_auto_login.py --detect-network
# 3. Test each network
python wifi_auto_login.py --test --network home
python wifi_auto_login.py --test --network work
# 4. Set up automatic login
python wifi_auto_login.py --login
# 5. Monitor via dashboard
python wifi_auto_login.py --dashboard#!/bin/bash
# Example script for automated network handling
# Detect current network
CURRENT_NETWORK=$(python wifi_auto_login.py --detect-network 2>/dev/null | grep "Found matching profile" | cut -d: -f2 | xargs)
if [ -n "$CURRENT_NETWORK" ]; then
echo "Logging into detected network: $CURRENT_NETWORK"
python wifi_auto_login.py --login --network "$CURRENT_NETWORK"
else
echo "No matching network profile found, using auto-detection"
python wifi_auto_login.py --login
fiIf you encounter issues with multi-network support:
- Check the troubleshooting section above
- Enable debug logging:
python wifi_auto_login.py --log-level DEBUG - Test with single network first
- Report issues with network detection details
- Include platform information (Windows/macOS/Linux)
The multi-network feature is designed to be backward compatible while providing powerful new capabilities for managing multiple WiFi environments.