edit README.md, add 99-captive-portal
This commit is contained in:
parent
4a946cebef
commit
5257ac8a0b
54
99-captive-portal
Executable file
54
99-captive-portal
Executable file
@ -0,0 +1,54 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Konfiguration
|
||||||
|
LOG_FILE="/var/log/nm-captive.log"
|
||||||
|
|
||||||
|
# Log-Funktion
|
||||||
|
log() {
|
||||||
|
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1" >> "$LOG_FILE"
|
||||||
|
}
|
||||||
|
|
||||||
|
check_captive_portal() {
|
||||||
|
# Teste mit Google's Connectivity Check (sollte 204 zurückgeben)
|
||||||
|
local url="http://connectivitycheck.gstatic.com/generate_204"
|
||||||
|
local http_code=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 5 "$url")
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
log "Network error - captive portal likely"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$http_code" = "204" ]; then
|
||||||
|
log "Connectivity check passed (204) - no captive portal"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
log "Connectivity check failed (HTTP $http_code) - captive portal detected"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
log "=== Dispatch triggered: $1 $2 ==="
|
||||||
|
|
||||||
|
if [[ "$1" == wl* ]] && [ "$2" = "up" ]; then
|
||||||
|
sleep 3
|
||||||
|
|
||||||
|
if ! check_captive_portal; then
|
||||||
|
log "CAPTIVE PORTAL DETECTED! Opening browser..."
|
||||||
|
|
||||||
|
# Finde Benutzer und starte Firefox
|
||||||
|
local_user=$(who | grep "(:0)" | awk '{print $1}' | head -n1)
|
||||||
|
if [ -n "$local_user" ]; then
|
||||||
|
export DISPLAY=:0
|
||||||
|
export XAUTHORITY=/home/$local_user/.Xauthority
|
||||||
|
|
||||||
|
# Starte Firefox im Hintergrund
|
||||||
|
sudo -u $local_user env DISPLAY=:0 XAUTHORITY=/home/$local_user/.Xauthority \
|
||||||
|
firefox --new-window "http://captive.apple.com" &
|
||||||
|
log "Firefox started for user $local_user"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "No captive portal detected"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "=== Completed ==="
|
59
README.md
59
README.md
@ -1,56 +1,31 @@
|
|||||||
NetworkManager Captive Portal Auto-Detector
|
# NetworkManager Captive Portal Auto-Detector
|
||||||
Automatische Erkennung und Handhabung von Captive Portals unter Linux
|
|
||||||
|
**Automatische Erkennung und Handhabung von Captive Portals unter Linux**
|
||||||
|
|
||||||
Dieses Skript automatisiert die Erkennung von Captive Portals (Login-Seiten in WLAN-Netzwerken) und öffnet automatisch einen Browser zur Authentifizierung.
|
Dieses Skript automatisiert die Erkennung von Captive Portals (Login-Seiten in WLAN-Netzwerken) und öffnet automatisch einen Browser zur Authentifizierung.
|
||||||
|
|
||||||
🚀 Funktionsweise
|
## 🚀 Funktionsweise
|
||||||
|
|
||||||
Das Skript wird als NetworkManager Dispatch Script integriert und:
|
Das Skript wird als NetworkManager Dispatch Script integriert und:
|
||||||
|
|
||||||
Überwacht WLAN-Verbindungsereignisse
|
- Überwacht WLAN-Verbindungsereignisse
|
||||||
|
- Führt Connectivity-Checks durch wenn eine Verbindung aufgebaut wird
|
||||||
|
- Erkennt automatisch Captive Portals durch HTTP-Response-Analyse
|
||||||
|
- Öffnet Firefox zur Anmeldung beim Portal
|
||||||
|
- Loggt alle Aktivitäten zur einfachen Fehleranalyse
|
||||||
|
|
||||||
Führt Connectivity-Checks durch when eine Verbindung aufgebaut wird
|
## 📋 Features
|
||||||
|
|
||||||
Erkennt automatisch Captive Portals durch HTTP-Response-Analyse
|
- 🔍 **Zuverlässige Erkennung**: Prüft multiple Connectivity-Endpoints
|
||||||
|
- ⚡ **Automatisch**: Keine manuelle Interaktion nötig
|
||||||
|
- 📝 **Detailliertes Logging**: Umfassende Protokollierung nach `/var/log/nm-captive.log`
|
||||||
|
- 🎯 **WLAN-spezifisch**: Reagiert nur auf WLAN-Verbindungen
|
||||||
|
- 🔧 **Einfache Installation**: Einfache Kopieren und Berechtigungen setzen
|
||||||
|
|
||||||
Öffnet Firefox zur Anmeldung beim Portal
|
## 🛠️ Installation
|
||||||
|
|
||||||
Loggt alle Aktivitäten zur einfachen Fehleranalyse
|
|
||||||
|
|
||||||
📋 Features
|
|
||||||
🔍 Zuverlässige Erkennung: Prüft multiple Connectivity-Endpoints
|
|
||||||
|
|
||||||
⚡ Automatisch: Keine manuelle Interaktion nötig
|
|
||||||
|
|
||||||
📝 Detailliertes Logging: Umfassende Protokollierung nach /var/log/nm-captive.log
|
|
||||||
|
|
||||||
🎯 WLAN-spezifisch: Reagiert nur auf WLAN-Verbindungen
|
|
||||||
|
|
||||||
🔧 Einfache Installation: Einfache Kopieren und Berechtigungen setzen
|
|
||||||
|
|
||||||
🛠️ Installation
|
|
||||||
```bash
|
```bash
|
||||||
sudo cp 99-captive-portal /etc/NetworkManager/dispatcher.d/
|
sudo cp 99-captive-portal /etc/NetworkManager/dispatcher.d/
|
||||||
sudo chmod +x /etc/NetworkManager/dispatcher.d/99-captive-portal
|
sudo chmod +x /etc/NetworkManager/dispatcher.d/99-captive-portal
|
||||||
sudo touch /var/log/nm-captive.log
|
sudo touch /var/log/nm-captive.log
|
||||||
```
|
|
||||||
📊 Logging
|
|
||||||
Das Skript protokolliert alle Aktivitäten in /var/log/nm-captive.log:
|
|
||||||
|
|
||||||
Verbindungsereignisse
|
|
||||||
|
|
||||||
HTTP-Testergebnisse
|
|
||||||
|
|
||||||
Erkennung von Captive Portals
|
|
||||||
|
|
||||||
Browser-Starts
|
|
||||||
|
|
||||||
🤝 Beitragen
|
|
||||||
Contributions sind willkommen! Öffne einfach einen Issue oder Pull Request für:
|
|
||||||
|
|
||||||
Verbesserte Captive Portal Erkennung
|
|
||||||
|
|
||||||
Unterstützung weiterer Browser
|
|
||||||
|
|
||||||
Additional Distribution compatibility
|
|
||||||
|
|
||||||
Perfect für Linux-Nutzer, die regelmäßig mit öffentlichen WLANs mit Login-Portals verbinden!
|
|
||||||
|
Loading…
Reference in New Issue
Block a user