Skip to content

Instantly share code, notes, and snippets.

@Hexcles
Created May 19, 2014 02:38
Show Gist options
  • Save Hexcles/9c11622ada53beec77ef to your computer and use it in GitHub Desktop.
Save Hexcles/9c11622ada53beec77ef to your computer and use it in GitHub Desktop.
ZJUWLAN login script (curl, force HTTPS)
#!/bin/bash
# Abort when curl fails
set -e
USERNAME=
PASSWORD=
echo -n "Force logging off: "
curl 'https://net.zju.edu.cn/rad_online.php' -H 'Origin: https://net.zju.edu.cn' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: */*' -H 'Referer: https://net.zju.edu.cn/srun_port1.php?url=http://www.example.com/' --data "action=auto_dm&username=${USERNAME}&password=${PASSWORD}" >/dev/null 2>&1
echo "success!"
echo -n "Log in: "
curl 'https://net.zju.edu.cn/cgi-bin/srun_portal' -H 'Origin: https://net.zju.edu.cn' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: */*' -H 'Referer: https://net.zju.edu.cn/srun_port1.php?url=http://www.example.com/' --data "action=login&username=${USERNAME}&password=${PASSWORD}&ac_id=3&type=1&wbaredirect=http://www.example.com/&mac=undefined&user_ip=&is_ldap=1&local_auth=1" >/dev/null 2>&1
echo "success!"
echo "You're online now."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment