Update wifi-sncf-tgv.sh
check nmap presence
This commit is contained in:
parent
2a99c6a50f
commit
4fcb86be37
1 changed files with 5 additions and 1 deletions
|
@ -4,9 +4,13 @@
|
||||||
### Sacha at aquilenet.fr 20240401
|
### Sacha at aquilenet.fr 20240401
|
||||||
### Validate captive portal access
|
### Validate captive portal access
|
||||||
|
|
||||||
|
# Put your wifi interface name here
|
||||||
wifiinterface="wlp170s0"
|
wifiinterface="wlp170s0"
|
||||||
tmpfile=/tmp/wifi-tgv.tmp
|
tmpfile=/tmp/wifi-tgv.tmp
|
||||||
|
|
||||||
|
# Check if we have nmap
|
||||||
|
which nmap || echo "Please install nmap" && exit 1
|
||||||
|
|
||||||
# Get DHCP answears
|
# Get DHCP answears
|
||||||
nmap --script broadcast-dhcp-discover -e $wifiinterface > $tmpfile
|
nmap --script broadcast-dhcp-discover -e $wifiinterface > $tmpfile
|
||||||
DNS=$(grep "Domain Name Server" $tmpfile | awk -F: '{gsub (" ", "", $0); print $2}')
|
DNS=$(grep "Domain Name Server" $tmpfile | awk -F: '{gsub (" ", "", $0); print $2}')
|
||||||
|
@ -15,6 +19,6 @@ DNS=$(grep "Domain Name Server" $tmpfile | awk -F: '{gsub (" ", "", $0); print $
|
||||||
echo "Enabling SNCF's 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
|
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
|
# Optional: Check if we have Internet (& DNS resolution) with perdu.com
|
||||||
echo -n "Checking Internet Access... "
|
echo -n "Checking Internet Access... "
|
||||||
curl --silent perdu.com |grep ici && echo "Internet is OK !!!" || echo "Internet is KO :((("
|
curl --silent perdu.com |grep ici && echo "Internet is OK !!!" || echo "Internet is KO :((("
|
Loading…
Reference in a new issue