Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@vperron
Created January 23, 2015 16:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vperron/91b18ce818d21a9f8147 to your computer and use it in GitHub Desktop.
Save vperron/91b18ce818d21a9f8147 to your computer and use it in GitHub Desktop.
SFR WiFi
#!/bin/bash
LOGIN="LOGIN@sfr.fr"
PASSWORD="PASSWORD"
MAIN_URL="https://hotspot.wifi.sfr.fr/nb4_crypt.php"
USER_URL="http%3A%2F%2Fwww.fon.com%2Ffr%2Flanding%2Ffoneroneufbox%3Bfon%3B%3B"
JS_POPUP_URL="http://192.168.2.1:3990/logon?username=ssowifi.neuf.fr"
# Check redirection with curl -L
CHALLENGE=`curl -s -L http://www.google.com`
if [ $? != 0 ]
then
echo "Case 1: Please install cURL."
echo "Case 2: Something unexpected happened."
unset CHALLENGE && exit 1
fi
CHALLENGE=`echo $CHALLENGE | \grep challenge= | sed -r 's/.*challenge=([0-9a-z]+).*/\1/'`
if [ -n "${CHALLENGE}" ]
then
echo "Hotspot found. Challenge: $CHALLENGE"
else
echo "Case 1: Please check that the hotspot variable is still named 'challenge'"
echo "Case 2: Not connected."
echo "Case 3: Already authentified"
unset CHALLENGE && exit 1
fi
RESPONSE=`curl -s -d "username=${LOGIN}&password=${PASSWORD}&cond=on&challenge=${CHALLENGE}" ${MAIN_URL}|grep response=|sed -r 's/.*response=([0-9a-z]+).*/\1/'`
RESULT=`curl -i "${JS_POPUP_URL}/${LOGIN}&response=${RESPONSE}&uamip=192.168.2.1&userurl=${USER_URL}" | grep "http://192.168.2.1:3990"`
if [ -n "${RESULT}" ]
then
echo "Connexion successful."
else
echo "Unexpected error"
unset RESULT CHALLENGE RESPONSE && exit 1
fi
unset RESULT CHALLENGE RESPONSE
exit 0
@thibault-ketterer
Copy link

fonctionne parfaitement, merci 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment