1
0
mirror of https://github.com/QSCTech/zjunet.git synced 2026-01-22 11:44:48 +08:00

add LICENSE

This commit is contained in:
Zeno Zeng 2014-09-20 15:39:28 +08:00
parent 1b2f17d3c5
commit 3a831661a3
4 changed files with 95 additions and 6 deletions

18
dns.sh
View File

@ -1,10 +1,22 @@
#!/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 () {
until [ -z "$1" ]

18
user.sh
View File

@ -1,5 +1,23 @@
#!/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
DIR="$HOME/.zjunet"
mkdir -p $DIR

47
wlan.sh
View File

@ -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
login)
;;

View File

@ -1,10 +1,22 @@
#!/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)