mirror of
https://github.com/QSCTech/zjunet.git
synced 2026-01-22 19:54:48 +08:00
add LICENSE
This commit is contained in:
parent
1b2f17d3c5
commit
3a831661a3
18
dns.sh
18
dns.sh
@ -1,10 +1,22 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
##################################
|
# dns.sh -- DNS helper for zjuer
|
||||||
#
|
#
|
||||||
# DNS Helper
|
# Copyright (C) 2014 Zeno Zeng <zenoofzeng@gmail.com>
|
||||||
#
|
#
|
||||||
##################################
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see
|
||||||
|
# <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
zju_test_and_set_up_dns () {
|
zju_test_and_set_up_dns () {
|
||||||
until [ -z "$1" ]
|
until [ -z "$1" ]
|
||||||
|
|||||||
18
user.sh
18
user.sh
@ -1,5 +1,23 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# user.sh -- User Manager
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014 Zeno Zeng <zenoofzeng@gmail.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see
|
||||||
|
# <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# init
|
# init
|
||||||
DIR="$HOME/.zjunet"
|
DIR="$HOME/.zjunet"
|
||||||
mkdir -p $DIR
|
mkdir -p $DIR
|
||||||
|
|||||||
47
wlan.sh
47
wlan.sh
@ -1,3 +1,50 @@
|
|||||||
|
# wlan.sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014 Zhang Hai <Dreaming.in.Code.ZH@Gmail.com>
|
||||||
|
# Copyright (C) 2014 Zeno Zeng <zenoofzeng@gmail.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see
|
||||||
|
# <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
logout() {
|
||||||
|
USERNAME=$1
|
||||||
|
PASSWORD=$2
|
||||||
|
|
||||||
|
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)
|
||||||
|
if [[ "${RESPONSE}" != "ok" ]]; then
|
||||||
|
echo "${RESPONSE}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
login() {
|
||||||
|
USERNAME=$1
|
||||||
|
PASSWORD=$2
|
||||||
|
|
||||||
|
logout $USERNAME $PASSWORD
|
||||||
|
|
||||||
|
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)
|
||||||
|
if [[ "${RESPONSE}" = *"help.html"* || "${response}" = *"login_ok"* ]]; then
|
||||||
|
echo "Login successful"
|
||||||
|
else
|
||||||
|
echo "${RESPONSE}" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
login)
|
login)
|
||||||
;;
|
;;
|
||||||
|
|||||||
18
zjunet.sh
18
zjunet.sh
@ -1,10 +1,22 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
##################################
|
# zjunet.sh -- router for zjunet
|
||||||
#
|
#
|
||||||
# Router
|
# Copyright (C) 2014 Zeno Zeng <zenoofzeng@gmail.com>
|
||||||
#
|
#
|
||||||
##################################
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see
|
||||||
|
# <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
BASEDIR=$(dirname $0)
|
BASEDIR=$(dirname $0)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user