Krolyxon
Commit 0272e00

Branches

Refs →

aurora0272e00

add campus-login script for captive portal detection of open wifi networks

Author
krolyxon
Date
2026-10-08 21:20 +0530
Parent
21071d5
Commit
0272e00bfda0d585eb13425a6205e78e10893849

+15 −0

1 file changed

  1. A .local/bin/campus-login +15 −0
A .local/bin/campus-login View
@@ -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"