Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Auto-connect to SFR WiFi
- # To use in combination with wicd
- # by vincesafe (Twitter: @vincesafe / blog: vincesafe.fr)
- # VARS
- # location: URL associated with 302 reply (contains challenge)
- # challenge: part of POST data to be sent
- # target: target URL for POST
- # nasid: hotspot's MAC address (part of location)
- # mac: client's MAC address (part of location)
- # uamport: same here
- # uamip: same here
- # mode, channel: ...
- # uname: username
- # pass: password
- uname=#SFR ADDRESS OR TELEPHONE NUMBER
- pass=#ACCOUNT PASSWORD
- target=https://hotspot.wifi.sfr.fr/nb4_crypt.php
- # Step 0: wait for the connection to establish
- sleep 2
- # Step 1: get the location with wget
- wget -O /dev/null -o loc http://perdu.com
- echo `grep Location loc` > loc
- location=`awk 'BEGIN { FS=" " } { print $2 }' loc`
- # Step 2: extract challenge, MAC addresses, ... from location
- challenge=`awk 'BEGIN { FS="&" } { print $4 }' loc | awk 'BEGIN { FS="=" } { print $2 }'`
- nasid=`awk 'BEGIN { FS="&" } { print $6 }' loc | awk 'BEGIN { FS="=" } { print $2 }'`
- mac=`awk 'BEGIN { FS="&" } { print $7 }' loc | awk 'BEGIN { FS="=" } { print $2 }'`
- uamport=`awk 'BEGIN { FS="&" } { print $3 }' loc | awk 'BEGIN { FS="=" } { print $2 }'`
- uamip=`awk 'BEGIN { FS="&" } { print $2 }' loc | awk 'BEGIN { FS="=" } { print $2 }'`
- mode=`awk 'BEGIN { FS="&" } { print $8 }' loc | awk 'BEGIN { FS="=" } { print $2 }'`
- channel=`awk 'BEGIN { FS="&" } { print $9 }' loc | awk 'BEGIN { FS="=" } { print $2 }' | awk 'BEGIN { FS=" " } { print $1 }'`
- # Step 3: prepare POST with target URL (set in the code)
- postdata="choix=neuf&username=$uname&password=$pass&conditions=on&challenge=$challenge&username2=$uname&accessType=neuf&lang=fr&mode=$mode&userurl=http://perdu.com&uamip=$uamip&uamport=$uamport&channel=$channel&mac=$nasid|mac&connexion=Connexion"
- # Step 4: send POST request
- wget -O debug $target --post-data="$postdata"
- # Step 5: get a page on local AP
- newloc=`grep location debug | awk 'BEGIN { FS="\"" } { print $2 }'`
- wget $newloc -O newloc
- # DEBUG
- echo START DEBUG
- echo challenge $challenge
- echo nasid $nasid
- echo mac $mac
- echo uamport $uamport
- echo uamip $uamip
- echo mode $mode
- echo channel $channel
- echo location $location
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement