<% -- LuCI by libc0607 (libc0607@gmail.com) -- 华工路由群:262939451 local sys = require "luci.sys" local fs = require "nixio.fs" local uci = require "luci.model.uci".cursor() local ntm = require "luci.model.network".init() local scutclient_version = luci.sys.exec("opkg list-installed scutclient | cut -d ' ' -f 3") local scutclient_status = {} scutclient_status.enable = uci:get_first("scutclient", "option", "enable") scutclient_status.username = uci:get_first("scutclient", "scutclient", "username") scutclient_status.password = uci:get_first("scutclient", "scutclient", "password") scutclient_status.hostname = uci:get_first("scutclient", "drcom", "hostname") scutclient_status.version = uci:get_first("scutclient", "drcom", "version") scutclient_status.hash = uci:get_first("scutclient", "drcom", "hash") scutclient_status.server_auth_ip = uci:get_first("scutclient", "drcom", "server_auth_ip") local mode_links = {} mode_links.base = luci.dispatcher.build_url("admin/scutclient/status") mode_links.redial = mode_links.base.."?redial=1" mode_links.logoff = mode_links.base.."?logoff=1" mode_links.move_tag = mode_links.base .."?move_tag=1" local stat, wan_nets = pcall(ntm.get_wan_networks, ntm) local wan, wandev if stat then if #wan_nets > 0 then wan = wan_nets[1] wandev = wan:get_interface() end else wan = ntm:get_wannet() wandev = ntm:get_wandev() end function page_moved() return (uci:get_first("scutclient", "luci", "mainorder", 10) == 10) end function get_client_status(exec_name) return (os.execute("pidof scutclient > /dev/null 2>/dev/null") == 0) end function get_wifi_switch() return (string.sub(luci.sys.exec("wifi status|grep up|head -n 1|awk {'print $2'}"), 1, 4) == "true") and true or false end %> <%+header%>

客户端状态

状态
<% if get_client_status("scutclient") then %> <% else %> <% end %> <% if get_wifi_switch() then -%> <% else %> <% end %> <% if wan then %> <% else %> <% end %>
scutclient正在运行没有运行
Wi-Fi SSID : <%=luci.sys.exec("uci get wireless.@wifi-iface[0].ssid")%>Wi-Fi 状态: 未开启,或路由器没有无线网卡
WAN口 <%=wandev:name()%>
IP地址 <%=wan:ipaddr()%>
子网掩码 <%=wan:netmask()%>
网关 <%=wan:gwaddr()%>
DNS <%=table.concat(wan:dnsaddrs(), ",")%>
MAC <%=wandev:mac()%>
网络状态 获取中……
WAN口未正确配置
客户端设置
<% if string.len(scutclient_version) > 1 then %> <% else %> <% end %> <% if scutclient_status.username == "root" then %> <% else %> <% end %>
功能 下线 重拨 <% if page_moved() then %> 我不想每次打开都见到这个界面把它移走 <% end %>
已安装版本: <%=scutclient_version%>scutclient未安装
开机启动 <%=scutclient_status.enable%>
账号<%=scutclient_status.username%>。。。你的浏览器开启了自动保存帐号密码?<%=scutclient_status.username%>
密码 <%=scutclient_status.password%>
主机名 <%=scutclient_status.hostname%>
Drcom版本 <%=scutclient_status.version%>
Hash <%=scutclient_status.hash%>
服务器IP <%=scutclient_status.server_auth_ip%>
<%+footer%>