aurora0272e00
add campus-login script for captive portal detection of open wifi networks
+15 −0
1 file changed
- A .local/bin/campus-login +15 −0
| @@ -0,0 +1,15 @@ | |||
| 1 | + | #!/bin/bash | |
| 2 | + | ||
| 3 | + | URL=$(curl -s -D - -o /dev/null http://neverssl.com 2>/dev/null \ | |
| 4 | + | | grep -i '^location:' \ | |
| 5 | + | | head -n1 \ | |
| 6 | + | | sed 's/^[Ll]ocation:[[:space:]]*//' \ | |
| 7 | + | | tr -d '\r') | |
| 8 | + | ||
| 9 | + | if [[ -z "$URL" ]]; then | |
| 10 | + | echo "Already authenticated or no captive portal detected." | |
| 11 | + | exit 0 | |
| 12 | + | fi | |
| 13 | + | ||
| 14 | + | echo "Opening captive portal: $URL" | |
| 15 | + | "$BROWSER" "$URL" | |