mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
add wifidog SSID修复 CPU信息显示
This commit is contained in:
parent
6665e687fc
commit
9dcde4fc39
47
package/base-files/files/bin/inform
Normal file
47
package/base-files/files/bin/inform
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
dmesg >/tmp/log/mesg && rm /tmp/log/inform
|
||||||
|
|
||||||
|
a1=`cat /proc/cpuinfo|grep -i -E 'cpu.*clock'|awk -F: '{print $2/1}'`
|
||||||
|
a2=`grep Clock /tmp/log/mesg|sed 's/^.*CPU//g'|sed 's/DDR.*//g'|awk -F'[:M]' '{print $2/1}'`
|
||||||
|
|
||||||
|
if [ ! $a1 > '0' ]; then
|
||||||
|
if [ ! $a2 > '0' ]; then
|
||||||
|
echo unknown >> /tmp/log/inform
|
||||||
|
else
|
||||||
|
echo $a2 >> /tmp/log/inform
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo $a1 >> /tmp/log/inform
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
b1=`grep 'DDR:' /tmp/log/mesg|sed 's/^.*DDR//g'|sed 's/AHB.*//g'|awk -F '[:.]' '{print $2/1}'`
|
||||||
|
b2=`grep memory.*@ /tmp/log/mesg|awk -F '[:@]' '{print $2/10000}'`
|
||||||
|
|
||||||
|
if [ ! $b1 > '0' ]; then
|
||||||
|
if [ ! $b2 > '0' ]; then
|
||||||
|
echo unknown >> /tmp/log/inform
|
||||||
|
else
|
||||||
|
echo $b2 >> /tmp/log/inform
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo $b1 >> /tmp/log/inform
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
c1=`cat /proc/cpuinfo |grep -i Flash /proc/cpuinfo | awk '{print $3/1}'`
|
||||||
|
c2=`grep -i Kbyte /tmp/log/mesg|cut -d '(' -f2|awk '{print $1/1024}'`
|
||||||
|
|
||||||
|
if [ ! $c1 > '0' ]; then
|
||||||
|
if [ ! $c2 > '0' ]; then
|
||||||
|
echo unknown >> /tmp/log/inform
|
||||||
|
else
|
||||||
|
echo $c2 >> /tmp/log/inform
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo $c1 >> /tmp/log/inform
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm /tmp/log/mesg && cat /tmp/log/inform
|
||||||
|
|
@ -45,6 +45,7 @@ boot() {
|
|||||||
|
|
||||||
/bin/config_generate
|
/bin/config_generate
|
||||||
uci_apply_defaults
|
uci_apply_defaults
|
||||||
|
/bin/inform
|
||||||
|
|
||||||
# temporary hack until configd exists
|
# temporary hack until configd exists
|
||||||
/sbin/reload_config
|
/sbin/reload_config
|
||||||
|
@ -92,6 +92,7 @@ detect_mac80211() {
|
|||||||
htmode="VHT80"
|
htmode="VHT80"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode"
|
[ -n "$htmode" ] && ht_capab="set wireless.radio${devidx}.htmode=$htmode"
|
||||||
|
|
||||||
if [ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${dev} ]; then
|
if [ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${dev} ]; then
|
||||||
@ -99,6 +100,7 @@ detect_mac80211() {
|
|||||||
else
|
else
|
||||||
path=""
|
path=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$path" ]; then
|
if [ -n "$path" ]; then
|
||||||
path="${path##/sys/devices/}"
|
path="${path##/sys/devices/}"
|
||||||
case "$path" in
|
case "$path" in
|
||||||
@ -109,6 +111,15 @@ detect_mac80211() {
|
|||||||
dev_id="set wireless.radio${devidx}.macaddr=$(cat /sys/class/ieee80211/${dev}/macaddress)"
|
dev_id="set wireless.radio${devidx}.macaddr=$(cat /sys/class/ieee80211/${dev}/macaddress)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $mode_band == "a" ]; then
|
||||||
|
ssid_5g="_5G"
|
||||||
|
else
|
||||||
|
ssid_5g="_2.4G"
|
||||||
|
fi
|
||||||
|
[ -f /lib/03_set_wifi_mac ] && ./lib/03_set_wifi_mac
|
||||||
|
Mac=`cat /sys/class/ieee80211/${dev}/macaddress|awk -F ":" '{print $4""$5""$6 }'| tr a-z A-Z`
|
||||||
|
Wifi_name="LEDE${ssid_5g}_${Mac}"
|
||||||
|
|
||||||
uci -q batch <<-EOF
|
uci -q batch <<-EOF
|
||||||
set wireless.radio${devidx}=wifi-device
|
set wireless.radio${devidx}=wifi-device
|
||||||
set wireless.radio${devidx}.type=mac80211
|
set wireless.radio${devidx}.type=mac80211
|
||||||
@ -116,12 +127,13 @@ detect_mac80211() {
|
|||||||
set wireless.radio${devidx}.hwmode=11${mode_band}
|
set wireless.radio${devidx}.hwmode=11${mode_band}
|
||||||
${dev_id}
|
${dev_id}
|
||||||
${ht_capab}
|
${ht_capab}
|
||||||
|
set wireless.radio${devidx}.noscan=1
|
||||||
|
|
||||||
set wireless.default_radio${devidx}=wifi-iface
|
set wireless.default_radio${devidx}=wifi-iface
|
||||||
set wireless.default_radio${devidx}.device=radio${devidx}
|
set wireless.default_radio${devidx}.device=radio${devidx}
|
||||||
set wireless.default_radio${devidx}.network=lan
|
set wireless.default_radio${devidx}.network=lan
|
||||||
set wireless.default_radio${devidx}.mode=ap
|
set wireless.default_radio${devidx}.mode=ap
|
||||||
set wireless.default_radio${devidx}.ssid=LEDE
|
set wireless.default_radio${devidx}.ssid=${Wifi_name}
|
||||||
set wireless.default_radio${devidx}.encryption=none
|
set wireless.default_radio${devidx}.encryption=none
|
||||||
EOF
|
EOF
|
||||||
uci -q commit wireless
|
uci -q commit wireless
|
||||||
|
66
package/lean/apfree_wifidog/Makefile
Executable file
66
package/lean/apfree_wifidog/Makefile
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=apfree_wifidog
|
||||||
|
PKG_VERSION:=2.06.1395
|
||||||
|
PKG_RELEASE=1
|
||||||
|
|
||||||
|
|
||||||
|
PKG_LICENSE:=GPL-2.0
|
||||||
|
PKG_MAINTAINER:=Dengfeng Liu<liudengfeng@kunteng.org>
|
||||||
|
PKG_LICENSE_FILES:=COPYING
|
||||||
|
|
||||||
|
PKG_SOURCE_PROTO:=git
|
||||||
|
PKG_SOURCE_URL:=https://github.com/liudf0716/apfree_wifidog.git
|
||||||
|
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||||
|
PKG_SOURCE_VERSION:=$(PKG_VERSION)
|
||||||
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||||
|
PKG_MIRROR_HASH:=dc1a052bd61c1224dda9548475c1feda9332c40fc2190ca6e4901d432379b51c
|
||||||
|
|
||||||
|
PKG_INSTALL:=1
|
||||||
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
include $(INCLUDE_DIR)/cmake.mk
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)
|
||||||
|
SUBMENU:=Captive Portals
|
||||||
|
SECTION:=net
|
||||||
|
CATEGORY:=Network
|
||||||
|
DEPENDS:=+zlib +iptables-mod-extra +iptables-mod-ipopt +kmod-ipt-nat +iptables-mod-nat-extra \
|
||||||
|
+libpthread +libopenssl +@OPENSSL_WITH_EC +@OPENSSL_WITH_DEPRECATED +@OPENSSL_WITH_PSK +libjson-c +ipset +libip4tc +libevent2 +libevent2-openssl \
|
||||||
|
+fping +libmosquitto +libuci
|
||||||
|
TITLE:=Apfree's wireless captive portal solution
|
||||||
|
URL:=http://www.kunteng.org
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/description
|
||||||
|
The ApFree Wifidog project is a complete and embeddable captive
|
||||||
|
portal solution for wireless community groups or individuals
|
||||||
|
who wish to open a free Hotspot while still preventing abuse
|
||||||
|
of their Internet connection.
|
||||||
|
It's enhanced wifidog
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/$(PKG_NAME)/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
|
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wifidog $(1)/usr/bin/
|
||||||
|
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/wdctl $(1)/usr/bin/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libhttpd.so* $(1)/usr/lib/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
|
$(INSTALL_BIN) ./files/wdping $(1)/usr/sbin/
|
||||||
|
$(INSTALL_DIR) $(1)/etc
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/wifidog-msg.html $(1)/etc/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/wifidog-redir.html $(1)/etc/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/wifidog-redir.html.front $(1)/etc/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/wifidog-redir.html.rear $(1)/etc/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/authserver-offline.html $(1)/etc/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/internet-offline.html $(1)/etc/
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/wifidog.init $(1)/etc/init.d/wifidog
|
||||||
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
|
$(CP) ./files/wifidog.conf $(1)/etc/config/wifidog
|
||||||
|
$(CP) ./files/apfree.* $(1)/etc/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,$(PKG_NAME)))
|
23
package/lean/apfree_wifidog/files/apfree.ca
Normal file
23
package/lean/apfree_wifidog/files/apfree.ca
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDvTCCAqWgAwIBAgIJAIw1/wUaVzVRMA0GCSqGSIb3DQEBCwUAMHUxCzAJBgNV
|
||||||
|
BAYTAkNOMQswCQYDVQQIDAJiajEUMBIGA1UECgwLa3VudGVuZy5vcmcxDDAKBgNV
|
||||||
|
BAsMA3ImZDEUMBIGA1UEAwwLbGl1ZGVuZ2ZlbmcxHzAdBgkqhkiG9w0BCQEWEGxp
|
||||||
|
dWRmMDcxNkBxcS5jb20wHhcNMTYxMTE3MDY0MTUyWhcNMjYxMTE1MDY0MTUyWjB1
|
||||||
|
MQswCQYDVQQGEwJDTjELMAkGA1UECAwCYmoxFDASBgNVBAoMC2t1bnRlbmcub3Jn
|
||||||
|
MQwwCgYDVQQLDANyJmQxFDASBgNVBAMMC2xpdWRlbmdmZW5nMR8wHQYJKoZIhvcN
|
||||||
|
AQkBFhBsaXVkZjA3MTZAcXEuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
|
||||||
|
CgKCAQEA6y4V4H0wwlXp3SUUsFe5rSfeH51JLW+zYMYZZA4W7kRib1VOe2CcWDxb
|
||||||
|
rAC+WXYJYcpIfvwis3KnIGhB85e4I0+WO10V/O3CIzJD2ScQbPFKLkJRgjf3uGr5
|
||||||
|
iYYXlygO/MxAPFKgUuROXovFO/+j2ZDGdG1JdP67xVSWmmrgDvRTHK7/TWIuZkq6
|
||||||
|
bMaUZtRrhIo+jJsPl2TqFPyCQiwTyEOfm1Cbb7xeIvUX/FMzHhFbJgNn2SlJ9s84
|
||||||
|
PuSUGGGWmZF9g/yQSCfSUai8UNXPbiH9yWXvIsrwm8OFLOl+d5vit5KRKGgU2I2X
|
||||||
|
cbUTfMDoO38KqcO0QWmp1vGuhWb0CQIDAQABo1AwTjAdBgNVHQ4EFgQU18zkLjCQ
|
||||||
|
cwTZlUW9QqMZG+1bbW0wHwYDVR0jBBgwFoAU18zkLjCQcwTZlUW9QqMZG+1bbW0w
|
||||||
|
DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAbJ/OzA+ZkWFJWD+nCYiS
|
||||||
|
7ElDSOcsV7EJ423OzxqvpGfuDIOmViaj+oMa4oqtwEUhga/gQT0JkXiNsezz3LCZ
|
||||||
|
3gcwSN3+ZNX1HN0REfUZ8l5ygRL+F1xMHBDWCkNCp/R/25GmzGy6bLXPcMWmqWPC
|
||||||
|
qbVEHsz/wfCWtgWwNuQFAL6xVSfse1qatJz9i9/zMOiLgiqVXpuoftcUcObCLai7
|
||||||
|
X09I1Q0gxeFMSLs0K/zTdA6eIXxFId+bYVoc/twl/yS9f+SDT9pdXIt3AthqF5Om
|
||||||
|
oSMc++egkCmCUxYv99xk6YOgOzvwvf9EBbRgQ4Xxo5PZ2zb9te54awpFU0Byb5de
|
||||||
|
jA==
|
||||||
|
-----END CERTIFICATE-----
|
82
package/lean/apfree_wifidog/files/apfree.crt
Normal file
82
package/lean/apfree_wifidog/files/apfree.crt
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
Certificate:
|
||||||
|
Data:
|
||||||
|
Version: 3 (0x2)
|
||||||
|
Serial Number: 10103261736457418066 (0x8c35ff051a573552)
|
||||||
|
Signature Algorithm: sha256WithRSAEncryption
|
||||||
|
Issuer: C=CN, ST=bj, O=kunteng.org, OU=r&d, CN=liudengfeng/emailAddress=liudf0716@qq.com
|
||||||
|
Validity
|
||||||
|
Not Before: Nov 17 06:48:49 2016 GMT
|
||||||
|
Not After : Nov 17 06:48:49 2017 GMT
|
||||||
|
Subject: C=CN, ST=BJ, L=BJ, O=KUNTENG, OU=RD, CN=APFREE
|
||||||
|
Subject Public Key Info:
|
||||||
|
Public Key Algorithm: rsaEncryption
|
||||||
|
Public-Key: (2048 bit)
|
||||||
|
Modulus:
|
||||||
|
00:d4:9a:a1:2c:ee:37:14:60:87:24:ce:98:7d:b6:
|
||||||
|
33:ab:4c:9c:fb:cf:c4:99:e5:20:4f:29:5f:59:9a:
|
||||||
|
31:3b:1f:ae:65:9f:8e:3b:de:9f:02:09:b9:e3:44:
|
||||||
|
1e:7c:e3:23:0c:d5:81:2d:6e:73:d1:e3:af:a8:5f:
|
||||||
|
ce:91:44:5a:e2:ef:cb:95:43:3f:b1:d7:3d:ee:f9:
|
||||||
|
a2:38:b8:3e:21:73:7e:93:ce:fd:41:77:ad:ad:09:
|
||||||
|
a3:96:03:ac:db:68:56:8a:93:e1:04:5c:94:11:b5:
|
||||||
|
3d:55:3d:7e:f7:85:c4:48:20:d8:42:68:7a:6c:18:
|
||||||
|
12:7b:d4:d0:f8:d4:27:fa:77:95:6b:19:cf:0e:37:
|
||||||
|
3c:e5:44:56:b1:4b:e4:30:b1:7e:91:4e:9f:f5:c2:
|
||||||
|
ff:fe:6a:8b:9a:2e:de:bd:37:a4:de:5d:9a:d0:30:
|
||||||
|
6e:ad:87:c9:b4:2a:57:81:6f:7e:44:e5:9e:a4:4c:
|
||||||
|
9a:8e:4c:1c:57:6e:b0:c5:95:4b:dd:b0:00:45:e6:
|
||||||
|
d0:d4:52:99:c2:c6:71:d7:a5:03:ee:1b:05:fe:b3:
|
||||||
|
6c:15:71:45:68:3a:60:b2:cc:e9:9d:8a:30:73:53:
|
||||||
|
8c:75:7a:da:80:f6:74:3f:19:64:af:5f:ee:75:e2:
|
||||||
|
d3:63:8e:57:62:cc:28:54:2b:16:26:03:69:a8:6a:
|
||||||
|
63:81
|
||||||
|
Exponent: 65537 (0x10001)
|
||||||
|
X509v3 extensions:
|
||||||
|
X509v3 Basic Constraints:
|
||||||
|
CA:FALSE
|
||||||
|
Netscape Comment:
|
||||||
|
OpenSSL Generated Certificate
|
||||||
|
X509v3 Subject Key Identifier:
|
||||||
|
4B:46:E7:5E:26:B0:87:DD:43:01:FE:21:6C:73:FD:8F:9B:DC:C6:1B
|
||||||
|
X509v3 Authority Key Identifier:
|
||||||
|
keyid:D7:CC:E4:2E:30:90:73:04:D9:95:45:BD:42:A3:19:1B:ED:5B:6D:6D
|
||||||
|
|
||||||
|
Signature Algorithm: sha256WithRSAEncryption
|
||||||
|
41:f6:ae:74:24:fe:f5:0d:3a:50:1c:60:0a:ba:6c:e0:7a:8c:
|
||||||
|
44:11:83:b3:13:d5:1b:90:bb:e1:0a:de:a5:41:29:f6:7c:c0:
|
||||||
|
27:f9:c5:89:2b:7f:0e:3f:20:09:0b:5a:66:ac:ef:90:8a:8f:
|
||||||
|
05:ea:89:ac:26:4a:41:23:88:9a:f7:94:48:00:31:ca:2d:12:
|
||||||
|
14:23:bc:7f:2c:ae:04:c1:87:35:8c:10:16:56:c0:95:ec:84:
|
||||||
|
80:9e:91:fa:d5:47:c2:03:fe:86:5f:47:90:60:50:a8:33:e2:
|
||||||
|
7d:7f:18:cb:ea:a8:05:d7:2d:6e:86:5f:3e:24:6f:c0:a3:22:
|
||||||
|
f6:8b:0b:29:8a:a0:b8:30:3d:33:e3:26:94:23:36:f3:45:ac:
|
||||||
|
70:e7:a5:77:0f:01:65:ed:63:c7:0a:cf:5d:11:48:29:35:ca:
|
||||||
|
5f:d2:5e:91:84:f9:69:dc:5e:64:70:44:0a:5a:a9:7c:a3:be:
|
||||||
|
60:16:09:74:69:06:93:d7:05:51:20:7c:52:7a:65:fe:70:af:
|
||||||
|
c8:50:70:de:6d:83:88:14:cb:8b:67:0d:1c:8f:74:c0:a8:c9:
|
||||||
|
1b:c2:1f:0b:f3:4f:01:cb:f8:96:c4:f1:b4:38:cf:c1:22:6c:
|
||||||
|
82:e1:a9:2d:9d:77:a1:46:04:2c:26:17:43:e2:a9:b3:5b:db:
|
||||||
|
a3:c5:f1:46
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDyjCCArKgAwIBAgIJAIw1/wUaVzVSMA0GCSqGSIb3DQEBCwUAMHUxCzAJBgNV
|
||||||
|
BAYTAkNOMQswCQYDVQQIDAJiajEUMBIGA1UECgwLa3VudGVuZy5vcmcxDDAKBgNV
|
||||||
|
BAsMA3ImZDEUMBIGA1UEAwwLbGl1ZGVuZ2ZlbmcxHzAdBgkqhkiG9w0BCQEWEGxp
|
||||||
|
dWRmMDcxNkBxcS5jb20wHhcNMTYxMTE3MDY0ODQ5WhcNMTcxMTE3MDY0ODQ5WjBX
|
||||||
|
MQswCQYDVQQGEwJDTjELMAkGA1UECAwCQkoxCzAJBgNVBAcMAkJKMRAwDgYDVQQK
|
||||||
|
DAdLVU5URU5HMQswCQYDVQQLDAJSRDEPMA0GA1UEAwwGQVBGUkVFMIIBIjANBgkq
|
||||||
|
hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1JqhLO43FGCHJM6YfbYzq0yc+8/EmeUg
|
||||||
|
TylfWZoxOx+uZZ+OO96fAgm540QefOMjDNWBLW5z0eOvqF/OkURa4u/LlUM/sdc9
|
||||||
|
7vmiOLg+IXN+k879QXetrQmjlgOs22hWipPhBFyUEbU9VT1+94XESCDYQmh6bBgS
|
||||||
|
e9TQ+NQn+neVaxnPDjc85URWsUvkMLF+kU6f9cL//mqLmi7evTek3l2a0DBurYfJ
|
||||||
|
tCpXgW9+ROWepEyajkwcV26wxZVL3bAARebQ1FKZwsZx16UD7hsF/rNsFXFFaDpg
|
||||||
|
sszpnYowc1OMdXragPZ0Pxlkr1/udeLTY45XYswoVCsWJgNpqGpjgQIDAQABo3sw
|
||||||
|
eTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBD
|
||||||
|
ZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUS0bnXiawh91DAf4hbHP9j5vcxhswHwYDVR0j
|
||||||
|
BBgwFoAU18zkLjCQcwTZlUW9QqMZG+1bbW0wDQYJKoZIhvcNAQELBQADggEBAEH2
|
||||||
|
rnQk/vUNOlAcYAq6bOB6jEQRg7MT1RuQu+EK3qVBKfZ8wCf5xYkrfw4/IAkLWmas
|
||||||
|
75CKjwXqiawmSkEjiJr3lEgAMcotEhQjvH8srgTBhzWMEBZWwJXshICekfrVR8ID
|
||||||
|
/oZfR5BgUKgz4n1/GMvqqAXXLW6GXz4kb8CjIvaLCymKoLgwPTPjJpQjNvNFrHDn
|
||||||
|
pXcPAWXtY8cKz10RSCk1yl/SXpGE+WncXmRwRApaqXyjvmAWCXRpBpPXBVEgfFJ6
|
||||||
|
Zf5wr8hQcN5tg4gUy4tnDRyPdMCoyRvCHwvzTwHL+JbE8bQ4z8EibILhqS2dd6FG
|
||||||
|
BCwmF0PiqbNb26PF8UY=
|
||||||
|
-----END CERTIFICATE-----
|
27
package/lean/apfree_wifidog/files/apfree.key
Normal file
27
package/lean/apfree_wifidog/files/apfree.key
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
|
MIIEpQIBAAKCAQEA1JqhLO43FGCHJM6YfbYzq0yc+8/EmeUgTylfWZoxOx+uZZ+O
|
||||||
|
O96fAgm540QefOMjDNWBLW5z0eOvqF/OkURa4u/LlUM/sdc97vmiOLg+IXN+k879
|
||||||
|
QXetrQmjlgOs22hWipPhBFyUEbU9VT1+94XESCDYQmh6bBgSe9TQ+NQn+neVaxnP
|
||||||
|
Djc85URWsUvkMLF+kU6f9cL//mqLmi7evTek3l2a0DBurYfJtCpXgW9+ROWepEya
|
||||||
|
jkwcV26wxZVL3bAARebQ1FKZwsZx16UD7hsF/rNsFXFFaDpgsszpnYowc1OMdXra
|
||||||
|
gPZ0Pxlkr1/udeLTY45XYswoVCsWJgNpqGpjgQIDAQABAoIBAQCBJemQxKh63WRb
|
||||||
|
DJD/lKXwghq+sOip39DvpZ9Ba/RKCSXEn9ckMUkAUO41y1SF4uiQzEWrVnRO5PP4
|
||||||
|
4TI3doGLZ8WQx4gyvSDnQYe00t8TLPiQS2X21f+PpNJVt6fSpKAlkE1Ze++KjkFS
|
||||||
|
vYeaTwz8D8+vD46GiVz5Ej9bWG1srQpauQoaweUWfqJMdBCg00g9jgNRoenQcs+1
|
||||||
|
bD7BteMHnZH3FSeFfGVgz91Ne3FvAFAMmM/xoCoasARAG3qGh9AyDW+xfgVCYy8H
|
||||||
|
d8m9K4JYpevtOP8FNUNnu98LY4KSVTkgyV+7Roxuw8CCmUvDQDVNFbTcIyYBjz2s
|
||||||
|
nFDwIniRAoGBAPINrIPPbkKZfssmop8pn2uF/FH54pfs3YS01pu4Vaai8pkRWVL0
|
||||||
|
7Vvf9RA+PJOp7TnZ+D+WMh6JqRK2tlPNRM9gVXvxZ6q68vskECLaejpJpGzSmkLs
|
||||||
|
1zok2fQoQCJkmrJGgdaTjORekThunBJC9B6U9O2J+NwYFebNq+dddRFtAoGBAODa
|
||||||
|
kpDHPoawI41cYsXXfiZAuWW4gQPtBbR2mdtjJefylWewRlFg5/ybmzfvyRyHKpUg
|
||||||
|
zL3TuWIROdPkeIQchL2dGyfXjpuc7lB0r+lE7aKv1DaZnKpOp95AU3yalp8qoz/p
|
||||||
|
fuE2RfItJG+TrFrSksYikTIfTWWhUjUw9lRYReHlAoGBAOrNpOoAUH8+kybShbJM
|
||||||
|
GB+fy9JhyxOBbKmNGxnXyQ5qx1cA41t7yLz1Fa76EJ1Vm5AhB5X3RwskkuRaZagJ
|
||||||
|
WZSpaINg/CU8UPSaWSTWNvdP9Laz3XzKb0Yx9VPJr90tJnuFtfHHFEd8DPdnJPL6
|
||||||
|
DAGWkbnTu5sVqjlIjldT63pJAoGBAJI684h+W1aCpIxhYccijuLXwvq5VAY2ljg3
|
||||||
|
zXWU9Gj1JV8Kj6CK8jQhCoAFTHhmGzZi32QwlmaFp2L7OblJRrZ9vtRZZmAjXgUq
|
||||||
|
7eA5uIXN7agYnH9RqfBrSyBE9OHMe+CrvJ1Ai5qk6wY5NqTWPyfmASFkpBQNJwZ6
|
||||||
|
sihGRCRVAoGAaHHf1jjm3zYva/Z+KGb/e3l5zCVILW8yXQ9xeb4XanyCEAu2jBm6
|
||||||
|
xRIRE+3M/S7UCEYFFpWGup96mIMmf+Ke48dl2Y6OW1wV14wK81RWtbo1EcGruINh
|
||||||
|
3kdY+7uf4QFhagz+E3cRlbDvvrG8eT3Om1/nVcfeCdknCq/dM/5aTfo=
|
||||||
|
-----END RSA PRIVATE KEY-----
|
7
package/lean/apfree_wifidog/files/wdping
Executable file
7
package/lean/apfree_wifidog/files/wdping
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
IP=$1
|
||||||
|
[ -x /usr/sbin/fping ] && {
|
||||||
|
fping -t 100 -c 1 $IP &> /dev/null && echo 1 || echo 0
|
||||||
|
} || {
|
||||||
|
ping -w 1 -c 1 $IP &> /dev/null && echo 1 || echo 0
|
||||||
|
}
|
17
package/lean/apfree_wifidog/files/wifidog.conf
Normal file
17
package/lean/apfree_wifidog/files/wifidog.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
config wifidog
|
||||||
|
option gateway_interface 'br-lan'
|
||||||
|
option auth_server_hostname 'entrance.kunteng.org'
|
||||||
|
option auth_server_port 80
|
||||||
|
option auth_server_path '/wifidog/'
|
||||||
|
option check_interval 60
|
||||||
|
option client_timeout 72000
|
||||||
|
option httpd_max_conn 200
|
||||||
|
option pool_mode 1
|
||||||
|
option thread_number 5
|
||||||
|
option queue_size 20
|
||||||
|
option wired_passed 0
|
||||||
|
|
||||||
|
config mqtt 'mqtt'
|
||||||
|
option mqtt_hostname 'wifidog.kunteng.org'
|
||||||
|
option mqtt_port '8883'
|
||||||
|
option mqtt_topic ''
|
248
package/lean/apfree_wifidog/files/wifidog.init
Normal file
248
package/lean/apfree_wifidog/files/wifidog.init
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
# Copyright (C) 2006 OpenWrt.org
|
||||||
|
START=65
|
||||||
|
|
||||||
|
USE_PROCD=1
|
||||||
|
PROG=/usr/bin/wifidog
|
||||||
|
CONFIGFILE=/tmp/wifidog.conf
|
||||||
|
|
||||||
|
EXTRA_COMMANDS="status"
|
||||||
|
EXTRA_HELP=" status Print the status of the service"
|
||||||
|
|
||||||
|
service_trigger() {
|
||||||
|
procd_add_reload_trigger "wifidog"
|
||||||
|
}
|
||||||
|
|
||||||
|
echo_firewall_rule() {
|
||||||
|
echo " FirewallRule $1"
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare_mqtt_conf() {
|
||||||
|
local cfg=$1
|
||||||
|
local serveraddr
|
||||||
|
local serverport
|
||||||
|
|
||||||
|
config_get serveraddr "$cfg" "serveraddr"
|
||||||
|
config_get serverport "$cfg" "serverport"
|
||||||
|
[ -z "$serveraddr" -o -z "$serverport" ] && return 1
|
||||||
|
|
||||||
|
cat <<-EOF >>$CONFIGFILE
|
||||||
|
|
||||||
|
MQTT {
|
||||||
|
ServerAddr $serveraddr
|
||||||
|
ServerPort $serverport
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sed -i -e '/^$/d' $CONFIGFILE
|
||||||
|
}
|
||||||
|
|
||||||
|
prepare_wifidog_conf() {
|
||||||
|
local cfg=$1
|
||||||
|
local enable
|
||||||
|
local gateway_id
|
||||||
|
local gateway_interface
|
||||||
|
local auth_server_hostname
|
||||||
|
local auth_server_http_port
|
||||||
|
local auth_server_path
|
||||||
|
local auth_server_path_login
|
||||||
|
local auth_server_path_portal
|
||||||
|
local auth_server_path_msg
|
||||||
|
local auth_server_path_ping
|
||||||
|
local auth_server_path_auth
|
||||||
|
local delta_traffic
|
||||||
|
local check_interval
|
||||||
|
local client_timeout
|
||||||
|
local httpd_max_conn
|
||||||
|
local trusted_domains
|
||||||
|
local js_filter
|
||||||
|
local trusted_maclist
|
||||||
|
local untrusted_maclist
|
||||||
|
local pool_mode
|
||||||
|
local thread_number
|
||||||
|
local queue_size
|
||||||
|
local wired_passed
|
||||||
|
local trusted_iplist
|
||||||
|
local trusted_pan_domains
|
||||||
|
local proxy_port
|
||||||
|
local no_auth
|
||||||
|
local apple_cna
|
||||||
|
local update_domain_interval
|
||||||
|
local dns_timeout
|
||||||
|
|
||||||
|
[ -f $CONFIGFILE ] && rm $CONFIGFILE
|
||||||
|
|
||||||
|
config_get enable "$cfg" "enable" 1
|
||||||
|
[ $enable = "1" ] || return
|
||||||
|
|
||||||
|
local default_gateway_id=`ifconfig br-lan|grep HWaddr|awk '{print $5}'|sed s/://g`
|
||||||
|
|
||||||
|
local external_interface=`uci show network.wan.ifname|cut -d'=' -f 2|sed -e "s/'//g"`
|
||||||
|
|
||||||
|
config_get gateway_id "$cfg" "gateway_id" $default_gateway_id
|
||||||
|
config_get gateway_interface "$cfg" "gateway_interface" "br-lan"
|
||||||
|
config_get auth_server_hostname "$cfg" "auth_server_hostname"
|
||||||
|
config_get auth_server_port "$cfg" "auth_server_port" "80"
|
||||||
|
config_get auth_server_path "$cfg" "auth_server_path" "/wifidog/"
|
||||||
|
config_get auth_server_path_login "$cfg" "auth_server_path_login"
|
||||||
|
config_get auth_server_path_portal "$cfg" "auth_server_path_portal"
|
||||||
|
config_get auth_server_path_msg "$cfg" "auth_server_path_msg"
|
||||||
|
config_get auth_server_path_ping "$cfg" "auth_server_path_ping"
|
||||||
|
config_get auth_server_path_auth "$cfg" "auth_server_path_auth"
|
||||||
|
config_get delta_traffic "$cfg" "delta_traffic"
|
||||||
|
config_get check_interval "$cfg" "check_interval" "60"
|
||||||
|
config_get js_filter "$cfg" "js_filter" 1
|
||||||
|
config_get client_timeout "$cfg" "client_timeout" "5"
|
||||||
|
config_get httpd_max_conn "$cfg" "httpd_max_conn" "200"
|
||||||
|
config_get trusted_domains "$cfg" "trusted_domains"
|
||||||
|
config_get trusted_maclist "$cfg" "trusted_maclist"
|
||||||
|
config_get untrusted_maclist "$cfg" "untrusted_maclist"
|
||||||
|
config_get pool_mode "$cfg" "pool_mode" 0
|
||||||
|
config_get thread_number "$cfg" "thread_number" 20
|
||||||
|
config_get queue_size "$cfg" "queue_size" 200
|
||||||
|
config_get wired_passed "$cfg" "wired_passed" 1
|
||||||
|
config_get trusted_iplist "$cfg" "trusted_iplist"
|
||||||
|
config_get trusted_pan_domains "$cfg" "trusted_pan_domains"
|
||||||
|
config_get proxy_port "$cfg" "proxy_port"
|
||||||
|
config_get no_auth "$cfg" "no_auth"
|
||||||
|
config_get apple_cna "$cfg" "bypass_apple_cna"
|
||||||
|
config_get update_domain_interval "$cfg" "update_domain_interval"
|
||||||
|
config_get dns_timeout "$cfg" "dns_timeout"
|
||||||
|
|
||||||
|
local set_auth_server_path_login=`[ -n "$auth_server_path_login" ] && echo " LoginScriptPathFragment $auth_server_path_login"`
|
||||||
|
local set_auth_server_path_portal=`[ -n "$auth_server_path_portal" ] && echo " PortalScriptPathFragment $auth_server_path_portal"`
|
||||||
|
local set_auth_server_path_msg=`[ -n "$auth_server_path_msg" ] && echo " MsgScriptPathFragment $auth_server_path_msg"`
|
||||||
|
local set_auth_server_path_ping=`[ -n "$auth_server_path_ping" ] && echo " PingScriptPathFragment $auth_server_path_ping"`
|
||||||
|
local set_auth_server_path_auth=`[ -n "$auth_server_path_auth" ] && echo " AuthScriptPathFragment $auth_server_path_auth"`
|
||||||
|
local set_delta_traffic=`[ -n "$delta_traffic" ] && echo "DeltaTraffic $delta_traffic"`
|
||||||
|
local set_trusted_maclist=`[ -n "$trusted_maclist" ] && echo "TrustedMACList $trusted_maclist"`
|
||||||
|
local set_untrusted_maclist=`[ -n "$untrusted_maclist" ] && echo "UntrustedMACList $untrusted_maclist"`
|
||||||
|
local set_trusted_domains=`[ -n "$trusted_domains" ] && echo "TrustedDomains $trusted_domains"`
|
||||||
|
local set_trusted_iplist=`[ -n "$trusted_iplist" ] && echo "TrustedIpList $trusted_iplist"`
|
||||||
|
local set_trusted_pan_domains=`[ -n "$trusted_pan_domains" ] && echo "TrustedPanDomains" $trusted_pan_domains`
|
||||||
|
local set_proxy_port=`[ -n "$proxy_port" ] && echo "Proxyport" $proxy_port`
|
||||||
|
local set_no_auth=`[ -n "$no_auth" ] && echo "NoAuth" $no_auth`
|
||||||
|
local set_firewall_rule_global=`config_list_foreach "$cfg" "firewall_rule_global" echo_firewall_rule`
|
||||||
|
local set_firewall_rule_validating_users=`config_list_foreach "$cfg" "firewall_rule_validating_users" echo_firewall_rule`
|
||||||
|
local set_firewall_rule_known_users=`config_list_foreach "$cfg" "firewall_rule_known_users" echo_firewall_rule`
|
||||||
|
local set_firewall_rule_auth_is_down=`config_list_foreach "$cfg" "firewall_rule_auth_is_down" echo_firewall_rule`
|
||||||
|
local set_firewall_rule_unknown_users=`config_list_foreach "$cfg" "firewall_rule_unknown_users" echo_firewall_rule`
|
||||||
|
local set_firewall_rule_locked_users=`config_list_foreach "$cfg" "firewall_rule_locked_users" echo_firewall_rule`
|
||||||
|
local set_apple_cna=`[ -n "$apple_cna" ] && echo "BypassAppleCNA" $apple_cna`
|
||||||
|
local set_update_domain_interval=`[ -n "$update_domain_interval" ] && echo "UpdateDomainInterval" $update_domain_interval`
|
||||||
|
local set_dns_timeout=`[ -n "$dns_timeout" ] && echo "DNSTimeout" $dns_timeout`
|
||||||
|
|
||||||
|
cat <<-EOF >$CONFIGFILE
|
||||||
|
GatewayID $gateway_id
|
||||||
|
GatewayInterface $gateway_interface
|
||||||
|
Externalinterface $external_interface
|
||||||
|
|
||||||
|
AuthServer {
|
||||||
|
Hostname $auth_server_hostname
|
||||||
|
HTTPPort $auth_server_port
|
||||||
|
Path $auth_server_path
|
||||||
|
$set_auth_server_path_login
|
||||||
|
$set_auth_server_path_portal
|
||||||
|
$set_auth_server_path_msg
|
||||||
|
$set_auth_server_path_ping
|
||||||
|
$set_auth_server_path_auth
|
||||||
|
}
|
||||||
|
|
||||||
|
$set_delta_traffic
|
||||||
|
CheckInterval $check_interval
|
||||||
|
ClientTimeout $client_timeout
|
||||||
|
JsFilter $js_filter
|
||||||
|
WiredPassed $wired_passed
|
||||||
|
|
||||||
|
HTTPDMaxConn $httpd_max_conn
|
||||||
|
|
||||||
|
PoolMode $pool_mode
|
||||||
|
ThreadNumber $thread_number
|
||||||
|
QueueSize $queue_size
|
||||||
|
|
||||||
|
$set_trusted_domains
|
||||||
|
|
||||||
|
$set_untrusted_maclist
|
||||||
|
|
||||||
|
$set_trusted_maclist
|
||||||
|
|
||||||
|
$set_trusted_iplist
|
||||||
|
|
||||||
|
$set_trusted_pan_domains
|
||||||
|
|
||||||
|
$set_proxy_port
|
||||||
|
|
||||||
|
$set_no_auth
|
||||||
|
|
||||||
|
$set_apple_cna
|
||||||
|
|
||||||
|
$set_update_domain_interval
|
||||||
|
|
||||||
|
$set_dns_timeout
|
||||||
|
|
||||||
|
FirewallRuleSet global {
|
||||||
|
$set_firewall_rule_global
|
||||||
|
}
|
||||||
|
|
||||||
|
FirewallRuleSet validating-users {
|
||||||
|
$set_firewall_rule_validating_users
|
||||||
|
FirewallRule allow to 0.0.0.0/0
|
||||||
|
}
|
||||||
|
|
||||||
|
FirewallRuleSet known-users {
|
||||||
|
$set_firewall_rule_known_users
|
||||||
|
FirewallRule allow to 0.0.0.0/0
|
||||||
|
}
|
||||||
|
|
||||||
|
FirewallRuleSet auth-is-down {
|
||||||
|
$set_firewall_rule_auth_is_down
|
||||||
|
}
|
||||||
|
|
||||||
|
FirewallRuleSet unknown-users {
|
||||||
|
$set_firewall_rule_unknown_users
|
||||||
|
FirewallRule allow udp port 53
|
||||||
|
FirewallRule allow tcp port 53
|
||||||
|
FirewallRule allow udp port 67
|
||||||
|
FirewallRule allow tcp port 67
|
||||||
|
}
|
||||||
|
|
||||||
|
FirewallRuleSet locked-users {
|
||||||
|
$set_firewall_rule_locked_users
|
||||||
|
FirewallRule block to 0.0.0.0/0
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
init_config() {
|
||||||
|
config_load wifidog
|
||||||
|
config_foreach prepare_wifidog_conf wifidog
|
||||||
|
|
||||||
|
[ ! -f $CONFIGFILE ] && {
|
||||||
|
echo "no wifidog.conf, exit....."
|
||||||
|
stop
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
config_foreach prepare_mqtt_conf mqtt
|
||||||
|
}
|
||||||
|
|
||||||
|
start_service() {
|
||||||
|
init_config
|
||||||
|
|
||||||
|
procd_open_instance
|
||||||
|
# -s: log to syslog
|
||||||
|
# -f: run in foreground
|
||||||
|
procd_set_param command $PROG -c $CONFIGFILE -f -d 0
|
||||||
|
procd_set_param respawn # respawn automatically if something died
|
||||||
|
procd_set_param file $CONFIGFILE
|
||||||
|
procd_close_instance
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_service() {
|
||||||
|
rc_procd start_service "$@"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
status() {
|
||||||
|
/usr/bin/wdctl status
|
||||||
|
}
|
@ -7,4 +7,23 @@ msgstr "架构"
|
|||||||
msgid "CPU Temperature"
|
msgid "CPU Temperature"
|
||||||
msgstr "CPU温度"
|
msgstr "CPU温度"
|
||||||
|
|
||||||
|
msgid "CPU Info"
|
||||||
|
msgstr "CPU信息"
|
||||||
|
|
||||||
|
msgid "CPU frequency"
|
||||||
|
msgstr "CPU频率"
|
||||||
|
|
||||||
|
msgid "RAM frequency"
|
||||||
|
msgstr "RAM频率"
|
||||||
|
|
||||||
|
msgid "Flash Size"
|
||||||
|
msgstr "闪存"
|
||||||
|
|
||||||
|
msgid "Free Memory"
|
||||||
|
msgstr "释放内存"
|
||||||
|
|
||||||
|
msgid "Core"
|
||||||
|
msgstr "核心数"
|
||||||
|
|
||||||
|
msgid "Thread"
|
||||||
|
msgstr "线程数"
|
14
package/lean/luci-app-apfree_wifidog/Makefile
Normal file
14
package/lean/luci-app-apfree_wifidog/Makefile
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2008-2014 The LuCI Team <luci@lists.subsignal.org>
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the Apache License, Version 2.0 .
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
LUCI_TITLE:=LuCI support for ApFree WifiDog
|
||||||
|
LUCI_PKGARCH:=all
|
||||||
|
|
||||||
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
||||||
|
# call BuildPackage - OpenWrt buildroot signature
|
@ -0,0 +1,64 @@
|
|||||||
|
-- Copyright (C) 2016 zhangzf@kunteng.org
|
||||||
|
-- Licensed to the public under the GNU General Public License v3.
|
||||||
|
|
||||||
|
module("luci.controller.apfree_wifidog", package.seeall)
|
||||||
|
|
||||||
|
function index()
|
||||||
|
entry({"admin", "services", "apfreeWifiDog"}, cbi("apfree_wifidog"), _("WifiDog"), 40).index = true
|
||||||
|
entry({"admin", "services", "apfreeWifiDog", "getClientList"}, call("getClientList"))
|
||||||
|
end
|
||||||
|
|
||||||
|
function getClientList()
|
||||||
|
local RespDate = {}
|
||||||
|
local RespCode = 0
|
||||||
|
local HostName, IPAddr, MacAddr, Download, Upload, LoginTime
|
||||||
|
|
||||||
|
local WdctlCMD = "wdctl status | grep -e '^ ' | sed -r 's/^ +//' 2>/dev/null"
|
||||||
|
|
||||||
|
local UpTime = luci.util.exec("wdctl status | grep Uptime | cut -d ' ' -f 2-6")
|
||||||
|
if UpTime == "" then
|
||||||
|
RespCode = 1
|
||||||
|
else
|
||||||
|
local function initDate()
|
||||||
|
HostName = "unknow"
|
||||||
|
IPAddr = ""
|
||||||
|
MacAddr = ""
|
||||||
|
Download = 0
|
||||||
|
Upload = 0
|
||||||
|
LoginTime = "0"
|
||||||
|
end
|
||||||
|
|
||||||
|
local ClientList = {}
|
||||||
|
for _, Line in pairs(luci.util.execl(WdctlCMD)) do
|
||||||
|
if Line:match('^(IP:)') == "IP:" then
|
||||||
|
IPAddr, MacAddr = Line:match('^IP: (%S+) MAC: (%S+)')
|
||||||
|
elseif Line:match('^(First Login:)') == "First Login:" then
|
||||||
|
LoginTime = Line:match('^First Login: (%d+)')
|
||||||
|
elseif Line:match('^(Name:)') == "Name:" then
|
||||||
|
HostName = Line:match('^Name: (%S+)')
|
||||||
|
elseif Line:match('^(Downloaded:)') == "Downloaded:" then
|
||||||
|
Download = Line:match('^Downloaded: (%d+)')
|
||||||
|
elseif Line:match('^(Uploaded:)') == "Uploaded:" then
|
||||||
|
Upload = Line:match('^Uploaded: (%d+)')
|
||||||
|
|
||||||
|
table.insert(ClientList, {
|
||||||
|
['hostname'] = HostName,
|
||||||
|
['ipaddr'] = IPAddr,
|
||||||
|
['macaddr'] = MacAddr,
|
||||||
|
['download'] = Download,
|
||||||
|
['upload'] = Upload,
|
||||||
|
['logintime'] = os.difftime(os.time(), tonumber(LoginTime) or 0),
|
||||||
|
})
|
||||||
|
|
||||||
|
initDate()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
RespDate["clients"] = ClientList
|
||||||
|
RespDate["uptime"] = UpTime
|
||||||
|
end
|
||||||
|
|
||||||
|
RespDate["code"] = RespCode
|
||||||
|
luci.http.prepare_content("application/json")
|
||||||
|
luci.http.write_json(RespDate)
|
||||||
|
end
|
@ -0,0 +1,101 @@
|
|||||||
|
-- Copyright (C) 2016 zhangzf@kunteng.org
|
||||||
|
-- Licensed to the public under the GNU General Public License v3.
|
||||||
|
|
||||||
|
local sys = require "luci.sys"
|
||||||
|
local opkg = require "luci.model.ipkg"
|
||||||
|
|
||||||
|
local packageName = "wifidog"
|
||||||
|
local m, s, o
|
||||||
|
|
||||||
|
local function get_status()
|
||||||
|
if luci.sys.call("pidof %s >/dev/null" %{packageName}) == 0 then
|
||||||
|
local UpTime = luci.util.exec("wdctl status | grep Uptime | cut -d ' ' -f 2-6")
|
||||||
|
local StatusUrl = "http://" .. luci.http.getenv('SERVER_NAME') .. ":2060/wifidog/status"
|
||||||
|
|
||||||
|
return translate("<span id=\"wifidog-status\" style=\"color:green;margin-left:50px\">已运行 " .. UpTime .."</span>") -- .."<a target=\"_blank\" href=" .. StatusUrl .. "> 查看更多</a>")
|
||||||
|
else
|
||||||
|
return translate("<span id=\"wifidog-status\" style=\"color:red;margin-left:50px\">WifiDog 程序未启动</span>")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if opkg.status(packageName)[packageName] then
|
||||||
|
return Map(packageName, translate("ApFree_WifiDog"), translate('<b style="color:red">Wifidog is not installed..</b>'))
|
||||||
|
end
|
||||||
|
|
||||||
|
m = Map("wifidog", translate("ApFree_WifiDog"), translate("<a target=\"_blank\" href=\"https://github.com/liudf0716/apfree_wifidog\">ApFree WiFiDog</a>" ..
|
||||||
|
"在完全兼容原版WiFiDog的基础上,在功能、性能和稳定性方面做了大量工作、改进及优化," ..
|
||||||
|
"目前在坤腾固件中广泛使用,使用ApFree WiFidog的在线路由器数量达到1万多台且还在继续增长..." ))
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "wifidog", translate("运行状态"), get_status())
|
||||||
|
s.anonymous = true
|
||||||
|
|
||||||
|
s = m:section(TypedSection, "wifidog", translate("程序配置"))
|
||||||
|
s.anonymous = true
|
||||||
|
s.addremove = false
|
||||||
|
|
||||||
|
s:tab("general", translate("基本设置"))
|
||||||
|
s:tab("policy", translate("访问控制"))
|
||||||
|
s:tab("advanced", translate("高级设置"))
|
||||||
|
|
||||||
|
-- 基本设置
|
||||||
|
Enable = s:taboption("general", Flag, "enable", translate("启用"),translate("打开或关闭认证"))
|
||||||
|
Enable.rmempty = false
|
||||||
|
Enable.default = "1"
|
||||||
|
|
||||||
|
GatewayID = s:taboption("general",Value, "gateway_id", translate("设备 ID"), translate("默认为设备MAC地址"))
|
||||||
|
GatewayID.placeholder = luci.util.exec("ifconfig br-lan| grep HWaddr | awk -F \" \" '{print $5}' | awk '$1~//{print;exit}' | sed 's/://g'")
|
||||||
|
|
||||||
|
s:taboption("general", Value, "auth_server_hostname", translate("认证服务器"), translate("认证服务器地址, 可填写域名或IP"))
|
||||||
|
|
||||||
|
ServerPort = s:taboption("general", Value, "auth_server_port", translate("服务器端口"), translate("认证服务器HTTP服务端口"))
|
||||||
|
ServerPort.datatype = "port"
|
||||||
|
|
||||||
|
s:taboption("general", Value, "auth_server_path", translate("服务器路径"), translate("服务端WEB目录,必须以'/'结尾,列'/wifidog/'"))
|
||||||
|
|
||||||
|
-- 高级设置
|
||||||
|
WiredPass = s:taboption("advanced", Flag, "wired_passed", translate("有线免认证"), translate("仅 KunTeng 固件支持"))
|
||||||
|
WiredPass.rmempty = false
|
||||||
|
|
||||||
|
PoolMode = s:taboption("advanced",Flag, "pool_mode", translate("线程池模式"),translate("是否开启线程池"))
|
||||||
|
PoolMode.rmempty = false
|
||||||
|
|
||||||
|
ThreadNumber = s:taboption("advanced", Value, "thread_number", translate("线程数"), translate("设置线程池中的最大线程数"))
|
||||||
|
ThreadNumber.datatype = "uinteger"
|
||||||
|
ThreadNumber:depends("pool_mode", "1")
|
||||||
|
ThreadNumber.default = "5"
|
||||||
|
|
||||||
|
QueueSize = s:taboption("advanced", Value, "queue_size", translate("队列大小"), translate("线程池的任务队列长度"))
|
||||||
|
QueueSizedatatype = "uinteger"
|
||||||
|
QueueSize:depends("pool_mode", "1")
|
||||||
|
QueueSize.default = "20"
|
||||||
|
|
||||||
|
GatewayInterface = s:taboption("advanced", Value, "gateway_interface", translate("内网接口"), translate("指定开启portal认证的网络接口,默认'br-lan'"))
|
||||||
|
GatewayInterface.default = "br-lan"
|
||||||
|
for _, e in ipairs(sys.net.devices()) do
|
||||||
|
if e ~= "lo" then GatewayInterface:value(e) end
|
||||||
|
end
|
||||||
|
|
||||||
|
CheckInterval = s:taboption("advanced", Value, "check_interval", translate("检查间隔"), translate("接入客户端在线检测间隔,默认60秒"))
|
||||||
|
CheckInterval.datatype = "uinteger"
|
||||||
|
CheckInterval.default = "60"
|
||||||
|
|
||||||
|
ClientTimeout = s:taboption("advanced", Value, "client_timeout", translate("超时时间"), translate("客户离线后在此时间段内重新连接不需要再次认证,默认5分"))
|
||||||
|
ClientTimeout.datatype = "uinteger"
|
||||||
|
ClientTimeout.default = "5"
|
||||||
|
|
||||||
|
MaxConnections = s:taboption("advanced", Value, "httpd_max_conn", translate("最大接入用户数"), translate("最大可同时在线的用户数"))
|
||||||
|
MaxConnections.datatype = "uinteger"
|
||||||
|
MaxConnections.default = "200"
|
||||||
|
|
||||||
|
-- 访问控制
|
||||||
|
s:taboption("policy", Value, "trusted_domains", translate("域名白名单"), translate("不用通过认证既可访问的网址,不含\"http://\", 多个URL请用 ,号隔开"))
|
||||||
|
|
||||||
|
s:taboption("policy", Value, "trusted_iplist", translate("IP白名单"), translate("不用通过认证既可连接的ip, 多个地址请用 ,号隔开"))
|
||||||
|
|
||||||
|
s:taboption("policy", Value, "trusted_maclist", translate("MAC白名单"), translate("非强制认证的用户MAC,多个MAC请用 ,号隔开"))
|
||||||
|
|
||||||
|
s:taboption("policy", Value, "untrusted_maclist", translate("MAC黑名单"), translate("禁止访问网络的MAC,多个MAC请用 ,号隔开"))
|
||||||
|
|
||||||
|
m:section(SimpleSection).template = "apfree_wifidog/client_list"
|
||||||
|
|
||||||
|
return m
|
@ -0,0 +1,83 @@
|
|||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
XHR.poll(10, '<%=luci.dispatcher.build_url("admin", "services", "apfreeWifiDog", "getClientList")%>', null,
|
||||||
|
function(x, rp)
|
||||||
|
{
|
||||||
|
var sa = document.getElementById('wifidog-status');
|
||||||
|
var tb = document.getElementById('client-list');
|
||||||
|
if (rp && tb && sa)
|
||||||
|
{
|
||||||
|
if(rp.code == "1")
|
||||||
|
{
|
||||||
|
sa.style.color = "red";
|
||||||
|
sa.innerHTML = "<%:WifiDog 程序未启动%>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rp.uptime)
|
||||||
|
{
|
||||||
|
sa.style.color = "green";
|
||||||
|
sa.innerHTML = '已运行 ' + rp.uptime;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* clear all rows */
|
||||||
|
while( tb.rows.length > 1 )
|
||||||
|
tb.deleteRow(1);
|
||||||
|
|
||||||
|
var st = rp.clients ? rp.clients : "";
|
||||||
|
for( var i = 0; i < st.length; i++ )
|
||||||
|
{
|
||||||
|
var timestr = String.format('%t', st[i].logintime);
|
||||||
|
|
||||||
|
var tr = tb.insertRow(-1);
|
||||||
|
tr.className = 'cbi-section-table-row cbi-rowstyle-' + ((i % 2) + 1);
|
||||||
|
|
||||||
|
tr.insertCell(-1).innerHTML = st[i].hostname ? st[i].hostname : '?';
|
||||||
|
tr.insertCell(-1).innerHTML = st[i].ipaddr;
|
||||||
|
tr.insertCell(-1).innerHTML = st[i].macaddr;
|
||||||
|
tr.insertCell(-1).innerHTML = bandwidth_Label(st[i].upload);
|
||||||
|
tr.insertCell(-1).innerHTML = bandwidth_Label(st[i].download);
|
||||||
|
tr.insertCell(-1).innerHTML = timestr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( tb.rows.length == 1 )
|
||||||
|
{
|
||||||
|
var tr = tb.insertRow(-1);
|
||||||
|
tr.className = 'cbi-section-table-row';
|
||||||
|
|
||||||
|
var td = tr.insertCell(-1);
|
||||||
|
td.colSpan = 6;
|
||||||
|
td.innerHTML = '<em><br /><%:没有客户端连接.%></em>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function bandwidth_Label(bytes) {
|
||||||
|
var uby = '<%:KB%>';
|
||||||
|
var kby = (bytes / 1024);
|
||||||
|
|
||||||
|
if (kby >= 1024)
|
||||||
|
{
|
||||||
|
uby = '<%:MB%>';
|
||||||
|
kby = (kby / 1024);
|
||||||
|
}
|
||||||
|
|
||||||
|
return String.format("%f %s",kby.toFixed(2), uby);
|
||||||
|
}
|
||||||
|
//]]></script>
|
||||||
|
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<legend><%:已认证客户端%></legend>
|
||||||
|
<table class="cbi-section-table" id="client-list">
|
||||||
|
<tr class="cbi-section-table-titles">
|
||||||
|
<th class="cbi-section-table-cell"><%:主机名%></th>
|
||||||
|
<th class="cbi-section-table-cell"><%:IP 地址%></th>
|
||||||
|
<th class="cbi-section-table-cell"><%:MAC 地址%></th>
|
||||||
|
<th class="cbi-section-table-cell"><%:上传%></th>
|
||||||
|
<th class="cbi-section-table-cell"><%:下载%></th>
|
||||||
|
<th class="cbi-section-table-cell"><%:在线时长%></th>
|
||||||
|
</tr>
|
||||||
|
<tr class="cbi-section-table-row">
|
||||||
|
<td colspan="6"><em><br /><%:Collecting data...%></em></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
11
package/lean/luci-app-apfree_wifidog/root/etc/uci-defaults/90_luci_wifidog
Executable file
11
package/lean/luci-app-apfree_wifidog/root/etc/uci-defaults/90_luci_wifidog
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
uci -q batch <<-EOF >/dev/null
|
||||||
|
delete ucitrack.@wifidog[-1]
|
||||||
|
add ucitrack wifidog
|
||||||
|
set ucitrack.@wifidog[-1].init=wifidog
|
||||||
|
commit ucitrack
|
||||||
|
EOF
|
||||||
|
|
||||||
|
rm -f /tmp/luci-indexcache
|
||||||
|
exit 0
|
@ -8,14 +8,15 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=libevent2
|
PKG_NAME:=libevent2
|
||||||
PKG_VERSION:=2.0.22
|
PKG_VERSION:=2.1.8
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_BUILD_DIR:=$(BUILD_DIR)/libevent-$(PKG_VERSION)-stable
|
PKG_SOURCE_PROTO:=git
|
||||||
|
PKG_SOURCE_URL=https://github.com/libevent/libevent.git
|
||||||
|
PKG_SOURCE_VERSION:=release-2.1.8-stable
|
||||||
|
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
|
||||||
PKG_SOURCE:=libevent-$(PKG_VERSION)-stable.tar.gz
|
PKG_SOURCE:=libevent-$(PKG_VERSION)-stable.tar.gz
|
||||||
PKG_SOURCE_URL:=@SF/levent
|
PKG_MAINTAINER:=Dengfeng Liu <liudengfeng@kunteng.org>
|
||||||
PKG_HASH:=71c2c49f0adadacfdbe6332a372c38cf9c8b7895bb73dabeaa53cdcc1d4e1fa3
|
|
||||||
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
|
|
||||||
PKG_LICENSE:=BSD-3-Clause
|
PKG_LICENSE:=BSD-3-Clause
|
||||||
|
|
||||||
PKG_FIXUP:=autoreconf
|
PKG_FIXUP:=autoreconf
|
||||||
@ -29,6 +30,7 @@ define Package/libevent2/Default
|
|||||||
CATEGORY:=Libraries
|
CATEGORY:=Libraries
|
||||||
TITLE:=Event notification
|
TITLE:=Event notification
|
||||||
URL:=http://www.monkey.org/~provos/libevent/
|
URL:=http://www.monkey.org/~provos/libevent/
|
||||||
|
DEPENDS+=+libopenssl
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libevent2/Default/description
|
define Package/libevent2/Default/description
|
||||||
@ -82,7 +84,6 @@ endef
|
|||||||
define Package/libevent2-openssl
|
define Package/libevent2-openssl
|
||||||
$(call Package/libevent2/Default)
|
$(call Package/libevent2/Default)
|
||||||
TITLE+= OpenSSL library (version 2.0)
|
TITLE+= OpenSSL library (version 2.0)
|
||||||
DEPENDS+=+libopenssl
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libevent2-openssl/description
|
define Package/libevent2-openssl/description
|
||||||
@ -120,34 +121,34 @@ define Build/InstallDev
|
|||||||
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
|
$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent*.{la,a,so} $(1)/usr/lib/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent*.{la,a,so} $(1)/usr/lib/
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent*-2.0.so* $(1)/usr/lib/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent*-2.1.so* $(1)/usr/lib/
|
||||||
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libevent*.pc $(1)/usr/lib/pkgconfig/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libevent*.pc $(1)/usr/lib/pkgconfig/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libevent2/install
|
define Package/libevent2/install
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent-2.0.so.* $(1)/usr/lib/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent-2.1.so.* $(1)/usr/lib/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libevent2-core/install
|
define Package/libevent2-core/install
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_core-2.0.so.* $(1)/usr/lib/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_core-2.1.so.* $(1)/usr/lib/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libevent2-extra/install
|
define Package/libevent2-extra/install
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_extra-2.0.so.* $(1)/usr/lib/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_extra-2.1.so.* $(1)/usr/lib/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libevent2-openssl/install
|
define Package/libevent2-openssl/install
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_openssl-2.0.so.* $(1)/usr/lib/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_openssl-2.1.so.* $(1)/usr/lib/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/libevent2-pthreads/install
|
define Package/libevent2-pthreads/install
|
||||||
$(INSTALL_DIR) $(1)/usr/lib
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_pthreads-2.0.so.* $(1)/usr/lib/
|
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevent_pthreads-2.1.so.* $(1)/usr/lib/
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,libevent2))
|
$(eval $(call BuildPackage,libevent2))
|
||||||
|
@ -746,7 +746,7 @@ define Device/tl-wr710n-v2.1
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Device/tl-wr720n-v3
|
define Device/tl-wr720n-v3
|
||||||
$(Device/tplink-8mlzma)
|
$(Device/tplink-16mlzma)
|
||||||
DEVICE_TITLE := TP-LINK TL-WR720N v3
|
DEVICE_TITLE := TP-LINK TL-WR720N v3
|
||||||
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
|
DEVICE_PACKAGES := kmod-usb-core kmod-usb2
|
||||||
BOARDNAME := TL-WR720N-v3
|
BOARDNAME := TL-WR720N-v3
|
||||||
@ -976,7 +976,7 @@ define Device/tl-wr842n-v1
|
|||||||
endef
|
endef
|
||||||
|
|
||||||
define Device/tl-wr842n-v2
|
define Device/tl-wr842n-v2
|
||||||
$(Device/tplink-8mlzma)
|
$(Device/tplink-16mlzma)
|
||||||
DEVICE_TITLE := TP-LINK TL-WR842N/ND v2
|
DEVICE_TITLE := TP-LINK TL-WR842N/ND v2
|
||||||
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
|
DEVICE_PACKAGES := kmod-usb-core kmod-usb2 kmod-usb-ledtrig-usbport
|
||||||
BOARDNAME := TL-WR842N-v2
|
BOARDNAME := TL-WR842N-v2
|
||||||
|
Loading…
Reference in New Issue
Block a user