Skip to content

Instantly share code, notes, and snippets.

@coldfix
Created June 25, 2019 11:15
Show Gist options
  • Save coldfix/7d61af2806fe8b33fa07724e55177197 to your computer and use it in GitHub Desktop.
Save coldfix/7d61af2806fe8b33fa07724e55177197 to your computer and use it in GitHub Desktop.
#!/bin/ash
#ash shell for openwrt, it also works with bash
#curl -s 192.168.44.1/logout
rURL=`curl -s -I "http://192.168.44.1" | grep "Location:" | cut -d : -f 2- | cut -c 2-`
if echo $rURL | grep -q "res=notyet"; then
echo "notyet"
challenge=`echo $rURL | cut -d '&' -f 4 | cut -d= -f2`
echo "challenge=$challenge"
fURL=`curl -s -X POST -L "https://hotsplots.de/auth/login.php" --data "challenge="$challenge"&uamip=192.168.44.1&uamport=80&myLogin=agb&ll=de&nasid=HotelGadheim-BBW&userurl=http://192.168.44.1/"`
gURL=`echo $fURL | cut -d'<' -f 23- | cut -d';' -f 2- | cut -c 5- | cut -d'"' -f 0`
response=`echo $gURL | cut -d';' -f 2 | cut -d'=' -f 2 | cut -f 1 -d'&'`
target=`curl -s -I "http://192.168.44.1:80/logon?username=agb_accepted&response="$response"&userurl=ll://dehttp://192.168.44.1/" | grep "Location:" | cut -d : -f 2- | cut -c 2-`
if echo $target | grep -q "res=success"; then
exit 0
fi
exit 1
else
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment