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

65 lines
1.7 KiB
Bash
Raw Normal View History

2014-09-18 22:45:38 +08:00
#!/bin/sh
2014-09-20 15:39:28 +08:00
# zjunet.sh -- router for zjunet
2014-09-18 22:45:38 +08:00
#
2014-09-20 15:39:28 +08:00
# Copyright (C) 2014 Zeno Zeng <zenoofzeng@gmail.com>
2014-09-18 22:45:38 +08:00
#
2014-09-20 15:39:28 +08:00
# 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/>.
2014-09-18 22:45:38 +08:00
BASEDIR=$(dirname $0)
case "$1" in
2014-09-19 23:06:14 +08:00
user)
2014-09-20 17:19:56 +08:00
"${BASEDIR}/user.sh" $2
2014-09-18 22:45:38 +08:00
;;
wlan)
2014-09-20 18:13:40 +08:00
"${BASEDIR}/wlan.sh" $2
2014-09-18 22:45:38 +08:00
;;
vpn)
2014-09-26 15:16:05 +08:00
if [ $EUID -eq "0" ]; then
"${BASEDIR}/vpn.sh" $2
else
sudo "${BASEDIR}/vpn.sh" $2
fi
2014-09-18 22:45:38 +08:00
;;
dns)
2014-09-20 17:19:56 +08:00
"${BASEDIR}/dns.sh"
2014-09-18 22:45:38 +08:00
;;
2014-09-20 20:20:11 +08:00
*)
cat <<EOF
zjunet: CLI Tool (VPN/WLAN/DNS) for Zjuer
Usage: zjunet [ACTION]
Actions:
2014-09-26 14:14:53 +08:00
user
2014-09-26 15:16:05 +08:00
add Add a user
edit Edit a (enabled) user
delete Delete a (enabled) user
2014-09-26 14:14:53 +08:00
list List all enabled users
enable Enable a user
disable Disable a user
vpn
connect(-c) Connect VPN and set up ip route
disconnect(-d) Disconnect VPN and reset ip route
route Set up ip route
wlan
login Login ZJUWLAN via curl
logout Logout ZJUWLAN via curl
dns Test and set up DNS Server
2014-09-20 20:20:11 +08:00
EOF
;;
2014-09-18 22:45:38 +08:00
esac