├── PandoraBox-ralink-mt7620-mt7620a-evb-2018-12-14-git-1b9b0f382-squashfs-sysupgrade.bin ├── README.md ├── WeNet-router.tar.gz ├── WeNet_1.3.6.apk ├── box-test.java ├── etc ├── dialtool ├── dialtool-test ├── init.d │ ├── dropbear-delete │ └── telnet-delete ├── re └── shadow-delete ├── root ├── nk4 ├── nk4.sh ├── nk4conf.sh ├── rp-pppoe-common_3.11-1_mipsel_24kec_dsp.ipk └── rp-pppoe-server_3.11-1_mipsel_24kec_dsp.ipk ├── usr └── lib │ └── lua │ └── luci │ ├── controller │ └── admin │ │ ├── new_tab.lua │ │ └── system.lua │ └── view │ ├── admin_myapp │ └── view_tab.htm │ └── admin_system │ └── flashops.htm ├── v3.20_内科学网络大全_320.apk └── www ├── cgi-bin ├── fzoff ├── fzon ├── pc └── reon └── xlxy /PandoraBox-ralink-mt7620-mt7620a-evb-2018-12-14-git-1b9b0f382-squashfs-sysupgrade.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F-Light/WeNet-router/f7fa0eeac0b83fa6f2fa47a593563085e2f8a8ef/PandoraBox-ralink-mt7620-mt7620a-evb-2018-12-14-git-1b9b0f382-squashfs-sysupgrade.bin -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WeNet-router 2 | ## 项目更改,毕业啦公开啦。 3 | #### 本项目是对wenet及其类似软件或采用portal协议的网络认证,使用路由器一号共享网络。 4 | 锐捷全版本适用请移步[F-Light-intercept-singlenetpppoe](https://github.com/F-Light/intercept-singlenetpppoe) 5 | ---------------------------------------------------------------- 6 | *实现功能: 7 | ①电脑端和手机端登入切换,两种共享方式,电脑端原理参考 8 | [issue #138](https://github.com/miao1007/Openwrt-NetKeeper/issues/138), 9 | 同时也copy了[huipengly/Openwrt-NetKeeper](https://github.com/huipengly/Openwrt-NetKeeper/tree/master/netkeeper4-use-pppoer-server) 代码. 10 | ②手机端wenet登入后,路由器共享网络。 11 | - ------------------------------------------------------------------------------- 12 | 13 | 该脚本目前仅在 mtk 7260,PandoraBox固件测试通过,其余平台请自行研究,测试平台①newifi mini,5G wifi关闭。测试平台②斐讯k2,测试平台③某云工模mtk7260 14 | - 打开5g wifi需要修改/etc/dialtool, 15 | uci set wireless.@wifi-iface[x],x与wifi数量相关。 16 | - 其他平台(固件:openwrt,lede)需要修改/etc/dialtool, 17 | iwinfo **ra1** assoclist | head -n 1 | awk '{print $1}',主要是无线网卡的名称问题,请自行修改 18 | 19 | - **辽宁地区测试可用**,外地只要是用wenet,或是类似portal认证的,**理论可用**。 20 | - 原理为:用户手机went向portal服务器发送MAC地址及其时间戳认证密匙,并通过认证。 21 | - 此时该MAC地址被服务器绑定pass标签,使用此MAC地址的设备并保持数据连接可获得pass。 22 | - ~~暂时不提供使用教程~~。 23 | - **业余爱好,能力有限**,自用为主。需要者,需了解openwrt的一些操作,修改/etc/dialtool 文件。 24 | - 本人还用E4A 做了配套的app,方便快速拨号。(未修改,验证码绝对出错,如果需求的人多,我可以重新编译或者放出e4a源文件) 25 | - 偷懒者,请在一个干净的**PandoraBox固件恢复上传 WeNet-router.tar.gz**。 26 | - ------------------------------------------------------------------------------- 27 | **文件说明:** 28 | /etc/dialtool 主要脚本 29 | ~~/etc/int.d/ 本人用于校园网路由器禁用ssh和telnet,超低级限制 !!请自行删除!!~~ 30 | ~~/etc/shadow openwrt账户密码文件---- !!请自行删除!!~~ 31 | /root/ 一些小小的安装包 32 | /www/cgi-bin 用于网页页面以及app的一些辅助脚本 33 | 34 | -------------------------------------------------------------------------------- /WeNet-router.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F-Light/WeNet-router/f7fa0eeac0b83fa6f2fa47a593563085e2f8a8ef/WeNet-router.tar.gz -------------------------------------------------------------------------------- /WeNet_1.3.6.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F-Light/WeNet-router/f7fa0eeac0b83fa6f2fa47a593563085e2f8a8ef/WeNet_1.3.6.apk -------------------------------------------------------------------------------- /box-test.java: -------------------------------------------------------------------------------- 1 | package cn.dyhack.test; 2 | 3 | import java.security.MessageDigest; 4 | import java.security.NoSuchAlgorithmException; 5 | 6 | 7 | 8 | public class Md5Sum 9 | { 10 | public void algorithm(MessageDigest md5) 11 | { 12 | String account= "311937a7713465d1\n"; 13 | String sum="tyxy#"+account; 14 | byte [] buf = sum.getBytes(); 15 | md5.update(buf); 16 | byte [] tmp = md5.digest(); 17 | StringBuilder sb = new StringBuilder(); 18 | for (byte b:tmp) { 19 | sb.append(Integer.toHexString(b&0xff)); 20 | 21 | } 22 | String a=(String) sb.toString().subSequence(7, 13); 23 | System.out.println(""+account.replace("\n", "")); 24 | System.out.println(""+a); 25 | } 26 | 27 | public static void main(String[] args) throws NoSuchAlgorithmException { 28 | new Md5Sum().algorithm(MessageDigest.getInstance("MD5")); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /etc/dialtool: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #该脚本是主要脚本,弄明白这个脚本,就明白原理了。 3 | sleep 1 4 | lock="/www/origin.lock" 5 | if [ -f "$lock" ]; then 6 | echo "非初始环境.不需要备份" 7 | else 8 | echo "初始环境.开始备份" 9 | 10 | cp /etc/config/wireless /etc/config/wireless.origin 11 | cp /etc/config/firewall /etc/config/firewall.origin 12 | cp /etc/config/network /etc/config/network.origin 13 | echo origin > /www/origin.lock 14 | wan_mac_old=$(ifconfig $(ubus call network.interface.wan status | grep device | awk -F '\"' '{print $4}' | tail -n 1) | grep HWaddr | awk '{print $5}') 15 | echo $wan_mac_old 16 | echo $wan_mac_old > /www/mac_save_old 17 | echo "完成备份" 18 | fi 19 | sleep 1 20 | ##########电脑版切换手机 21 | pc="/etc/init.d/nk4" 22 | if [ -f "$pc" ]; then 23 | echo "当前环境为电脑版。开始清除,并还原" 24 | rm /etc/init.d/nk4 25 | ps |grep "nk4.sh"|grep -v "grep"|awk '{print $1}'|xargs kill -9 #杀掉进程 26 | #cp /etc/config/wireless.origin /etc/config/wireless 27 | cp /etc/config/firewall.origin /etc/config/firewall 28 | cp /etc/config/network.origin /etc/config/network 29 | cp /etc/ppp/plugins/rp-pppoe.so.bak /etc/ppp/plugins/rp-pppoe.so 30 | cp /lib/netifd/proto/ppp.sh_bak /lib/netifd/proto/ppp.sh 31 | uci commit 32 | 33 | else 34 | echo "当前为手机版,继续执行拨号" 35 | fi 36 | sleep 1 37 | 38 | 39 | ########### 40 | pid="/tmp/dialtool.pid" 41 | if [ -f "$pid" ]; then 42 | echo "dialtool is running, exit!" 43 | exit 0 44 | fi 45 | echo runnig > /tmp/dialtool.pid 46 | flag="/www/mac_save_old" 47 | if [ -f "$flag" ]; then 48 | echo "second." 49 | else 50 | echo "first." 51 | uci set dhcp.@dhcp[0].force="1" #强制dhcp,xl会链接不到 52 | wan_mac_old=$(ifconfig $(ubus call network.interface.wan status | grep device | awk -F '\"' '{print $4}' | tail -n 1) | grep HWaddr | awk '{print $5}') 53 | echo $wan_mac_old 54 | echo $wan_mac_old > /www/mac_save_old 55 | fi 56 | 57 | mark=$1 58 | if [ $mark -eq 1 ]; then 59 | echo "dialtool start." 60 | ##### 设置初始mac 解决安卓手机不认账的情况 61 | mac_now=$(ifconfig $(ubus call network.interface.wan status | grep device | awk -F '\"' '{print $4}' | tail -n 1) | grep HWaddr | awk '{print $5}') 62 | mac_old=$(cat /www/mac_save_old | awk '{print $1}') 63 | if [ "$mac_now" != "$mac_old" ];then 64 | echo "$mac_old" 65 | uci set network.wan.macaddr="$mac_old" 66 | uci set network.@device[1].macaddr="$mac_old" 67 | else 68 | echo "$mac_now" 69 | fi 70 | faaa=$(grep wifi-iface /etc/config/wireless | wc -l) #####防止在执行中崩溃,wifi配置出现严重崩溃 71 | if [ "$faaa" -ge 1 ]; then 72 | echo "非首次运行" 73 | cp /etc/config/wireless.back /etc/config/wireless 74 | 75 | else 76 | echo "首次运行,不用重置." 77 | fi 78 | uci commit 79 | sleep 1 80 | 81 | # wan_mac_origin=$(cat /www/mac_save_old | awk '{print $1}') 82 | # echo "$wan_mac_origin" 83 | # uci set network.wan.macaddr="$wan_mac_origin" 84 | # uci set network.@device[1].macaddr="$wan_mac_origin" 85 | 86 | # uci commit 87 | # /etc/init.d/odhcpd restart 1>/dev/null 2>&1 88 | # /etc/init.d/network restart 1>/dev/null 2>&1 89 | # /etc/init.d/firewall restart 1>/dev/null 2>&1 90 | # sleep 3 91 | 92 | #### 93 | 94 | ####mac绑定wifi 95 | 96 | cp /etc/config/wireless /etc/config/wireless.back 97 | wifi_name_old=$(uci get wireless.@wifi-iface[0].ssid) 98 | echo $wifi_name_old > /www/wifi_name_old 99 | 100 | 101 | uci add wireless wifi-iface 102 | wifi_encryption_old=$(uci get wireless.@wifi-iface[0].encryption) 103 | if [ "$wifi_encryption_old"x = "none"x ]; then 104 | uci set wireless.@wifi-iface[1].encryption="none" 105 | else 106 | wifi_key_old=$(uci get wireless.@wifi-iface[0].key) 107 | uci set wireless.@wifi-iface[1].encryption="psk2" 108 | uci set wireless.@wifi-iface[1].key="$wifi_key_old" 109 | fi 110 | uci set wireless.@wifi-iface[1].device="ra" 111 | uci set wireless.@wifi-iface[1].network="lan" 112 | #uci set network.wan6.type="bridge" 113 | 114 | uci set wireless.@wifi-iface[1].mode="ap" 115 | uci set wireless.@wifi-iface[1].maxassoc="1" 116 | wifi_name_old=$(cat /www/wifi_name_old | awk '{print $1}') 117 | if [ ${#wifi_name_old} -ge 13 ]; then 118 | wifi_name_old=${wifi_name_old:0:13} 119 | fi 120 | uci set wireless.@wifi-iface[1].ssid="${wifi_name_old}_辅助_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 121 | #uci set wireless.@wifi-iface[1].ssid="${wifi_name_old}_辅助_" ##取消随机数 122 | #uci set wireless.@wifi-iface[1].ssid="${wifi_name_old}_on_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 123 | uci set wireless.@wifi-iface[1].disabled="0" 124 | #;; 125 | 126 | uci commit 127 | ###################### 128 | wifi_old_num=$(grep wifi-iface /etc/config/wireless | wc -l) 129 | case "$wifi_old_num" in 130 | 1) 131 | uci add wireless wifi-iface 132 | wifi_encryption_old=$(uci get wireless.@wifi-iface[0].encryption) 133 | if [ "$wifi_encryption_old"x = "none"x ]; then 134 | uci set wireless.@wifi-iface[1].encryption="none" 135 | else 136 | wifi_key_old=$(uci get wireless.@wifi-iface[0].key) 137 | uci set wireless.@wifi-iface[1].encryption="psk2" 138 | uci set wireless.@wifi-iface[1].key="$wifi_key_old" 139 | 140 | fi 141 | uci set wireless.@wifi-iface[1].device="ra" 142 | uci set wireless.@wifi-iface[1].network="lan wan6" #打开桥接 143 | uci set network.wan6.type="bridge" 144 | ##### 145 | uci set network.wan6._orig_bridge=true 146 | uci set network.wan6._orig_ifname=eth0.2 147 | uci set network.wan6.ifname=eth0.2 148 | uci set network.wan6.reqaddress=try 149 | uci set network.wan6.reqprefix=auto 150 | uci set network.wan6.type=bridge 151 | ##### 152 | uci set wireless.@wifi-iface[1].mode="ap" 153 | uci set wireless.@wifi-iface[1].maxassoc="1" 154 | wifi_name_old=$(cat /www/wifi_name_old | awk '{print $1}') 155 | if [ ${#wifi_name_old} -ge 13 ]; then 156 | wifi_name_old=${wifi_name_old:0:13} 157 | fi 158 | #uci set wireless.@wifi-iface[1].ssid="${wifi_name_old}_辅助_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 159 | #uci set wireless.@wifi-iface[1].ssid="${wifi_name_old}_on_" #取消随机数 160 | uci set wireless.@wifi-iface[1].ssid="${wifi_name_old}_on_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 161 | uci set wireless.@wifi-iface[1].disabled="0" 162 | ;; 163 | 2) 164 | uci add wireless wifi-iface 165 | wifi_encryption_old=$(uci get wireless.@wifi-iface[0].encryption) 166 | if [ "$wifi_encryption_old"x = "none"x ]; then 167 | uci set wireless.@wifi-iface[2].encryption="none" 168 | else 169 | wifi_key_old=$(uci get wireless.@wifi-iface[0].key) 170 | uci set wireless.@wifi-iface[2].encryption="psk2" 171 | uci set wireless.@wifi-iface[2].key="$wifi_key_old" 172 | fi 173 | uci set wireless.@wifi-iface[2].device="ra" 174 | uci set wireless.@wifi-iface[2].network="lan wan6" #打开桥接 175 | uci set network.wan6.type="bridge" 176 | ##### 177 | uci set network.wan6._orig_bridge=true 178 | uci set network.wan6._orig_ifname=eth0.2 179 | uci set network.wan6.ifname=eth0.2 180 | uci set network.wan6.reqaddress=try 181 | uci set network.wan6.reqprefix=auto 182 | uci set network.wan6.type=bridge 183 | ##### 184 | uci set wireless.@wifi-iface[2].mode="ap" 185 | uci set wireless.@wifi-iface[2].maxassoc="1" 186 | wifi_name_old=$(cat /www/wifi_name_old | awk '{print $1}') 187 | if [ ${#wifi_name_old} -ge 13 ]; then 188 | wifi_name_old=${wifi_name_old:0:13} 189 | fi 190 | #uci set wireless.@wifi-iface[2].ssid="${wifi_name_old}_辅助_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 191 | uci set wireless.@wifi-iface[2].ssid="${wifi_name_old}_on_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 192 | #uci set wireless.@wifi-iface[2].ssid="${wifi_name_old}_on_" #取消随机数 193 | uci set wireless.@wifi-iface[2].disabled="0" 194 | ;; 195 | 3) 196 | uci add wireless wifi-iface 197 | wifi_encryption_old=$(uci get wireless.@wifi-iface[1].encryption) 198 | if [ "$wifi_encryption_old"x = "none"x ]; then 199 | uci set wireless.@wifi-iface[3].encryption="none" 200 | else 201 | wifi_key_old=$(uci get wireless.@wifi-iface[1].key) 202 | uci set wireless.@wifi-iface[3].encryption="psk2" 203 | uci set wireless.@wifi-iface[3].key="$wifi_key_old" 204 | fi 205 | uci set wireless.@wifi-iface[3].device="ra" 206 | uci set wireless.@wifi-iface[3].network="lan wan6" #打开桥接 207 | uci set network.wan6.type="bridge" 208 | ##### 209 | uci set network.wan6._orig_bridge=true 210 | uci set network.wan6._orig_ifname=eth0.2 211 | uci set network.wan6.ifname=eth0.2 212 | uci set network.wan6.reqaddress=try 213 | uci set network.wan6.reqprefix=auto 214 | uci set network.wan6.type=bridge 215 | ##### 216 | uci set wireless.@wifi-iface[3].mode="ap" 217 | uci set wireless.@wifi-iface[3].maxassoc="1" 218 | wifi_name_old=$(cat /www/wifi_name_old | awk '{print $1}') 219 | if [ ${#wifi_name_old} -ge 13 ]; then 220 | wifi_name_old=${wifi_name_old:0:13} 221 | fi 222 | #uci set wireless.@wifi-iface[3].ssid="${wifi_name_old}_辅助_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 223 | uci set wireless.@wifi-iface[3].ssid="${wifi_name_old}_on_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 224 | #uci set wireless.@wifi-iface[3].ssid="${wifi_name_old}_on_" #取消随机数 225 | uci set wireless.@wifi-iface[3].disabled="0" 226 | esac 227 | uci commit 228 | # while ( [ ${#cellphone_mac_wlan0} -lt 6 ] && [ ${#cellphone_mac_wlan1} -lt 6 ] ) 229 | # do 230 | # cellphone_mac_wlan0=$(iwinfo ra0 assoclist | head -n 1 | awk '{print $1}') #openwrt wlan 潘多拉ra 231 | # cellphone_mac_wlan1=$(iwinfo rai0 assoclist | head -n 1 | awk '{print $1}') 232 | # echo $cellphone_mac_wlan0 > /www/mac_save_new_wlan0 233 | # echo $cellphone_mac_wlan1 > /www/mac_save_new_wlan1 234 | # sleep 1 235 | # echo $cellphone_mac_wlan0 > /www/mac_save_new 236 | # if [ ${#cellphone_mac_wlan0} -lt 6 ]; then 237 | # echo $cellphone_mac_wlan1 > /www/mac_save_new 238 | # fi 239 | # done 240 | 241 | sleep 1 242 | wifi 243 | /etc/init.d/odhcpd restart 1>/dev/null 2>&1 244 | /etc/init.d/network restart 1>/dev/null 2>&1 245 | /etc/init.d/firewall restart 1>/dev/null 2>&1 246 | rm /tmp/dialtool.pid 247 | 248 | else 249 | echo "dialtoll stop." 250 | #uci set wireless.@wifi-iface[1].disabled="1" 251 | 252 | #####优化步骤,防止寝室多人连接时,非拨号手机mac夺权(谢谢前任女朋友的问题反馈) 253 | 254 | 255 | while ( [ ${#cellphone_mac_wlan0} -lt 6 ] && [ ${#cellphone_mac_wlan1} -lt 6 ] ) 256 | do 257 | cellphone_mac_wlan0=$(iwinfo ra1 assoclist | head -n 1 | awk '{print $1}') #openwrt wlan 潘多拉ra 258 | cellphone_mac_wlan1=$(iwinfo rai1 assoclist | head -n 1 | awk '{print $1}') 259 | echo $cellphone_mac_wlan0 > /www/mac_save_new_wlan0 260 | echo $cellphone_mac_wlan1 > /www/mac_save_new_wlan1 261 | sleep 1 262 | echo $cellphone_mac_wlan0 > /www/mac_save_new 263 | if [ ${#cellphone_mac_wlan0} -lt 6 ]; then 264 | echo $cellphone_mac_wlan1 > /www/mac_save_new 265 | fi 266 | done 267 | 268 | 269 | 270 | sleep 1 271 | ############################## 272 | 273 | 274 | 275 | 276 | cp /etc/config/wireless.back /etc/config/wireless 277 | wan_mac_new=$(cat /www/mac_save_new_wlan0 | awk '{print $1}') 278 | if [ ${#wan_mac_new} -lt 6 ]; then 279 | wan_mac_new=$(cat /www/mac_save_new_wlan1 | awk '{print $1}') 280 | fi 281 | uci set network.wan.proto="dhcp" 282 | uci set network.wan.macaddr="$wan_mac_new" 283 | uci set network.@device[1].macaddr="$wan_mac_new" 284 | uci delete network.wan6.type 285 | 286 | uci commit 287 | 288 | 289 | wifi 290 | /etc/init.d/odhcpd restart 1>/dev/null 2>&1 291 | /etc/init.d/network restart 1>/dev/null 2>&1 292 | /etc/init.d/firewall restart 1>/dev/null 2>&1 293 | sleep 2 294 | passwd="/www/t.txt" 295 | if [ -f "$passwd" ]; then 296 | 297 | echo "当前授权信息已修改" 298 | else 299 | sh /www/xlxy & 300 | echo "无授权,开始写入" 301 | fi 302 | rm /tmp/dialtool.pid 303 | fi 304 | 305 | -------------------------------------------------------------------------------- /etc/dialtool-test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sleep 3 3 | pid="/tmp/dialtool.pid" 4 | if [ -f "$pid" ]; then 5 | echo "dialtool is running, exit!" 6 | exit 0 7 | fi 8 | echo runnig > /tmp/dialtool.pid 9 | flag="/etc/config/wireless.back" 10 | if [ -f "$flag" ]; then 11 | echo "second." 12 | else 13 | echo "first." 14 | uci set dhcp.@dhcp[0].force="1" #强制dhcp,xl会链接不到 15 | wan_mac_old=$(ifconfig $(ubus call network.interface.wan status | grep device | awk -F '\"' '{print $4}' | tail -n 1) | grep HWaddr | awk '{print $5}') 16 | echo $wan_mac_old 17 | echo $wan_mac_old > /www/mac_save_old 18 | fi 19 | 20 | mark=$1 21 | if [ $mark -eq 1 ]; then 22 | echo "dialtool start." 23 | ##### 设置初始mac 解决安卓手机不认账的情况 24 | mac_now=$(ifconfig $(ubus call network.interface.wan status | grep device | awk -F '\"' '{print $4}' | tail -n 1) | grep HWaddr | awk '{print $5}') 25 | mac_old=$(cat /www/mac_save_old | awk '{print $1}') 26 | if [ "$mac_now" != "$mac_old" ];then 27 | echo "$mac_old" 28 | uci set network.wan.macaddr="$mac_old" 29 | uci set network.@device[1].macaddr="$mac_old" 30 | else 31 | echo "$mac_now" 32 | fi 33 | faaa=$(grep wifi-iface /etc/config/wireless | wc -l) #####防止在执行中崩溃,wifi配置出现严重崩溃 34 | if [ "$faaa" -ge 1 ]; then 35 | echo "非首次运行" 36 | cp /etc/config/wireless.back /etc/config/wireless 37 | else 38 | echo "首次运行,不用重置." 39 | fi 40 | uci commit 41 | sleep 1 42 | # wan_mac_origin=$(cat /www/mac_save_old | awk '{print $1}') 43 | # echo "$wan_mac_origin" 44 | # uci set network.wan.macaddr="$wan_mac_origin" 45 | # uci set network.@device[1].macaddr="$wan_mac_origin" 46 | 47 | # uci commit 48 | # /etc/init.d/odhcpd restart 1>/dev/null 2>&1 49 | # /etc/init.d/network restart 1>/dev/null 2>&1 50 | # /etc/init.d/firewall restart 1>/dev/null 2>&1 51 | # sleep 3 52 | 53 | #### 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | #### 73 | 74 | cp /etc/config/wireless /etc/config/wireless.back 75 | wifi_name_old=$(uci get wireless.@wifi-iface[0].ssid) 76 | echo $wifi_name_old > /www/wifi_name_old 77 | 78 | 79 | uci add wireless wifi-iface 80 | wifi_encryption_old=$(uci get wireless.@wifi-iface[0].encryption) 81 | if [ "$wifi_encryption_old"x = "none"x ]; then 82 | uci set wireless.@wifi-iface[1].encryption="none" 83 | else 84 | wifi_key_old=$(uci get wireless.@wifi-iface[0].key) 85 | uci set wireless.@wifi-iface[1].encryption="psk2" 86 | uci set wireless.@wifi-iface[1].key="$wifi_key_old" 87 | fi 88 | uci set wireless.@wifi-iface[1].device="ra" 89 | uci set wireless.@wifi-iface[1].network="lan" 90 | #uci set network.wan6.type="bridge" 91 | 92 | uci set wireless.@wifi-iface[1].mode="ap" 93 | uci set wireless.@wifi-iface[1].maxassoc="1" 94 | wifi_name_old=$(cat /www/wifi_name_old | awk '{print $1}') 95 | if [ ${#wifi_name_old} -ge 13 ]; then 96 | wifi_name_old=${wifi_name_old:0:13} 97 | fi 98 | uci set wireless.@wifi-iface[1].ssid="${wifi_name_old}_辅助_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 99 | #uci set wireless.@wifi-iface[1].ssid="${wifi_name_old}_on_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 100 | uci set wireless.@wifi-iface[1].disabled="0" 101 | #;; 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | uci commit 110 | ###################### 111 | wifi_old_num=$(grep wifi-iface /etc/config/wireless | wc -l) 112 | case "$wifi_old_num" in 113 | 1) 114 | uci add wireless wifi-iface 115 | wifi_encryption_old=$(uci get wireless.@wifi-iface[0].encryption) 116 | if [ "$wifi_encryption_old"x = "none"x ]; then 117 | uci set wireless.@wifi-iface[1].encryption="none" 118 | else 119 | wifi_key_old=$(uci get wireless.@wifi-iface[0].key) 120 | uci set wireless.@wifi-iface[1].encryption="psk2" 121 | uci set wireless.@wifi-iface[1].key="$wifi_key_old" 122 | fi 123 | uci set wireless.@wifi-iface[1].device="ra" 124 | uci set wireless.@wifi-iface[1].network="lan wan6" #打开桥接 125 | uci set network.wan6.type="bridge" 126 | ##### 127 | uci set network.wan6._orig_bridge=true 128 | uci set network.wan6._orig_ifname=eth0.2 129 | uci set network.wan6.ifname=eth0.2 130 | uci set network.wan6.reqaddress=try 131 | uci set network.wan6.reqprefix=auto 132 | uci set network.wan6.type=bridge 133 | ##### 134 | uci set wireless.@wifi-iface[1].mode="ap" 135 | uci set wireless.@wifi-iface[1].maxassoc="1" 136 | wifi_name_old=$(cat /www/wifi_name_old | awk '{print $1}') 137 | if [ ${#wifi_name_old} -ge 13 ]; then 138 | wifi_name_old=${wifi_name_old:0:13} 139 | fi 140 | #uci set wireless.@wifi-iface[1].ssid="${wifi_name_old}_辅助_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 141 | uci set wireless.@wifi-iface[1].ssid="${wifi_name_old}_on_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 142 | uci set wireless.@wifi-iface[1].disabled="0" 143 | ;; 144 | 2) 145 | uci add wireless wifi-iface 146 | wifi_encryption_old=$(uci get wireless.@wifi-iface[0].encryption) 147 | if [ "$wifi_encryption_old"x = "none"x ]; then 148 | uci set wireless.@wifi-iface[2].encryption="none" 149 | else 150 | wifi_key_old=$(uci get wireless.@wifi-iface[0].key) 151 | uci set wireless.@wifi-iface[2].encryption="psk2" 152 | uci set wireless.@wifi-iface[2].key="$wifi_key_old" 153 | fi 154 | uci set wireless.@wifi-iface[2].device="ra" 155 | uci set wireless.@wifi-iface[2].network="lan wan6" #打开桥接 156 | uci set network.wan6.type="bridge" 157 | ##### 158 | uci set network.wan6._orig_bridge=true 159 | uci set network.wan6._orig_ifname=eth0.2 160 | uci set network.wan6.ifname=eth0.2 161 | uci set network.wan6.reqaddress=try 162 | uci set network.wan6.reqprefix=auto 163 | uci set network.wan6.type=bridge 164 | ##### 165 | uci set wireless.@wifi-iface[2].mode="ap" 166 | uci set wireless.@wifi-iface[2].maxassoc="1" 167 | wifi_name_old=$(cat /www/wifi_name_old | awk '{print $1}') 168 | if [ ${#wifi_name_old} -ge 13 ]; then 169 | wifi_name_old=${wifi_name_old:0:13} 170 | fi 171 | #uci set wireless.@wifi-iface[2].ssid="${wifi_name_old}_辅助_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 172 | uci set wireless.@wifi-iface[2].ssid="${wifi_name_old}_on_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 173 | uci set wireless.@wifi-iface[2].disabled="0" 174 | ;; 175 | 3) 176 | uci add wireless wifi-iface 177 | wifi_encryption_old=$(uci get wireless.@wifi-iface[1].encryption) 178 | if [ "$wifi_encryption_old"x = "none"x ]; then 179 | uci set wireless.@wifi-iface[3].encryption="none" 180 | else 181 | wifi_key_old=$(uci get wireless.@wifi-iface[1].key) 182 | uci set wireless.@wifi-iface[3].encryption="psk2" 183 | uci set wireless.@wifi-iface[3].key="$wifi_key_old" 184 | fi 185 | uci set wireless.@wifi-iface[3].device="ra" 186 | uci set wireless.@wifi-iface[3].network="lan wan6" #打开桥接 187 | uci set network.wan6.type="bridge" 188 | ##### 189 | uci set network.wan6._orig_bridge=true 190 | uci set network.wan6._orig_ifname=eth0.2 191 | uci set network.wan6.ifname=eth0.2 192 | uci set network.wan6.reqaddress=try 193 | uci set network.wan6.reqprefix=auto 194 | uci set network.wan6.type=bridge 195 | ##### 196 | uci set wireless.@wifi-iface[3].mode="ap" 197 | uci set wireless.@wifi-iface[3].maxassoc="1" 198 | wifi_name_old=$(cat /www/wifi_name_old | awk '{print $1}') 199 | if [ ${#wifi_name_old} -ge 13 ]; then 200 | wifi_name_old=${wifi_name_old:0:13} 201 | fi 202 | #uci set wireless.@wifi-iface[3].ssid="${wifi_name_old}_辅助_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 203 | uci set wireless.@wifi-iface[3].ssid="${wifi_name_old}_on_$(head /dev/urandom |tr -cd a-f0-9|cut -c 1-6)" 204 | uci set wireless.@wifi-iface[3].disabled="0" 205 | esac 206 | uci commit 207 | # while ( [ ${#cellphone_mac_wlan0} -lt 6 ] && [ ${#cellphone_mac_wlan1} -lt 6 ] ) 208 | # do 209 | # cellphone_mac_wlan0=$(iwinfo ra0 assoclist | head -n 1 | awk '{print $1}') #openwrt wlan 潘多拉ra 210 | # cellphone_mac_wlan1=$(iwinfo rai0 assoclist | head -n 1 | awk '{print $1}') 211 | # echo $cellphone_mac_wlan0 > /www/mac_save_new_wlan0 212 | # echo $cellphone_mac_wlan1 > /www/mac_save_new_wlan1 213 | # sleep 1 214 | # echo $cellphone_mac_wlan0 > /www/mac_save_new 215 | # if [ ${#cellphone_mac_wlan0} -lt 6 ]; then 216 | # echo $cellphone_mac_wlan1 > /www/mac_save_new 217 | # fi 218 | # done 219 | 220 | sleep 1 221 | wifi 222 | /etc/init.d/odhcpd restart 1>/dev/null 2>&1 223 | /etc/init.d/network restart 1>/dev/null 2>&1 224 | /etc/init.d/firewall restart 1>/dev/null 2>&1 225 | 226 | else 227 | echo "dialtoll stop." 228 | #uci set wireless.@wifi-iface[1].disabled="1" 229 | 230 | #####优化步骤,防止寝室多人连接时,非拨号手机mac夺权 231 | 232 | 233 | while ( [ ${#cellphone_mac_wlan0} -lt 6 ] && [ ${#cellphone_mac_wlan1} -lt 6 ] ) 234 | do 235 | cellphone_mac_wlan0=$(iwinfo ra1 assoclist | head -n 1 | awk '{print $1}') #openwrt wlan 潘多拉ra 236 | cellphone_mac_wlan1=$(iwinfo rai1 assoclist | head -n 1 | awk '{print $1}') 237 | echo $cellphone_mac_wlan0 > /www/mac_save_new_wlan0 238 | echo $cellphone_mac_wlan1 > /www/mac_save_new_wlan1 239 | sleep 1 240 | echo $cellphone_mac_wlan0 > /www/mac_save_new 241 | if [ ${#cellphone_mac_wlan0} -lt 6 ]; then 242 | echo $cellphone_mac_wlan1 > /www/mac_save_new 243 | fi 244 | done 245 | 246 | 247 | 248 | sleep 1 249 | ############################## 250 | 251 | 252 | 253 | 254 | cp /etc/config/wireless.back /etc/config/wireless 255 | wan_mac_new=$(cat /www/mac_save_new_wlan0 | awk '{print $1}') 256 | if [ ${#wan_mac_new} -lt 6 ]; then 257 | wan_mac_new=$(cat /www/mac_save_new_wlan1 | awk '{print $1}') 258 | fi 259 | uci set network.wan.proto="dhcp" 260 | uci set network.wan.macaddr="$wan_mac_new" 261 | uci set network.@device[1].macaddr="$wan_mac_new" 262 | uci delete network.wan6.type 263 | 264 | uci commit 265 | 266 | 267 | wifi 268 | /etc/init.d/odhcpd restart 1>/dev/null 2>&1 269 | /etc/init.d/network restart 1>/dev/null 2>&1 270 | /etc/init.d/firewall restart 1>/dev/null 2>&1 271 | sh /www/xlxy & 272 | fi 273 | rm /tmp/dialtool.pid 274 | -------------------------------------------------------------------------------- /etc/init.d/dropbear-delete: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F-Light/WeNet-router/f7fa0eeac0b83fa6f2fa47a593563085e2f8a8ef/etc/init.d/dropbear-delete -------------------------------------------------------------------------------- /etc/init.d/telnet-delete: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F-Light/WeNet-router/f7fa0eeac0b83fa6f2fa47a593563085e2f8a8ef/etc/init.d/telnet-delete -------------------------------------------------------------------------------- /etc/re: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #本脚本是未完善的还原脚本,其用途是处理已出售的路由器中因用户操作不当引起的一些错误的恢复。一般不会影响固件。 3 | cp /etc/config/firewall.origin /etc/config/firewall 4 | cp /etc/config/network.origin /etc/config/network 5 | uci commit 6 | sleep 1 7 | 8 | /etc/init.d/odhcpd restart 1>/dev/null 2>&1 9 | /etc/init.d/network restart 1>/dev/null 2>&1 10 | /etc/init.d/firewall restart 1>/dev/null 2>&1 11 | -------------------------------------------------------------------------------- /etc/shadow-delete: -------------------------------------------------------------------------------- 1 | root:$1$Qxc6swrd$29whu66RMDekBcjTYNccM/:17983:0:99999:7::: 2 | daemon:*:0:0:99999:7::: 3 | ftp:*:0:0:99999:7::: 4 | network:*:0:0:99999:7::: 5 | nobody:*:0:0:99999:7::: 6 | aria2:x:0:0:99999:7::: 7 | mosquitto:x:0:0:99999:7::: 8 | rpc:x:0:0:99999:7::: 9 | transmission:x:0:0:99999:7::: 10 | -------------------------------------------------------------------------------- /root/nk4: -------------------------------------------------------------------------------- 1 | #!/bin/sh /etc/rc.common 2 | 3 | START=99 4 | STOP=15 5 | 6 | start() 7 | 8 | { 9 | (sh /root/nk4.sh &) 10 | logger -t nk4 "wan listen start" 11 | } 12 | -------------------------------------------------------------------------------- /root/nk4.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #start pppoe-server 4 | if [ -n "$(ps | grep pppoe-server | grep -v grep)" ] 5 | then 6 | killall pppoe-server 7 | fi 8 | pppoe-server -k -I br-lan 9 | 10 | #clear logs 11 | cat /dev/null > /tmp/pppoe.log 12 | 13 | while : 14 | do 15 | #read the last username in pppoe.log 16 | userinfo=$(grep 'user=' /tmp/pppoe.log | grep 'rcvd' | tail -n 1) 17 | name=${userinfo#*'"'} 18 | username=${name%'" password="'*} 19 | word=${userinfo#*'" password="'} 20 | password=${word%'"]'} 21 | 22 | if [ "$username" != "$username_old" ] 23 | then 24 | ifdown wan 25 | uci set network.wan.username="$username" 26 | uci set network.wan.password="$password" 27 | uci commit 28 | ifup wan 29 | username_old="$username" 30 | logger -t nk4 "new username $username" 31 | fi 32 | 33 | sleep 10 34 | 35 | #close pppoe if log fail 36 | if [ -z "$(ifconfig | grep "wan")" ] 37 | then 38 | ifdown wan 39 | fi 40 | 41 | done 42 | -------------------------------------------------------------------------------- /root/nk4conf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ######开始切换电脑版 3 | sleep 1 4 | lock="/www/origin.lock" 5 | if [ -f "$lock" ]; then 6 | echo "非初始环境.不需要备份" 7 | else 8 | echo "初始环境.开始备份" 9 | 10 | cp /etc/config/wireless /etc/config/wireless.origin 11 | cp /etc/config/firewall /etc/config/firewall.origin 12 | cp /etc/config/network /etc/config/network.origin 13 | echo origin > /www/origin.lock 14 | wan_mac_old=$(ifconfig $(ubus call network.interface.wan status | grep device | awk -F '\"' '{print $4}' | tail -n 1) | grep HWaddr | awk '{print $5}') 15 | echo $wan_mac_old 16 | echo $wan_mac_old > /www/mac_save_old 17 | echo "完成备份" 18 | fi 19 | 20 | 21 | 22 | sleep 1 23 | 24 | #######自动安装pppoe服务器 25 | if [ -z "$(opkg list-installed | grep "rp-pppoe-server")" ] 26 | then 27 | echo "未发现pppoe服务器,下面开始安装。" 28 | opkg install /root/rp-pppoe-common_3.11-1_mipsel_24kec_dsp.ipk 29 | opkg install /root/rp-pppoe-server_3.11-1_mipsel_24kec_dsp.ipk 30 | sleep 2 31 | #exit 0 32 | else 33 | echo "已安装。" 34 | fi 35 | 36 | 37 | 38 | 39 | ###################### 40 | pc="/etc/init.d/nk4" 41 | if [ -f "$pc" ]; then 42 | echo "当前环境为电脑版。不需要操作" 43 | echo "pc is running, exit!" 44 | exit 0 45 | 46 | else 47 | # echo "即将执行电脑版切换,开始备份手机版文件" 48 | # cp /etc/config/wireless /etc/config/wireless.backpc 49 | # cp /etc/config/firewall /etc/config/firewall.backpc 50 | # cp /etc/config/network /etc/config/network.backpc 51 | echo "开始切换" 52 | 53 | fi 54 | 55 | sleep 1 56 | #####防止在执行中,wifi配置出现严重崩溃 57 | faaa=$(grep wifi-iface /etc/config/wireless | wc -l) 58 | if [ "$faaa" -ge 1 ]; then 59 | 60 | echo "非首次运行" 61 | cp /etc/config/wireless.back /etc/config/wireless 62 | 63 | else 64 | echo "首次运行,不用重置." 65 | fi 66 | uci commit 67 | sleep 1 68 | ###### 69 | 70 | 71 | #Check PPPoE-Server 72 | if [ -z "$(opkg list-installed | grep "rp-pppoe-server")" ] 73 | then 74 | echo "Please install PPPoE-Server first" 75 | exit 0 76 | fi 77 | 78 | #change log location & enable debug & show password 79 | sed -i "s/\/dev\/null/\/tmp\/pppoe.log/" /etc/ppp/options 80 | sed -i "s/#debug/debug/" /etc/ppp/options 81 | echo "show-password" >> /etc/ppp/options 82 | 83 | cp /etc/ppp/plugins/rp-pppoe.so /etc/ppp/plugins/rp-pppoe.so.bak 84 | cp /usr/lib/pppd/2.4.7/rp-pppoe.so /etc/ppp/plugins/rp-pppoe.so 85 | 86 | #set network 87 | uci delete network.wan6 88 | uci commit network 89 | 90 | uci set network.wan=interface 91 | uci set network.wan.ifname=$(uci get network.wan.ifname) 92 | #uci set network.wan.macaddr=aabbccddeeff 93 | uci set network.wan.proto=pppoe 94 | uci set network.wan.username=username 95 | uci set network.wan.password=password 96 | uci set network.wan.metric='0' 97 | uci set network.wan.auto='0' 98 | uci commit network 99 | 100 | #set firewall 101 | uci set firewall.@zone[1].network='wan wan' 102 | uci commit firewall 103 | /etc/init.d/firewall restart 104 | /etc/init.d/network reload 105 | /etc/init.d/network restart 106 | 107 | #enable \r in PPPoE 108 | cp /lib/netifd/proto/ppp.sh /lib/netifd/proto/ppp.sh_bak 109 | sed -i '/proto_run_command/i username=`echo -e "$username"`' /lib/netifd/proto/ppp.sh 110 | 111 | #set init script 112 | cp /root/nk4 /etc/init.d/nk4 113 | chmod +x /etc/init.d/nk4 114 | /etc/init.d/nk4 enable 115 | sleep 5 116 | (/etc/init.d/nk4 start &) 117 | -------------------------------------------------------------------------------- /root/rp-pppoe-common_3.11-1_mipsel_24kec_dsp.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F-Light/WeNet-router/f7fa0eeac0b83fa6f2fa47a593563085e2f8a8ef/root/rp-pppoe-common_3.11-1_mipsel_24kec_dsp.ipk -------------------------------------------------------------------------------- /root/rp-pppoe-server_3.11-1_mipsel_24kec_dsp.ipk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F-Light/WeNet-router/f7fa0eeac0b83fa6f2fa47a593563085e2f8a8ef/root/rp-pppoe-server_3.11-1_mipsel_24kec_dsp.ipk -------------------------------------------------------------------------------- /usr/lib/lua/luci/controller/admin/new_tab.lua: -------------------------------------------------------------------------------- 1 | -- Copyright 2008 fulinux 2 | -- Licensed to the public under the Apache License 2.0. 3 | 4 | module("luci.controller.admin.new_tab", package.seeall) --notice that new_tab is the name of the file new_tab.lua 5 | function index() 6 | entry({"admin", "new_tab"}, firstchild(), "苏联大学网络助手", 30).dependent=false --this adds the top level tab and defaults to the first sub-tab (tab_from_cbi), also it is set to position 30 7 | entry({"admin", "new_tab", "tab_from_view"}, template("admin_myapp/view_tab"), _("设置"), 2) --this adds the second sub-tab that is located in /usr/lib/lua/luci/view/admin_myapp and the file is called view_tab.htm, also set to the second position 8 | end 9 | -------------------------------------------------------------------------------- /usr/lib/lua/luci/controller/admin/system.lua: -------------------------------------------------------------------------------- 1 | module("luci.controller.admin.system",package.seeall) 2 | function index() 3 | local e=require"nixio.fs" 4 | entry({"admin","system"},alias("admin","system","system"),_("System"),30).index=true 5 | entry({"admin","system","system"},cbi("admin_system/system"),_("System"),1) 6 | entry({"admin","system","clock_status"},post_on({set=true},"action_clock_status")) 7 | entry({"admin","system","admin"},cbi("admin_system/admin"),_("Administration"),2) 8 | -- if e.access("/bin/opkg")then 9 | -- entry({"admin","system","packages"},post_on({exec="1"},"action_packages"),_("Software"),10) 10 | -- entry({"admin","system","packages","ipkg"},form("admin_system/ipkg")) 11 | -- end 12 | entry({"admin","system","startup"},form("admin_system/startup"),_("Startup"),45) 13 | entry({"admin","system","crontab"},arcombine(cbi("admin_system/crontab"),cbi("admin_system/crontab-details")),_("Scheduled Tasks"),46).leaf=true 14 | if e.access("/sbin/block")and e.access("/etc/config/fstab")then 15 | entry({"admin","system","fstab"},cbi("admin_system/fstab"),_("Mount Points"),50) 16 | entry({"admin","system","fstab","mount"},cbi("admin_system/fstab/mount"),nil).leaf=true 17 | entry({"admin","system","fstab","swap"},cbi("admin_system/fstab/swap"),nil).leaf=true 18 | end 19 | if e.access("/sys/class/leds")then 20 | entry({"admin","system","leds"},cbi("admin_system/leds"),_("LED Configuration"),60) 21 | end 22 | entry({"admin","system","flashops"},call("action_flashops"),_("Backup / Flash Firmware"),70) 23 | entry({"admin","system","flashops","reset"},post("action_reset")) 24 | --entry({"admin","system","flashops","backup"},post("action_backup")) 25 | --entry({"admin","system","flashops","backupmtdblock"},post("action_backupmtdblock")) 26 | entry({"admin","system","flashops","backupfiles"},form("admin_system/backupfiles")) 27 | entry({"admin","system","flashops","restore"},call("action_restore")) 28 | entry({"admin","system","flashops","sysupgrade"},call("action_sysupgrade")) 29 | entry({"admin","system","reboot"},template("admin_system/reboot"),_("Reboot"),90) 30 | entry({"admin","system","reboot","call"},post("action_reboot")) 31 | end 32 | function action_clock_status() 33 | local e=tonumber(luci.http.formvalue("set")) 34 | if e~=nil and e>0 then 35 | local e=os.date("*t",e) 36 | if e then 37 | luci.sys.call("date -s '%04d-%02d-%02d %02d:%02d:%02d'"%{ 38 | e.year,e.month,e.day,e.hour,e.min,e.sec 39 | }) 40 | luci.sys.call("/etc/init.d/sysfixtime restart") 41 | end 42 | end 43 | luci.http.prepare_content("application/json") 44 | luci.http.write_json({timestring=os.date("%c")}) 45 | end 46 | function action_packages() 47 | local l=require"nixio.fs" 48 | local n=require"luci.model.ipkg" 49 | local m=(luci.http.formvalue("exec")=="1") 50 | local r,d 51 | local h=false 52 | local u={} 53 | local c={} 54 | local t={""} 55 | local e={""} 56 | local o,a 57 | local f=luci.http.formvalue("display")or"installed" 58 | local i=string.byte(luci.http.formvalue("letter")or"A",1) 59 | i=(i==35 or(i>=65 and i<=90))and i or 65 60 | local s=luci.http.formvalue("query") 61 | s=(s~='')and s or nil 62 | if m then 63 | local l=luci.http.formvalue("install") 64 | local i=nil 65 | local s=luci.http.formvalue("url") 66 | if s and s~=''then 67 | i=s 68 | end 69 | if l then 70 | u[l],o,a=n.install(l) 71 | t[#t+1]=o 72 | e[#e+1]=a 73 | h=true 74 | end 75 | if i then 76 | local s 77 | for s in luci.util.imatch(i)do 78 | u[i],o,a=n.install(s) 79 | t[#t+1]=o 80 | e[#e+1]=a 81 | h=true 82 | end 83 | end 84 | local i=luci.http.formvalue("remove") 85 | if i then 86 | c[i],o,a=n.remove(i) 87 | t[#t+1]=o 88 | e[#e+1]=a 89 | h=true 90 | end 91 | r=luci.http.formvalue("update") 92 | if r then 93 | r,o,a=n.update() 94 | t[#t+1]=o 95 | e[#e+1]=a 96 | end 97 | d=luci.http.formvalue("upgrade") 98 | if d then 99 | d,o,a=n.upgrade() 100 | t[#t+1]=o 101 | e[#e+1]=a 102 | end 103 | end 104 | local a=true 105 | local o=false 106 | if l.access("/var/opkg-lists/")then 107 | local e 108 | for e in l.dir("/var/opkg-lists/")do 109 | a=false 110 | if(l.stat("/var/opkg-lists/"..e,"mtime")or 0)<(os.time()-(24*60*60))then 111 | o=true 112 | break 113 | end 114 | end 115 | end 116 | luci.template.render("admin_system/packages",{ 117 | display=f, 118 | letter=i, 119 | query=s, 120 | install=u, 121 | remove=c, 122 | update=r, 123 | upgrade=d, 124 | no_lists=a, 125 | old_lists=o, 126 | stdout=table.concat(t,""), 127 | stderr=table.concat(e,"") 128 | }) 129 | if h then 130 | l.unlink("/tmp/luci-indexcache") 131 | end 132 | end 133 | local function h(e) 134 | return(os.execute("sysupgrade -T %q >/dev/null"%e)==0) 135 | end 136 | local function s(e) 137 | return(luci.sys.exec("md5sum %q"%e):match("^([^%s]+)")) 138 | end 139 | local function r(e) 140 | return(luci.sys.exec("sha256sum %q"%e):match("^([^%s]+)")) 141 | end 142 | local function n() 143 | return nixio.fs.access("/lib/upgrade/platform.sh") 144 | end 145 | local function i() 146 | return(os.execute([[grep -sqE '"rootfs_data"|"ubi"' /proc/mtd]])==0) 147 | end 148 | local function d() 149 | local e=0 150 | if nixio.fs.access("/proc/mtd")then 151 | for t in io.lines("/proc/mtd")do 152 | local o,a,o,t=t:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"') 153 | if t=="linux"or t=="firmware"then 154 | e=tonumber(a,16) 155 | break 156 | end 157 | end 158 | elseif nixio.fs.access("/proc/partitions")then 159 | for t in io.lines("/proc/partitions")do 160 | local o,o,a,t=t:match('^%s*(%d+)%s+(%d+)%s+([^%s]+)%s+([^%s]+)') 161 | if a and t and not t:match('[0-9]')then 162 | e=tonumber(a)*1024 163 | break 164 | end 165 | end 166 | end 167 | return e 168 | end 169 | function action_flashops() 170 | luci.template.render("admin_system/flashops",{ 171 | reset_avail=i(), 172 | upgrade_avail=n() 173 | }) 174 | end 175 | function action_sysupgrade() 176 | local o=require"nixio.fs" 177 | local t=require"luci.http" 178 | local e="/tmp/firmware.img" 179 | local a 180 | t.setfilehandler( 181 | function(t,o,i) 182 | if not a and t and t.name=="image"then 183 | a=io.open(e,"w") 184 | end 185 | if a and o then 186 | a:write(o) 187 | end 188 | if a and i then 189 | a:close() 190 | end 191 | end 192 | ) 193 | if not luci.dispatcher.test_post_security()then 194 | o.unlink(e) 195 | return 196 | end 197 | if t.formvalue("cancel")then 198 | o.unlink(e) 199 | t.redirect(luci.dispatcher.build_url('admin/system/flashops')) 200 | return 201 | end 202 | local a=tonumber(t.formvalue("step")or 1) 203 | if a==1 then 204 | if h(e)then 205 | luci.template.render("admin_system/upgrade",{ 206 | checksum=s(e), 207 | sha256ch=r(e), 208 | storage=d(), 209 | size=(o.stat(e,"size")or 0), 210 | keep=(not not t.formvalue("keep")) 211 | }) 212 | else 213 | o.unlink(e) 214 | luci.template.render("admin_system/flashops",{ 215 | reset_avail=i(), 216 | upgrade_avail=n(), 217 | image_invalid=true 218 | }) 219 | end 220 | elseif a==2 then 221 | local t=(t.formvalue("keep")=="1")and""or"-n" 222 | luci.template.render("admin_system/applyreboot",{ 223 | title=luci.i18n.translate("Flashing..."), 224 | msg=luci.i18n.translate("The system is flashing now.
DO NOT POWER OFF THE DEVICE!
Wait a few minutes before you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings."), 225 | addr=(#t>0)and"192.168.1.1"or nil 226 | }) 227 | fork_exec("sleep 1; killall dropbear uhttpd; sleep 1; /sbin/sysupgrade %s %q"%{t,e}) 228 | end 229 | end 230 | function action_backup() 231 | local e=ltn12_popen("sysupgrade --create-backup - 2>/dev/null") 232 | luci.http.header( 233 | 'Content-Disposition','attachment; filename="backup-%s-%s.tar.gz"'%{ 234 | luci.sys.hostname(), 235 | os.date("%Y-%m-%d") 236 | }) 237 | luci.http.prepare_content("application/x-targz") 238 | luci.ltn12.pump.all(e,luci.http.write) 239 | end 240 | function action_backupmtdblock() 241 | local e=require"luci.http" 242 | local e=e.formvalue("mtdblockname") 243 | local e,a,t=e:match('^([^%s]+)/([^%s]+)/([^%s]+)') 244 | local t=ltn12_popen("cat /dev/mtd%s"%t) 245 | luci.http.header( 246 | 'Content-Disposition','attachment; filename="backup-%s-%s-%s.bin"'%{ 247 | luci.sys.hostname(),e, 248 | os.date("%Y-%m-%d") 249 | }) 250 | luci.http.prepare_content("application/octet-stream") 251 | luci.ltn12.pump.all(t,luci.http.write) 252 | end 253 | function action_restore() 254 | local n=require"nixio.fs" 255 | local t=require"luci.http" 256 | local a="/tmp/restore.tar.gz" 257 | local e 258 | t.setfilehandler( 259 | function(t,o,i) 260 | if not e and t and t.name=="archive"then 261 | e=io.open(a,"w") 262 | end 263 | if e and o then 264 | e:write(o) 265 | end 266 | if e and i then 267 | e:close() 268 | end 269 | end 270 | ) 271 | if not luci.dispatcher.test_post_security()then 272 | n.unlink(a) 273 | return 274 | end 275 | local e=t.formvalue("archive") 276 | if e and#e>0 then 277 | luci.template.render("admin_system/applyreboot") 278 | os.execute("tar -C / -xzf %q >/dev/null 2>&1"%a) 279 | luci.sys.reboot() 280 | return 281 | end 282 | t.redirect(luci.dispatcher.build_url('admin/system/flashops')) 283 | end 284 | function action_reset() 285 | if i()then 286 | luci.template.render("admin_system/applyreboot",{ 287 | title=luci.i18n.translate("Erasing..."), 288 | msg=luci.i18n.translate("The system is erasing the configuration partition now and will reboot itself when finished."), 289 | addr="192.168.1.1" 290 | }) 291 | fork_exec("sleep 1; killall dropbear uhttpd; sleep 1; jffs2reset -y && reboot") 292 | return 293 | end 294 | http.redirect(luci.dispatcher.build_url('admin/system/flashops')) 295 | end 296 | function action_passwd() 297 | local e=luci.http.formvalue("pwd1") 298 | local a=luci.http.formvalue("pwd2") 299 | local t=nil 300 | if e or a then 301 | if e==a then 302 | t=luci.sys.user.setpasswd("root",e) 303 | else 304 | t=10 305 | end 306 | end 307 | luci.template.render("admin_system/passwd",{stat=t}) 308 | end 309 | function action_reboot() 310 | luci.sys.reboot() 311 | end 312 | function fork_exec(t) 313 | local e=nixio.fork() 314 | if e>0 then 315 | return 316 | elseif e==0 then 317 | nixio.chdir("/") 318 | local e=nixio.open("/dev/null","w+") 319 | if e then 320 | nixio.dup(e,nixio.stderr) 321 | nixio.dup(e,nixio.stdout) 322 | nixio.dup(e,nixio.stdin) 323 | if e:fileno()>2 then 324 | e:close() 325 | end 326 | end 327 | nixio.exec("/bin/sh","-c",t) 328 | end 329 | end 330 | function ltn12_popen(i) 331 | local e,a=nixio.pipe() 332 | local t=nixio.fork() 333 | if t>0 then 334 | a:close() 335 | local a 336 | return function() 337 | local o=e:read(2048) 338 | local i,t=nixio.waitpid(t,"nohang") 339 | if not a and i and t=="exited"then 340 | a=true 341 | end 342 | if o and#o>0 then 343 | return o 344 | elseif a then 345 | e:close() 346 | return nil 347 | end 348 | end 349 | elseif t==0 then 350 | nixio.dup(a,nixio.stdout) 351 | e:close() 352 | a:close() 353 | nixio.exec("/bin/sh","-c",i) 354 | end 355 | end 356 | -------------------------------------------------------------------------------- /usr/lib/lua/luci/view/admin_myapp/view_tab.htm: -------------------------------------------------------------------------------- 1 | <%+header%> 2 |

苏联大学的秘密

3 |
4 |

“用手机吧,网页是备用的” -来自某个16级临床学长的屁话。

5 |
6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 |
23 | <%+footer%> 24 | -------------------------------------------------------------------------------- /usr/lib/lua/luci/view/admin_system/flashops.htm: -------------------------------------------------------------------------------- 1 | <%# 2 | Copyright 2008 Steven Barth 3 | Copyright 2008-2015 Jo-Philipp Wich 4 | Licensed to the public under the Apache License 2.0. 5 | -%> 6 | 7 | <%+header%> 8 | 9 |

<%:Flash operations%>

10 | 11 | 15 | 16 |
17 | 18 | 19 |
20 | <%:Backup / Restore%> 21 |
<%:Click "Generate archive" to download a tar archive of the current configuration files. To reset the firmware to its initial state, click "Perform reset" (only possible with squashfs images).%>
22 |
23 | 24 | <% if reset_avail then %> 25 |
26 | 27 |
28 | 29 |
30 | 31 |
32 |
33 |
34 | <% end %> 35 |
36 | 37 |
38 |
<%:To restore configuration files, you can upload a previously generated backup archive here.%>
39 |
40 |
41 |
42 | 43 |
44 | 45 | 46 | 47 |
48 |
49 |
50 |
51 |
52 | 53 |
54 | 55 |
56 | <%:Flash new firmware image%> 57 | <% if upgrade_avail then %> 58 |
59 | 60 |
<%:Upload a sysupgrade-compatible image here to replace the running firmware. Check "Keep settings" to retain the current configuration (requires a compatible firmware image).%>
61 |
62 |
63 | 64 |
65 | 66 |
67 |
68 |
69 | 70 |
71 | 72 | 73 |
74 |
75 |
76 | <% if image_invalid then %> 77 |
<%:The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform. %>
78 | <% end %> 79 |
80 | <% else %> 81 |
<%:Sorry, there is no sysupgrade support present; a new firmware image must be flashed manually. Please refer to the wiki for device specific install instructions.%>
82 | <% end %> 83 |
84 | 85 |
86 | 87 | <%+footer%> 88 | -------------------------------------------------------------------------------- /v3.20_内科学网络大全_320.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/F-Light/WeNet-router/f7fa0eeac0b83fa6f2fa47a593563085e2f8a8ef/v3.20_内科学网络大全_320.apk -------------------------------------------------------------------------------- /www/cgi-bin/fzoff: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo Content-type: text/html 3 | echo 4 | echo "" 5 | echo "" 6 | echo "" 7 | echo "苏家屯联合大学简称苏联大学" 8 | 9 | echo "" 10 | 11 | sh /etc/dialtool 0 & 12 | echo "

关闭!


" 13 | echo "
" 14 | #echo "请不要关闭,等待联网检测..." 15 | 16 | #sleep 2 17 | #sh /www/xlxy & 18 | echo "结束" 19 | # redialnum=2 20 | 21 | # while [ "$redialnum" -ge 0 ] 22 | # do 23 | 24 | # if /bin/ping -c 1 www.qq.com 1>/dev/null 2>&1; then 25 | # #logger "ONLINE." 26 | # echo "

2、联网状态:联网成功!可以关闭该页面


" 27 | # break 28 | # else 29 | # #logger "redial." 30 | # echo "请不要关闭,联网检测中...$redialnum
" 31 | # redialnum=$(($redialnum-1)) 32 | # fi 33 | # #echo $redialnum 34 | # if [ $redialnum -eq "-1" ]; then 35 | # echo "

联网状态:联网不成功!

" 36 | # echo "

请重新开启,再次认证!" 37 | # fi 38 | 39 | # done 40 | 41 | 42 | echo "
" 43 | echo "" 44 | 45 | 46 | -------------------------------------------------------------------------------- /www/cgi-bin/fzon: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | 5 | echo Content-type: text/html 6 | echo 7 | echo "" 8 | echo "" 9 | echo "" 10 | echo "苏家屯大学" 11 | echo "" 12 | echo "MAC:$username " 13 | echo "正在验证" 14 | echo "

已经成功开启!

" 15 | echo "

WIFI重启

" 16 | sleep 1 17 | echo "
" 18 | echo "1...." 19 | sleep 1 20 | echo "
" 21 | echo "2...." 22 | sleep 3 23 | echo "
" 24 | echo "

“ wifi重启中!

" 25 | echo "
" 26 | 27 | 28 | echo "" 29 | 30 | sh /etc/dialtool 1 & -------------------------------------------------------------------------------- /www/cgi-bin/pc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo Content-type: text/html 3 | echo "" 4 | echo "" 5 | echo "" 6 | echo "苏家屯大学" 7 | echo "" 8 | echo "

正在切换

" 9 | echo "

切换完成

" 10 | echo "" 11 | sh /root/nk4conf.sh & -------------------------------------------------------------------------------- /www/cgi-bin/reon: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | echo Content-type: text/html 3 | echo "" 4 | echo "" 5 | echo "" 6 | echo "苏家屯大学" 7 | echo "" 8 | echo "

已重置

" 9 | sleep 1 10 | echo "" 11 | sh /etc/re & -------------------------------------------------------------------------------- /www/xlxy: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | wan_mac_new=$(cat /www/mac_save_new_wlan0 | awk '{print $1}') 3 | if [ ${#wan_mac_new} -lt 6 ]; then 4 | wan_mac_new=$(cat /www/mac_save_new_wlan1 | awk '{print $1}') 5 | fi 6 | username=$wan_mac_new 7 | _username=xlxy#$username 8 | echo $_username|md5sum>a.md5 9 | cat a.md5|while read tttttt 10 | do 11 | sub=${tttttt:7:6} 12 | echo "$sub" >t.txt 13 | done 14 | rm a.md5 15 | #pass=xlxylmz$(cat t.txt | awk '{print $1}') 16 | #(echo "$pass";sleep 1;echo "$pass") | passwd > /dev/null #既然都公开了,就不修改后台密码了,这个脚本文件只是根据拨号网卡的mca地址加密出一个后台密码,敛财用的。公开了就无视吧。 17 | --------------------------------------------------------------------------------