commit 402671e69a55c1e591e93f3681aa3a8d02156774 Author: sacha Date: Mon Apr 1 17:53:34 2024 +0200 Add wifi-sncf-tgv.sh diff --git a/wifi-sncf-tgv.sh b/wifi-sncf-tgv.sh new file mode 100644 index 0000000..f275158 --- /dev/null +++ b/wifi-sncf-tgv.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +### Wifi @ SNCF TGV INOUI +### Sacha 20240401 +### Validate captive portal access + +wifiinterface="wlp170s0" +tmpfile=/tmp/wifi-tgv.tmp + +# Get DHCP answears +nmap --script broadcast-dhcp-discover -e $wifiinterface > $tmpfile +DNS=$(grep "Domain Name Server" $tmpfile | awk -F: '{gsub (" ", "", $0); print $2}') + +# Enabling the wifi +echo "Enabling SNCF's Wifi" +curl --silent --output /dev/null -X POST 'https://wifi.sncf/router/api/connection/activate/auto' --resolve wifi.sncf:443:$DNS + +# Optional: Check if we have Internet with perdu.com +echo -n "Checking Internet Access... " +curl --silent perdu.com |grep ici && echo "OK !!!" || echo "KO :(((" \ No newline at end of file