diff --git a/README.md b/README.md index 7d0518a..cbe8f05 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,6 @@ Command Line Scripts for ZJU (VPN / WLAN / DNS) - xl2tpd -- curl - - `dig` (Different package on different platform) ## Installation @@ -80,7 +78,7 @@ Please complete installation before connecting to the intranet. ### Other Linux (Build from source code) ```bash -xl2tpd -v; curl -V; dig -v # Check installation of dependencies. There should be 3 version numbers. +xl2tpd -v; dig -v # Check installation of dependencies. There should be 3 version numbers. # Under proper directory git clone https://github.com/QSCTech/zjunet.git cd zjunet @@ -90,7 +88,7 @@ sudo ./install.sh ``` **ATTENTION** Requirement check will **NOT** be done running `./install.sh`. -Please run `xl2tpd -v`, `curl -V` and `dig -v` to verify the installation. +Please run `xl2tpd -v` and `dig -v` to verify the installation. ## Troubleshooting diff --git a/README.zh.md b/README.zh.md index 5aa921d..337c397 100644 --- a/README.zh.md +++ b/README.zh.md @@ -20,8 +20,6 @@ - xl2tpd -- curl - - `dig` (在不同平台的包不同) ## 安装 @@ -83,7 +81,7 @@ sudo yum install zjunet ### 其他 Linux (源代码安装) ```bash -xl2tpd -v; curl -V; dig -v # 检查依赖命令的安装情况。这句命令将输出三个版本号。 +xl2tpd -v; dig -v # 检查依赖命令的安装情况。这句命令将输出三个版本号。 # 在合适的目录下 git clone https://github.com/QSCTech/zjunet.git cd zjunet @@ -93,7 +91,7 @@ sudo ./install.sh ``` **注意** 运行 `./install.sh` 时 **不会** 确认必要依赖是否已经安装。 -您应当先运行 `xl2tpd -v` 、 `curl -V` 和 `dig -v` 确认安装。 +您应当先运行 `xl2tpd -v` 、 `dig -v` 确认安装。 ## 疑难解答 diff --git a/build/build-pkgbuild.sh b/build/build-pkgbuild.sh index d250f65..f8da263 100755 --- a/build/build-pkgbuild.sh +++ b/build/build-pkgbuild.sh @@ -26,7 +26,7 @@ pkgdesc="Command Line Scripts for ZJU" url="https://github.com/QSCTech/$PKGNAME" arch=('any') license=('GPL') -depends=('xl2tpd>=1.3.7' 'curl' 'dnsutils') +depends=('xl2tpd>=1.3.7' 'dnsutils') source=("$PKGNAME-$PKGVER.tar.gz::https://github.com/QSCTech/$PKGNAME/archive/v$PKGVER.tar.gz") md5sums=('$FILE_MD5') sha1sums=('$FILE_SHA1') diff --git a/build/debian/build.sh b/build/debian/build.sh index 9ab271c..ef471fc 100755 --- a/build/debian/build.sh +++ b/build/debian/build.sh @@ -36,7 +36,7 @@ Version: $VERSION Section: net Priority: optional Architecture: all -Depends: xl2tpd (>= 1.3.7), curl, dnsutils +Depends: xl2tpd (>= 1.3.7), dnsutils Maintainer: Azuk 443 Description: Command Line Scripts for ZJU Campus Network This script provides a VPN / WLAN / NEXTHOP for ZJUer. diff --git a/build/openwrt/build.sh b/build/openwrt/build.sh index 96e23a7..4667f1b 100755 --- a/build/openwrt/build.sh +++ b/build/openwrt/build.sh @@ -26,7 +26,7 @@ Version: $VERSION Section: net Priority: optional Architecture: all -Depends: xl2tpd (>= 1.3.7), curl, bind-dig +Depends: xl2tpd (>= 1.3.7), bind-dig Maintainer: Azuk 443 Description: Command Line Scripts for ZJU Campus Network This script provides a VPN / WLAN / NEXTHOP for ZJUer. diff --git a/build/rpm/build_spec.sh b/build/rpm/build_spec.sh index 6c1ee9b..748908c 100755 --- a/build/rpm/build_spec.sh +++ b/build/rpm/build_spec.sh @@ -13,7 +13,7 @@ echo "Group: Applications/Internet" >> zjunet.spec echo "URL: https://github.com/QSCTech/zjunet/" >> zjunet.spec echo "Vendor: Qiu Shi Chao Website of Zhejiang University" >> zjunet.spec echo "Packager: Azuk 443 " >> zjunet.spec -echo "Requires: xl2tpd >= 1.3.7, curl, bind-utils" >> zjunet.spec +echo "Requires: xl2tpd >= 1.3.7, bind-utils" >> zjunet.spec echo "BuildRoot: %{_builddir}/%{name}-root" >> zjunet.spec echo "Source: %{name}-%{version}.tar.gz" >> zjunet.spec echo "BuildArch: noarch" >> zjunet.spec diff --git a/lib/route.sh b/lib/route.sh index 80ad231..f2e9780 100755 --- a/lib/route.sh +++ b/lib/route.sh @@ -103,20 +103,6 @@ for dev in $devs; do cmd="${cmd} nexthop dev ${dev}" done -case "$gateway" in - 10.189.*) - # WLAN - zjuwlan_test_ip=10.202.68.46 - ip route replace $zjuwlan_test_ip via ${gateway} - zjuwlan_status=`curl -s $zjuwlan_test_ip | grep net.zju.edu.cn | wc -l` - if [ $zjuwlan_status -eq 0 ] - then - cmd="${cmd} nexthop via ${gateway}" - fi - ip route del $zjuwlan_test_ip || true - ;; -esac - $cmd ip route diff --git a/lib/wlan.sh b/lib/wlan.sh index 5126e39..cbbe6ac 100755 --- a/lib/wlan.sh +++ b/lib/wlan.sh @@ -2,11 +2,10 @@ # wlan.sh -- login/logout for ZJUWLAN # -# Requirements: curl -# # Copyright (C) 2014 Zhang Hai # Copyright (C) 2014 Zeno Zeng # Copyright (C) 2017 Wu Fan +# Copyright (C) 2023 Azuk 443 # # 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 @@ -22,114 +21,5 @@ # along with this program. If not, see # . -BASEDIR=$(dirname $0) - -DISABLE_CHECK=${BASEDIR}/.disable-wlan - -USER="${BASEDIR}/user.sh" - -USERNAME=$($USER get) -PASSWORD=$($USER getpwd $USERNAME) - -if [ -f "${DISABLE_CHECK}" ]; then - echo WLAN function has been disabled.; - exit 1; -fi - -logout() { - USERNAME=$1 - PASSWORD=$2 - - echo "Logout: ${USERNAME}" - RESPONSE=$(curl "https://net.zju.edu.cn/include/auth_action.php" -H "Content-Type: application/x-www-form-urlencoded" -d "action=logout&username=${USERNAME}&password=${PASSWORD}&ajax=1" -s) - - if [ $? -eq 60 ]; then - CHOOSE='' - read -p "There's an issue with ZJUNET's CA certificates, do you want to do it anyway? [yes/NO] " CHOOSE - if [ $CHOOSE = "YES" ] || [ $CHOOSE = "yes" ]; then - RESPONSE=$(curl "https://net.zju.edu.cn/include/auth_action.php" -H "Content-Type: application/x-www-form-urlencoded" -d "action=logout&username=${USERNAME}&password=${PASSWORD}&ajax=1" -s -k) - fi - fi - - case "${RESPONSE}" in - *ok*) - echo "Logout: success." - ;; - *已断开*) - echo "Logout: success." - ;; - *) - echo "Logout: unsuccess." - echo "${RESPONSE}" - exit 1; - ;; - esac -} - -login() { - USERNAME=$1 - PASSWORD=$2 - - STATUS=$(curl http://g.cn/generate_204 -I -s | grep HTTP | awk {'print $2'}) - if [ $STATUS -eq 204 ]; then - echo "You have already logged in." - exit 0 - fi - - echo "Login: ${USERNAME}" - RESPONSE=$(curl "https://net.zju.edu.cn/include/auth_action.php" -H "Content-Type: application/x-www-form-urlencoded" -d "action=login&username=${USERNAME}&password=${PASSWORD}&ac_id=3&user_ip=&nas_ip=&user_mac=&save_me=1&ajax=1" -s) - - if [ $? -eq 60 ]; then - CHOOSE='' - read -p "There's an issue with ZJUNET's CA certificates, do you want to do it anyway? [yes/NO] " CHOOSE - if [ $CHOOSE = "YES" ] || [ $CHOOSE = "yes" ]; then - RESPONSE=$(curl "https://net.zju.edu.cn/include/auth_action.php" -H "Content-Type: application/x-www-form-urlencoded" -d "action=login&username=${USERNAME}&password=${PASSWORD}&ac_id=3&user_ip=&nas_ip=&user_mac=&save_me=1&ajax=1" -s -k) - fi - fi - - case "${RESPONSE}" in - *help.html*) - echo "Login: success." - ;; - *login_ok*) - echo "Login: success." - ;; - *E2532*) - echo "Login: failed. Please retry after 10s." >&2 - echo "Login: ${RESPONSE}" >&2 - exit 1 - ;; - *) - echo "Login: failed." >&2 - if [ -z "${RESPONSE}" ]; then - echo "Login: (Empty response)" >&2 - else - echo "Login: ${RESPONSE}" >&2 - fi - exit 1 - ;; - esac -} - - -case "$1" in - d|-d|disconnect) - logout $USERNAME $PASSWORD - ;; - - ""|c|-c|connect) - login $USERNAME $PASSWORD - ;; - - disable) - "${BASEDIR}/sudo.sh" touch "${DISABLE_CHECK}" - exit 0 - ;; - - *) - echo Invalid subcommand \"$1\" for \`zjunet wlan\`. Run \`zjunet usage\` for help. - ;; -esac - -"${BASEDIR}/sudo.sh" "${BASEDIR}/route.sh" - +echo "zjunet WLAN function is deprecated." +exit 1 diff --git a/lib/zjunet.sh b/lib/zjunet.sh index 7d4d4c7..b045c9d 100755 --- a/lib/zjunet.sh +++ b/lib/zjunet.sh @@ -3,6 +3,7 @@ # zjunet.sh -- router for zjunet # # Copyright (C) 2014 Zeno Zeng +# Copyright (C) 2023 Azuk 443 # # 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 @@ -64,10 +65,6 @@ Actions: vpn, v connect, -c Connect VPN and set up ip route disconnect, -d Disconnect VPN and reset ip route - wlan, w - connect, -c Login ZJUWLAN using curl - disconnect, -d Logout ZJUWLAN using curl - disable Disable WLAN capability route, r Set up static route dns [ip], d [ip] Test and set up DNS Server (default: 10.10.0.21) version, -v Display program version @@ -76,7 +73,6 @@ Example: zjunet user add Add a new user zjunet vpn -c Connect VPN zjunet vpn -d Disconnect VPN - zjunet wlan disable Completely disable WLAN capatibility EOF ;; esac