mirror of
https://github.com/QSCTech/zjunet.git
synced 2026-01-23 04:04:48 +08:00
add iconv for response in wlan.sh
This commit is contained in:
parent
4b38353f33
commit
4c88efb19f
10
README.md
10
README.md
@ -2,11 +2,13 @@
|
|||||||
|
|
||||||
Command Line Scripts for ZJU (VPN / WLAN / DNS)
|
Command Line Scripts for ZJU (VPN / WLAN / DNS)
|
||||||
|
|
||||||
## Require
|
## Requirements
|
||||||
|
|
||||||
```bash
|
### wlan
|
||||||
sudo apt-get install curl
|
|
||||||
```
|
- curl
|
||||||
|
|
||||||
|
- xl2tpd
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
|
|||||||
8
wlan.sh
8
wlan.sh
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
# wlan.sh -- login/logout for ZJUWLAN
|
# wlan.sh -- login/logout for ZJUWLAN
|
||||||
#
|
#
|
||||||
|
# Requirements: curl, iconv
|
||||||
|
#
|
||||||
# Copyright (C) 2014 Zhang Hai <Dreaming.in.Code.ZH@Gmail.com>
|
# Copyright (C) 2014 Zhang Hai <Dreaming.in.Code.ZH@Gmail.com>
|
||||||
# Copyright (C) 2014 Zeno Zeng <zenoofzeng@gmail.com>
|
# Copyright (C) 2014 Zeno Zeng <zenoofzeng@gmail.com>
|
||||||
#
|
#
|
||||||
@ -24,14 +26,14 @@ logout() {
|
|||||||
PASSWORD=$2
|
PASSWORD=$2
|
||||||
|
|
||||||
echo "Logout: ${USERNAME}"
|
echo "Logout: ${USERNAME}"
|
||||||
RESPONSE=$(curl "https://net.zju.edu.cn/rad_online.php" -H "Content-Type: application/x-www-form-urlencoded" -d "action=auto_dm&username=${USERNAME}&password=${PASSWORD}" -s)
|
RESPONSE=$(curl "https://net.zju.edu.cn/rad_online.php" -H "Content-Type: application/x-www-form-urlencoded" -d "action=auto_dm&username=${USERNAME}&password=${PASSWORD}" -s | iconv -c -f gbk -t utf8)
|
||||||
|
|
||||||
case "${RESPONSE}" in
|
case "${RESPONSE}" in
|
||||||
*ok*)
|
*ok*)
|
||||||
echo "Logout: success."
|
echo "Logout: success."
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Logout: ${RESPONSE}."
|
echo "Logout: ${RESPONSE}"
|
||||||
exit 1;
|
exit 1;
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -44,7 +46,7 @@ login() {
|
|||||||
logout $USERNAME $PASSWORD
|
logout $USERNAME $PASSWORD
|
||||||
|
|
||||||
echo "Login: ${USERNAME}"
|
echo "Login: ${USERNAME}"
|
||||||
RESPONSE=$(curl "https://net.zju.edu.cn/cgi-bin/srun_portal" -H "Content-Type: application/x-www-form-urlencoded" -d "action=login&username=${USERNAME}&password=${PASSWORD}&ac_id=3&type=1&is_ldap=1&local_auth=1" -s)
|
RESPONSE=$(curl "https://net.zju.edu.cn/cgi-bin/srun_portal" -H "Content-Type: application/x-www-form-urlencoded" -d "action=login&username=${USERNAME}&password=${PASSWORD}&ac_id=3&type=1&is_ldap=1&local_auth=1" -s | iconv -c -f gbk -t utf8)
|
||||||
|
|
||||||
case "${RESPONSE}" in
|
case "${RESPONSE}" in
|
||||||
*help.html*)
|
*help.html*)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user