Merge Mainline

This commit is contained in:
CN_SZTL 2020-10-30 23:58:20 +08:00
commit 85ae6bf98f
No known key found for this signature in database
GPG Key ID: 6850B6345C862176
28 changed files with 3098 additions and 2444 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-openclash
PKG_VERSION:=0.40.13
PKG_VERSION:=0.40.14
PKG_RELEASE:=beta
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>

View File

@ -1085,6 +1085,19 @@ do_run_file()
}
#绑定interface防止回环
check_interface_name()
{
interface_name=$(ip route |grep "default" |awk '{print $5}' 2>/dev/null)
if [ -z "$(grep "^interface-name: $interface_name" "$CONFIG_FILE" 2>/dev/null)" ] && [ -n "$interface_name" ]; then
if [ ! -z "$(grep "^ \{0,\}interface-name:" "$CONFIG_FILE" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}interface-name:/c\interface-name: ${interface_name}" "$CONFIG_FILE" 2>/dev/null
else
sed -i "/^redir-port:/a\interface-name: ${interface_name}" "$CONFIG_FILE" 2>/dev/null
fi
fi
}
start_run_core()
{
echo "$core_start_log" >$START_LOG
@ -1092,6 +1105,7 @@ start_run_core()
ulimit -SHn 65535 2>/dev/null
ulimit -v unlimited 2>/dev/null
modprobe tun >/dev/null 2>&1
check_interface_name
config_reload=$(uci get openclash.config.config_reload 2>/dev/null)
if [ -n "$(pidof clash)" ] && [ "$core_type" != "Tun" ] && [ "$config_reload" != "0" ]; then
curl -s --connect-timeout 5 -m 5 -H 'Content-Type: application/json' -H "Authorization: Bearer ${da_password}" -XPUT http://"$lan_ip":"$cn_port"/configs -d "{\"path\": \"$CONFIG_FILE\"}" 2>/dev/null
@ -1193,6 +1207,7 @@ raw_config_start()
cn_port=$(grep "^ \{0,\}external-controller:" "$CONFIG_FILE" |awk -F ':' '{print $3}' |awk -F '#' '{print $1}' |tr -cd "[0-9]" 2>/dev/null)
uci set openclash.config.dashboard_password="$cn_port" 2>/dev/null
uci set openclash.config.proxy_port="$proxy_port"
uci set openclash.config.restricted_mode=1
uci commit openclash

View File

@ -73,10 +73,16 @@ music.migu.cn
#QQ快捷登录
localhost.ptlogin2.qq.com
#Nintendo Switch
*.*.*.*.srv.nintendo.net
+.srv.nintendo.net
#Sony PlayStation
*.*.*.stun.playstation.net
+.stun.playstation.net
#Microsoft Xbox
xbox.*.microsoft.com
*.*.*.xboxlive.com
proxy.golang.org
+.xboxlive.com
proxy.golang.org
stun.*.*
stun.*.*.*
#Linksys Router
heartbeat.belkin.com
*.linksys.com
*.linksyssmartwifi.com

View File

@ -1,19 +1,19 @@
{
"files": {
"main.css": "./static/css/main.83e4b341.chunk.css",
"main.js": "./static/js/main.33688145.chunk.js",
"main.js": "./static/js/main.3ba71f82.chunk.js",
"runtime-main.js": "./static/js/runtime-main.fefd5bb9.js",
"static/js/2.4c19c7e9.chunk.js": "./static/js/2.4c19c7e9.chunk.js",
"static/js/2.6366a4a0.chunk.js": "./static/js/2.6366a4a0.chunk.js",
"index.html": "./index.html",
"service-worker.js": "./service-worker.js",
"static/js/2.4c19c7e9.chunk.js.LICENSE.txt": "./static/js/2.4c19c7e9.chunk.js.LICENSE.txt",
"static/js/2.6366a4a0.chunk.js.LICENSE.txt": "./static/js/2.6366a4a0.chunk.js.LICENSE.txt",
"static/media/logo.45983944.png": "./static/media/logo.45983944.png",
"workbox-8a532145.js": "./workbox-8a532145.js"
},
"entrypoints": [
"static/js/runtime-main.fefd5bb9.js",
"static/js/2.4c19c7e9.chunk.js",
"static/js/2.6366a4a0.chunk.js",
"static/css/main.83e4b341.chunk.css",
"static/js/main.33688145.chunk.js"
"static/js/main.3ba71f82.chunk.js"
]
}

View File

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"/><meta name="description" content="Clash web port"/><title>Clash</title><link href="./static/css/main.83e4b341.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,l=r[0],f=r[1],i=r[2],p=0,s=[];p<l.length;p++)a=l[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(c&&c(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var f=t[l];0!==o[f]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="./";var l=this["webpackJsonpclash-dashboard"]=this["webpackJsonpclash-dashboard"]||[],f=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var c=f;t()}([])</script><script src="./static/js/2.4c19c7e9.chunk.js"></script><script src="./static/js/main.33688145.chunk.js"></script></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"/><meta name="description" content="Clash web port"/><title>Clash</title><link href="./static/css/main.83e4b341.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,a,l=r[0],f=r[1],i=r[2],p=0,s=[];p<l.length;p++)a=l[p],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&s.push(o[a][0]),o[a]=0;for(n in f)Object.prototype.hasOwnProperty.call(f,n)&&(e[n]=f[n]);for(c&&c(r);s.length;)s.shift()();return u.push.apply(u,i||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,l=1;l<t.length;l++){var f=t[l];0!==o[f]&&(n=!1)}n&&(u.splice(r--,1),e=a(a.s=t[0]))}return e}var n={},o={1:0},u=[];function a(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,a),t.l=!0,t.exports}a.m=e,a.c=n,a.d=function(e,r,t){a.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,r){if(1&r&&(e=a(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)a.d(t,n,function(r){return e[r]}.bind(null,n));return t},a.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(r,"a",r),r},a.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},a.p="./";var l=this["webpackJsonpclash-dashboard"]=this["webpackJsonpclash-dashboard"]||[],f=l.push.bind(l);l.push=r,l=l.slice();for(var i=0;i<l.length;i++)r(l[i]);var c=f;t()}([])</script><script src="./static/js/2.6366a4a0.chunk.js"></script><script src="./static/js/main.3ba71f82.chunk.js"></script></body></html>

View File

@ -1 +1 @@
if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let s=Promise.resolve();return r[e]||(s=new Promise(async s=>{if("document"in self){const r=document.createElement("script");r.src=e,document.head.appendChild(r),r.onload=s}else importScripts(e),s()})),s.then(()=>{if(!r[e])throw new Error(`Module ${e} didnt register its module`);return r[e]})},s=(s,r)=>{Promise.all(s.map(e)).then(e=>r(1===e.length?e[0]:e))},r={require:Promise.resolve(s)};self.define=(s,i,c)=>{r[s]||(r[s]=Promise.resolve().then(()=>{let r={};const t={uri:location.origin+s.slice(1)};return Promise.all(i.map(s=>{switch(s){case"exports":return r;case"module":return t;default:return e(s)}})).then(e=>{const s=c(...e);return r.default||(r.default=s),r})}))}}define("./service-worker.js",["./workbox-8a532145"],(function(e){"use strict";self.addEventListener("message",e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()}),e.clientsClaim(),e.precacheAndRoute([{url:"./index.html",revision:"b1a27ccef352baebb9667369555f9309"},{url:"./static/css/main.83e4b341.chunk.css",revision:"5a48466e5ff2a8ceec3348c3c498c260"},{url:"./static/js/2.4c19c7e9.chunk.js",revision:"d46b87667ddd715dd648d1ef8779c0b7"},{url:"./static/js/2.4c19c7e9.chunk.js.LICENSE.txt",revision:"176c1a1a28b19c611d9701905d8d60b7"},{url:"./static/js/main.33688145.chunk.js",revision:"62d6fab15c25a50205f635111e4e9e01"},{url:"./static/js/runtime-main.fefd5bb9.js",revision:"98f4f314ef9abb714a6c74c41e1e5a04"},{url:"./static/media/logo.45983944.png",revision:"198a55c9efe85ab0145d4402c07cfe65"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("./index.html"),{denylist:[/^\/_/,/\/[^/?]+\.[^/]+$/]}))}));
if(!self.define){const e=e=>{"require"!==e&&(e+=".js");let s=Promise.resolve();return r[e]||(s=new Promise(async s=>{if("document"in self){const r=document.createElement("script");r.src=e,document.head.appendChild(r),r.onload=s}else importScripts(e),s()})),s.then(()=>{if(!r[e])throw new Error(`Module ${e} didnt register its module`);return r[e]})},s=(s,r)=>{Promise.all(s.map(e)).then(e=>r(1===e.length?e[0]:e))},r={require:Promise.resolve(s)};self.define=(s,i,t)=>{r[s]||(r[s]=Promise.resolve().then(()=>{let r={};const c={uri:location.origin+s.slice(1)};return Promise.all(i.map(s=>{switch(s){case"exports":return r;case"module":return c;default:return e(s)}})).then(e=>{const s=t(...e);return r.default||(r.default=s),r})}))}}define("./service-worker.js",["./workbox-8a532145"],(function(e){"use strict";self.addEventListener("message",e=>{e.data&&"SKIP_WAITING"===e.data.type&&self.skipWaiting()}),e.clientsClaim(),e.precacheAndRoute([{url:"./index.html",revision:"ff336a0edf18fc90c7f03fb0e43250a0"},{url:"./static/css/main.83e4b341.chunk.css",revision:"5a48466e5ff2a8ceec3348c3c498c260"},{url:"./static/js/2.6366a4a0.chunk.js",revision:"7a8970333d728cf369978e1fa658787e"},{url:"./static/js/2.6366a4a0.chunk.js.LICENSE.txt",revision:"6557abd439259b9580e2e2d5633cdacb"},{url:"./static/js/main.3ba71f82.chunk.js",revision:"2c4d6d7f7a1d7c843c445be62f92109f"},{url:"./static/js/runtime-main.fefd5bb9.js",revision:"98f4f314ef9abb714a6c74c41e1e5a04"},{url:"./static/media/logo.45983944.png",revision:"198a55c9efe85ab0145d4402c07cfe65"}],{}),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("./index.html"),{denylist:[/^\/_/,/\/[^/?]+\.[^/]+$/]}))}));

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@ object-assign
http://jedwatson.github.io/classnames
*/
/** @license React v0.19.1
/** @license React v0.20.1
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
@ -28,7 +28,7 @@ object-assign
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
/** @license React v17.0.1
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
@ -37,7 +37,7 @@ object-assign
* LICENSE file in the root directory of this source tree.
*/
/** @license React v16.13.1
/** @license React v17.0.1
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,20 +17,20 @@ START_LOG="/tmp/openclash_start.log"
fi
fi
if [ -z "$(grep "^ enhanced-mode: $2" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}enhanced-mode:" "$7")" ]; then
sed -i "/^ \{0,\}enhanced-mode:/c\ enhanced-mode: ${2}" "$7"
if [ -z "$(grep "^ enhanced-mode: $2" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}enhanced-mode:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}enhanced-mode:/c\ enhanced-mode: ${2}" "$7" 2>/dev/null
else
sed -i "/^dns:/a\ enhanced-mode: ${2}" "$7"
sed -i "/^dns:/a\ enhanced-mode: ${2}" "$7" 2>/dev/null
fi
fi
if [ "$2" = "fake-ip" ]; then
if [ -z "$(grep "^ \{0,\}fake-ip-range: 198.18.0.1/16" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}fake-ip-range:" "$7")" ]; then
sed -i "/^ \{0,\}fake-ip-range:/c\ fake-ip-range: 198.18.0.1/16" "$7"
if [ -z "$(grep "^ \{0,\}fake-ip-range: 198.18.0.1/16" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}fake-ip-range:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}fake-ip-range:/c\ fake-ip-range: 198.18.0.1/16" "$7" 2>/dev/null
else
sed -i "/^ \{0,\}enhanced-mode:/a\ fake-ip-range: 198.18.0.1/16" "$7"
sed -i "/^ \{0,\}enhanced-mode:/a\ fake-ip-range: 198.18.0.1/16" "$7" 2>/dev/null
fi
fi
else
@ -40,43 +40,43 @@ START_LOG="/tmp/openclash_start.log"
sed -i '/##Custom DNS##/d' "$7" 2>/dev/null
if [ -z "$(grep "^redir-port: $6" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}redir-port:" "$7")" ]; then
sed -i "/^ \{0,\}redir-port:/c\redir-port: ${6}" "$7"
if [ -z "$(grep "^redir-port: $6" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}redir-port:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}redir-port:/c\redir-port: ${6}" "$7" 2>/dev/null
else
sed -i "/^dns:/i\redir-port: ${6}" "$7"
sed -i "/^dns:/i\redir-port: ${6}" "$7" 2>/dev/null
fi
fi
if [ -z "$(grep "^port: $9" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}port:" "$7")" ]; then
sed -i "/^ \{0,\}port:/c\port: ${9}" "$7"
if [ -z "$(grep "^port: $9" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}port:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}port:/c\port: ${9}" "$7" 2>/dev/null
else
sed -i "/^dns:/i\port: ${9}" "$7"
sed -i "/^dns:/i\port: ${9}" "$7" 2>/dev/null
fi
fi
if [ -z "$(grep "^socks-port: $10" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}socks-port:" "$7")" ]; then
sed -i "/^ \{0,\}socks-port:/c\socks-port: ${10}" "$7"
if [ -z "$(grep "^socks-port: $10" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}socks-port:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}socks-port:/c\socks-port: ${10}" "$7" 2>/dev/null
else
sed -i "/^dns:/i\socks-port: ${10}" "$7"
sed -i "/^dns:/i\socks-port: ${10}" "$7" 2>/dev/null
fi
fi
if [ -z "$(grep "^mode: $13" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}mode:" "$7")" ]; then
sed -i "/^ \{0,\}mode:/c\mode: ${13}" "$7"
if [ -z "$(grep "^mode: $13" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}mode:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}mode:/c\mode: ${13}" "$7" 2>/dev/null
else
sed -i "/^dns:/i\mode: ${13}" "$7"
sed -i "/^dns:/i\mode: ${13}" "$7" 2>/dev/null
fi
fi
if [ -z "$(grep "^log-level: $12" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}log-level:" "$7")" ]; then
sed -i "/^ \{0,\}log-level:/c\log-level: ${12}" "$7"
if [ -z "$(grep "^log-level: $12" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}log-level:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}log-level:/c\log-level: ${12}" "$7" 2>/dev/null
else
sed -i "/^dns:/i\log-level: ${12}" "$7"
sed -i "/^dns:/i\log-level: ${12}" "$7" 2>/dev/null
fi
fi
@ -94,58 +94,58 @@ START_LOG="/tmp/openclash_start.log"
sleep 3
fi
if [ -z "$(grep "^external-controller: $controller_address:$5" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}external-controller:" "$7")" ]; then
sed -i "/^ \{0,\}external-controller:/c\external-controller: ${controller_address}:${5}" "$7"
if [ -z "$(grep "^external-controller: $controller_address:$5" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}external-controller:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}external-controller:/c\external-controller: ${controller_address}:${5}" "$7" 2>/dev/null
else
sed -i "/^dns:/i\external-controller: ${controller_address}:${5}" "$7"
sed -i "/^dns:/i\external-controller: ${controller_address}:${5}" "$7" 2>/dev/null
fi
uci set openclash.config.config_reload=0
fi
if [ -z "$(grep "^secret: \"$4\"" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}secret:" "$7")" ]; then
sed -i "/^ \{0,\}secret:/c\secret: \"${4}\"" "$7"
if [ -z "$(grep "^secret: \"$4\"" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}secret:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}secret:/c\secret: \"${4}\"" "$7" 2>/dev/null
else
sed -i "/^dns:/i\secret: \"${4}\"" "$7"
sed -i "/^dns:/i\secret: \"${4}\"" "$7" 2>/dev/null
fi
uci set openclash.config.config_reload=0
fi
if [ -z "$(grep "^ \{0,\}device-url:" "$7")" ] && [ "$15" -eq 2 ]; then
if [ -z "$(grep "^ \{0,\}device-url:" "$7" 2>/dev/null)" ] && [ "$15" -eq 2 ]; then
uci set openclash.config.config_reload=0
elif [ -z "$(grep "^ \{0,\}tun:" "$7")" ] && [ -n "$15" ]; then
elif [ -z "$(grep "^ \{0,\}tun:" "$7" 2>/dev/null)" ] && [ -n "$15" ]; then
uci set openclash.config.config_reload=0
elif [ -n "$(grep "^ \{0,\}tun:" "$7")" ] && [ -z "$15" ]; then
elif [ -n "$(grep "^ \{0,\}tun:" "$7" 2>/dev/null)" ] && [ -z "$15" ]; then
uci set openclash.config.config_reload=0
elif [ -n "$(grep "^ \{0,\}device-url:" "$7")" ] && [ "$15" -eq 1 ]; then
elif [ -n "$(grep "^ \{0,\}device-url:" "$7" 2>/dev/null)" ] && [ "$15" -eq 1 ]; then
uci set openclash.config.config_reload=0
elif [ -n "$(grep "^ \{0,\}device-url:" "$7")" ] && [ "$15" -eq 3 ]; then
elif [ -n "$(grep "^ \{0,\}device-url:" "$7" 2>/dev/null)" ] && [ "$15" -eq 3 ]; then
uci set openclash.config.config_reload=0
fi
uci commit openclash
if [ -z "$(grep "^ enable: true" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}enable:" "$7")" ]; then
sed -i "/^ \{0,\}enable:/c\ enable: true" "$7"
if [ -z "$(grep "^ enable: true" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}enable:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}enable:/c\ enable: true" "$7" 2>/dev/null
else
sed -i "/^dns:/a\ enable: true" "$7"
sed -i "/^dns:/a\ enable: true" "$7" 2>/dev/null
fi
fi
if [ -z "$(grep "^allow-lan: true" "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}allow-lan:" "$7")" ]; then
sed -i "/^ \{0,\}allow-lan:/c\allow-lan: true" "$7"
if [ -z "$(grep "^allow-lan: true" "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}allow-lan:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}allow-lan:/c\allow-lan: true" "$7" 2>/dev/null
else
sed -i "/^dns:/i\allow-lan: true" "$7"
sed -i "/^dns:/i\allow-lan: true" "$7" 2>/dev/null
fi
fi
sed -i '/bind-address:/d' "$7" 2>/dev/null
sed -i "/^allow-lan:/a\bind-address: \"${bind_address}\"" "$7"
sed -i "/^allow-lan:/a\bind-address: \"${bind_address}\"" "$7" 2>/dev/null
if [ -n "$(grep "^ \{0,\}listen:" "$7")" ]; then
if [ -n "$(grep "^ \{0,\}listen:" "$7" 2>/dev/null)" ]; then
if [ "$8" != "1" ]; then
sed -i "/^ \{0,\}listen:/c\ listen: 127.0.0.1:${17}" "$7" 2>/dev/null
else
@ -159,60 +159,60 @@ START_LOG="/tmp/openclash_start.log"
fi
fi 2>/dev/null
if [ -z "$(grep '^external-ui: "/usr/share/openclash/dashboard"' "$7")" ]; then
if [ ! -z "$(grep "^ \{0,\}external-ui:" "$7")" ]; then
sed -i '/^ \{0,\}external-ui:/c\external-ui: "/usr/share/openclash/dashboard"' "$7"
if [ -z "$(grep '^external-ui: "/usr/share/openclash/dashboard"' "$7" 2>/dev/null)" ]; then
if [ ! -z "$(grep "^ \{0,\}external-ui:" "$7" 2>/dev/null)" ]; then
sed -i '/^ \{0,\}external-ui:/c\external-ui: "/usr/share/openclash/dashboard"' "$7" 2>/dev/null
else
sed -i '/^dns:/i\external-ui: "/usr/share/openclash/dashboard"' "$7"
sed -i '/^dns:/i\external-ui: "/usr/share/openclash/dashboard"' "$7" 2>/dev/null
fi
fi
if [ "$8" -eq 1 ]; then
sed -i '/^ \{0,\}ipv6:/d' "$7" 2>/dev/null
sed -i "/^ \{0,\}enable: true/a\ ipv6: true" "$7"
sed -i "/^ \{0,\}mode:/i\ipv6: true" "$7"
sed -i "/^ \{0,\}enable: true/a\ ipv6: true" "$7" 2>/dev/null
sed -i "/^ \{0,\}mode:/i\ipv6: true" "$7" 2>/dev/null
else
sed -i '/^ \{0,\}ipv6:/d' "$7" 2>/dev/null
sed -i "/^ \{0,\}enable: true/a\ ipv6: false" "$7"
sed -i "/^ \{0,\}mode:/i\ipv6: false" "$7"
sed -i '/^ \{0,\}ipv6:/d' "$7" 2>/dev/null 2>/dev/null
sed -i "/^ \{0,\}enable: true/a\ ipv6: false" "$7" 2>/dev/null
sed -i "/^ \{0,\}mode:/i\ipv6: false" "$7" 2>/dev/null
fi
#TUN
if [ "$15" -eq 1 ] || [ "$15" -eq 3 ]; then
sed -i "/^dns:/i\tun:" "$7"
sed -i "/^dns:/i\ enable: true" "$7"
sed -i "/^dns:/i\tun:" "$7" 2>/dev/null
sed -i "/^dns:/i\ enable: true" "$7" 2>/dev/null
if [ -n "$16" ]; then
sed -i "/^dns:/i\ stack: ${16}" "$7"
sed -i "/^dns:/i\ stack: ${16}" "$7" 2>/dev/null
else
sed -i "/^dns:/i\ stack: system" "$7"
sed -i "/^dns:/i\ stack: system" "$7" 2>/dev/null
fi
sed -i "/^dns:/i\ dns-hijack:" "$7"
sed -i "/^dns:/i\ dns-hijack:" "$7" 2>/dev/null
# sed -i "/^dns:/i\ - 8.8.8.8:53" "$7"
sed -i "/^dns:/i\ - tcp://8.8.8.8:53" "$7"
sed -i "/^dns:/i\ - tcp://8.8.8.8:53" "$7" 2>/dev/null
# sed -i "/^dns:/i\ - 8.8.4.4:53" "$7"
sed -i "/^dns:/i\ - tcp://8.8.4.4:53" "$7"
sed -i "/^dns:/i\ - tcp://8.8.4.4:53" "$7" 2>/dev/null
elif [ "$15" -eq 2 ]; then
sed -i "/^dns:/i\tun:" "$7"
sed -i "/^dns:/i\ enable: true" "$7"
sed -i "/^dns:/i\ device-url: dev://clash0" "$7"
sed -i "/^dns:/i\ dns-listen: 0.0.0.0:53" "$7"
sed -i "/^dns:/i\tun:" "$7" 2>/dev/null
sed -i "/^dns:/i\ enable: true" "$7" 2>/dev/null
sed -i "/^dns:/i\ device-url: dev://clash0" "$7" 2>/dev/null
sed -i "/^dns:/i\ dns-listen: 0.0.0.0:53" "$7" 2>/dev/null
fi
#添加自定义Hosts设置
if [ "$2" = "redir-host" ]; then
if [ -z "$(grep "^ \{0,\}hosts:" $7)" ]; then
if [ -z "$(grep "^ \{0,\}hosts:" "$7" 2>/dev/null)" ]; then
sed -i '/^dns:/i\hosts:' "$7" 2>/dev/null
else
if [ ! -z "$(grep "^ \{1,\}hosts:" $7)" ]; then
sed -i "/^ \{0,\}hosts:/c\hosts:" "$7"
if [ ! -z "$(grep "^ \{1,\}hosts:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}hosts:/c\hosts:" "$7" 2>/dev/null
fi
fi
if [ -z "$(grep "^ \{0,\}use-hosts:" $7)" ]; then
sed -i "/^dns:/a\ use-hosts: true" "$7"
if [ -z "$(grep "^ \{0,\}use-hosts:" "$7" 2>/dev/null)" ]; then
sed -i "/^dns:/a\ use-hosts: true" "$7" 2>/dev/null
else
if [ ! -z "$(grep "^ \{0,\}use-hosts:" $7)" ]; then
sed -i "/^ \{0,\}use-hosts:/c\ use-hosts: true" "$7"
if [ ! -z "$(grep "^ \{0,\}use-hosts:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}use-hosts:/c\ use-hosts: true" "$7" 2>/dev/null
fi
fi
sed -i '/^hosts:/a\##Custom HOSTS END##' "$7" 2>/dev/null
@ -221,15 +221,15 @@ START_LOG="/tmp/openclash_start.log"
sed -i "/^hosts:/,/^dns:/ {s/^ \{0,\}'/ '/}" "$7" 2>/dev/null #修改参数空格
fi
if [ ! -z "$(grep "^ \{0,\}default-nameserver:" "$7")" ]; then
sed -i "/^ \{0,\}default-nameserver:/c\ default-nameserver:" "$7"
if [ ! -z "$(grep "^ \{0,\}default-nameserver:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}default-nameserver:/c\ default-nameserver:" "$7" 2>/dev/null
sed -i "/^ \{0,\}default-nameserver:/,/,$/ {s/^ \{0,\}- / - /g}" "$7" 2>/dev/null #修改参数空格
fi
#fake-ip-filter
sed -i '/##Custom fake-ip-filter##/,/##Custom fake-ip-filter END##/d' "$7" 2>/dev/null
if [ "$2" = "fake-ip" ]; then
if [ ! -f "/etc/openclash/fake_filter.list" ] || [ ! -z "$(grep "config servers" /etc/config/openclash)" ]; then
if [ ! -f "/etc/openclash/fake_filter.list" ] || [ ! -z "$(grep "config servers" /etc/config/openclash 2>/dev/null)" ]; then
/usr/share/openclash/openclash_fake_filter.sh
fi
if [ -s "/etc/openclash/servers_fake_filter.conf" ]; then
@ -237,8 +237,8 @@ START_LOG="/tmp/openclash_start.log"
ln -s /etc/openclash/servers_fake_filter.conf /tmp/dnsmasq.d/dnsmasq_openclash.conf
fi
if [ -s "/etc/openclash/fake_filter.list" ]; then
if [ ! -z "$(grep "^ \{0,\}fake-ip-filter:" "$7")" ]; then
sed -i "/^ \{0,\}fake-ip-filter:/c\ fake-ip-filter:" "$7"
if [ ! -z "$(grep "^ \{0,\}fake-ip-filter:" "$7" 2>/dev/null)" ]; then
sed -i "/^ \{0,\}fake-ip-filter:/c\ fake-ip-filter:" "$7" 2>/dev/null
sed -i '/^ \{0,\}fake-ip-filter:/r/etc/openclash/fake_filter.list' "$7" 2>/dev/null
sed -i "/^ \{0,\}fake-ip-filter:/,/,$/ {s/^ \{0,\}- / - /g}" "$7" 2>/dev/null #修改参数空格
else

View File

@ -214,10 +214,9 @@ function get_client_usage(){
[ "$client_usage" -ne "1" ] && return
[ -z "$client_usage_max" ] && return
[ -z "$get_client_usage_time" ] && get_client_usage_time=`date +%s`
( echo ${client_usage_max: -1}|grep -q "K\|k" ) && client_usage_max=`expr ${client_usage_max%?} \* 1024`
( echo ${client_usage_max: -1}|grep -q "M\|m" ) && client_usage_max=`expr ${client_usage_max%?} \* 1048576`
( echo ${client_usage_max: -1}|grep -q "G\|g" ) && client_usage_max=`expr ${client_usage_max%?} \* 1073741824`
( echo $client_usage_max|sed -r 's/.*(.)$/\1/'|grep -q "K\|k" ) && client_usage_max=`expr ${client_usage_max%?} \* 1024`
( echo $client_usage_max|sed -r 's/.*(.)$/\1/'|grep -q "M\|m" ) && client_usage_max=`expr ${client_usage_max%?} \* 1048576`
( echo $client_usage_max|sed -r 's/.*(.)$/\1/'|grep -q "G\|g" ) && client_usage_max=`expr ${client_usage_max%?} \* 1073741824`
[ "$client_usage_disturb" -eq "0" ] || [ -z "$client_usage_disturb" ] && [ -f "${dir}ipAddress" ] && local MACLIST=`cat ${dir}ipAddress|awk '{print $2}'|grep -v "^$"|sort -u`
[ ! -z "$client_usage_disturb" ] && [ "$client_usage_disturb" -eq "1" ] && [ ! -z "$client_usage_whitelist" ] && local MACLIST=`echo "$client_usage_whitelist"`
[ -z "$MACLIST" ] && return
@ -282,8 +281,8 @@ function time_for_humans {
# 计算字符真实长度
function length_str {
[ ! "$1" ] && return
local length_zh=`echo "$1"|awk '{print gensub(/[\u4e00-\u9fa5]/,"","g",$0)}'|awk -F "" '{print NF}'`
local length_en=`echo "$1"|awk '{print gensub(/[^\u4e00-\u9fa5]/,"","g",$0)}'|awk -F "" '{print NF}'`
local length_zh=`echo "$1"|awk '{print gensub(/[\u4e00-\u9FA5A-Za-z0-9_]/,"","g",$0)}'|awk -F "" '{print NF}'`
local length_en=`echo "$1"|awk '{print gensub(/[^\u4e00-\u9FA5A-Za-z0-9_]/,"","g",$0)}'|awk -F "" '{print NF}'`
echo `expr $length_zh / 3 \* 2 + $length_en`
}
@ -291,12 +290,16 @@ function length_str {
function cut_str {
[ ! "$1" ] && return
[ ! "$2" ] && return
[ `length_str $1` -le "$2" ] && echo "$1" && return
local temp_length=$2
while [ $(printf "%d" \'`echo "$1"|cut -c $temp_length`) -ge "128" ] && [ $(printf "%d" \'`echo "$1"|cut -c $temp_length`) -lt "224" ] ; do
while [ $(length_str `echo "$1"|cut -c -$temp_length`) -lt "$2" ]; do
temp_length=`expr $temp_length + 1`
done
while [ $(printf "%d" \'`echo "$1"|cut -c $temp_length`) -ge "128" ] && [ $(printf "%d" \'`echo "$1"|cut -c $temp_length`) -lt "224" ]; do
temp_length=`expr $temp_length + 1`
done
temp_length=`expr $temp_length - 1`
echo "$1"|cut -c -$temp_length
echo $(echo "$1"|cut -c -$temp_length)"*"
}
# 在线设备列表
@ -311,7 +314,7 @@ function serverchan_first(){
done
wait
unset ip IPLIST
local IPLIST=`cat /proc/net/arp|grep "0x2\|0x6"|awk '{print $1}'|grep -v "^$"|sort -u`
local IPLIST=`cat /proc/net/arp|grep "0x2\|0x6"|awk '{print $1}'|grep -v "^169.254."|grep -v "^$"|sort -u`
for ip in $IPLIST; do
read -u 5
{
@ -654,7 +657,7 @@ function up(){
cat ${dir}tmp_downlist|grep -w ${1}|grep -v "^$"|sort -u >> ${dir}ipAddress
sed -i "/$1/d" ${dir}tmp_downlist
else
usage down $1
usage down $ip_mac
local ip_name=`getname ${1} ${ip_mac}`
blackwhitelist ${ip_mac};local ip_blackwhite=$?
echo "$1 ${ip_mac} ${ip_name} `date +%s` ${ip_interface}" >> ${dir}ipAddress
@ -663,13 +666,13 @@ function up(){
[ -f "${dir}content" ] && local content=`cat ${dir}content`
if [ -z "$title" ]; then
local title="$ip_name 连接了你的路由器"
local content="${markdown_splitline}#### 新设备连接${markdown_linefeed}${markdown_tab}客户端名:${markdown_space}${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_name}${markdown_linefeed}${markdown_tab}客户端IP ${markdown_space}${markdown_space}${markdown_space}${markdown_space}${1}${markdown_linefeed}${markdown_tab}客户端MAC${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_mac}"
local content="${markdown_splitline}#### 新设备连接${markdown_linefeed}${markdown_tab}客户端名:${markdown_space}${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_name}${markdown_linefeed}${markdown_tab}客户端IP ${markdown_space}${markdown_space}${markdown_space}${markdown_space}${1}${markdown_linefeed}${markdown_tab}客户端MAC${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_mac}${markdown_linefeed}${markdown_tab}网络接口:${markdown_space}${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_interface}"
elif ( echo ${title}|grep -q "连接了你的路由器" ); then
local title="${ip_name} ${title}"
local content="${markdown_splitline}${markdown_tab}客户端名:${markdown_space}${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_name}${markdown_linefeed}${markdown_tab}客户端IP ${markdown_space}${markdown_space}${markdown_space}${markdown_space}${1}${markdown_linefeed}${markdown_tab}客户端MAC${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_mac}"
local content="${markdown_splitline}${markdown_tab}客户端名:${markdown_space}${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_name}${markdown_linefeed}${markdown_tab}客户端IP ${markdown_space}${markdown_space}${markdown_space}${markdown_space}${1}${markdown_linefeed}${markdown_tab}客户端MAC${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_mac}${markdown_linefeed}${markdown_tab}网络接口:${markdown_space}${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_interface}"
else
local title="设备状态变化"
local content="${markdown_splitline}#### 新设备连接${markdown_linefeed}${markdown_tab}客户端名:${markdown_space}${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_name}${markdown_linefeed}${markdown_tab}客户端IP ${markdown_space}${markdown_space}${markdown_space}${markdown_space}${1}${markdown_linefeed}${markdown_tab}客户端MAC${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_mac}"
local content="${markdown_splitline}#### 新设备连接${markdown_linefeed}${markdown_tab}客户端名:${markdown_space}${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_name}${markdown_linefeed}${markdown_tab}客户端IP ${markdown_space}${markdown_space}${markdown_space}${markdown_space}${1}${markdown_linefeed}${markdown_tab}客户端MAC${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_mac}${markdown_linefeed}${markdown_tab}网络接口:${markdown_space}${markdown_space}${markdown_space}${markdown_space}${markdown_space}${ip_interface}"
fi
echo "`date "+%Y-%m-%d %H:%M:%S"` ${disturb_text}新设备 ${ip_name} ${1} 连接了">> ${logfile}
[ ! -z "$serverchan_blacklist" ] && local title="你偷偷关注的设备上线了"
@ -741,7 +744,7 @@ function current_device(){
local ip_mac=`getmac ${ip}`
local ip_total=`usage get ${ip_mac}`
local ip_name=`getname ${ip} ${ip_mac}`
[ `length_str "$ip_name"` -gt "15" ] && local ip_name=`cut_str $ip_name 15`"*"
local ip_name=`cut_str $ip_name 15`
if [ "${#ip}" -lt "15" ]; then
local n=`expr 15 - ${#ip}`
for i in `seq 1 $n`; do
@ -879,7 +882,7 @@ function send(){
local ip_mac=`getmac ${ip}`
local ip_name=`getname ${ip} ${ip_mac}`
local ip_total=`usage get ${ip_mac}`;[ ! -z "$ip_total" ] && local ip_total="总计流量:${ip_total} "
[ `length_str "$ip_name"` -gt "18" ] && local ip_name=`cut_str $ip_name 18`"*"
local ip_name=`cut_str $ip_name 18`
local send_content="${send_content}${markdown_linefeed}${markdown_tab}【${ip_name}】 ${ip}${markdown_linefeed}${markdown_tab}${ip_total}在线 ${time1}"
unset ip_total time_down time_up time1 ip_mac ip_name
done
@ -973,3 +976,4 @@ while [ "$serverchan_enable" -eq "1" ]; do
done
sleep $sleeptime
done

View File

@ -342,6 +342,11 @@ o:depends('transport', 'kcp')
o.default = 2
o.rmempty = true
o = s:option(Value, 'seed', translate('Seed'))
o.depends('transport', 'kcp')
o.default = ''
o.rmempty = true
o = s:option(Flag, 'congestion', translate('Congestion'))
o:depends('transport', 'kcp')
o.rmempty = true

View File

@ -280,6 +280,9 @@
try {
el('.kcp_guise').value = ssm.type;
} catch (err) { }
try {
el('.seed').value = ssm.seed;
} catch (err) { }
}
if (ssm.tls == "tls") {
try {

View File

@ -197,7 +197,8 @@ function gen_outbound(server_node, tags, local_ports)
congestion = (server.congestion == '1') and true or false,
readBufferSize = tonumber(server.read_buffer_size),
writeBufferSize = tonumber(server.write_buffer_size),
header = {type = server.kcp_guise}
header = {type = server.kcp_guise},
seed = server.seed
} or
nil,
wsSettings = (server.transport == 'ws') and (server.ws_path ~= nil or server.ws_host ~= nil) and

View File

@ -264,7 +264,11 @@ local function processData(szType, content)
result.alias = '[' .. content.airport .. '] ' .. content.remarks
end
if not result.alias then
result.alias = result.server .. ':' .. result.server_port
if result.server and result.server_port then
result.alias = result.server .. ':' .. result.server_port
else
result.alias = "NULL"
end
end
-- alias 不参与 hashkey 计算
local alias = result.alias

View File

@ -8,8 +8,8 @@ include $(TOPDIR)/rules.mk
LUCI_TITLE:=Edge Theme
LUCI_DEPENDS:=
PKG_VERSION:=2.1
PKG_RELEASE:=20200914
PKG_VERSION:=2.2
PKG_RELEASE:=20201029
include $(TOPDIR)/feeds/luci/luci.mk

File diff suppressed because one or more lines are too long

View File

@ -42,15 +42,6 @@
local c = tree
local i, r
function glob(...)
local iter, code, msg = fs.glob(...)
if iter then
return nutil.consume(iter)
else
return nil, code, msg
end
end
-- tag all nodes leading to this page
for i, r in ipairs(request) do
if c.nodes and c.nodes[r] then
@ -189,8 +180,6 @@
end
math.randomseed(os.time())
local bgTable = glob("/www/luci-static/argon/img/*")
local bgcount = table.getn(bgTable)
-%>
<!DOCTYPE html>
<html lang="<%=luci.i18n.context.lang%>">

View File

@ -41,16 +41,7 @@
local c = tree
local i, r
function glob(...)
local iter, code, msg = fs.glob(...)
if iter then
return nutil.consume(iter)
else
return nil, code, msg
end
end
-- tag all nodes leading to this page
for i, r in ipairs(request) do
if c.nodes and c.nodes[r] then
@ -188,9 +179,7 @@
end
end
math.randomseed(os.time())
local bgTable = glob("/www/luci-static/argon/img/*")
local bgcount = table.getn(bgTable)
math.randomseed(os.time())
-%>
<!DOCTYPE html>
<html lang="<%=luci.i18n.context.lang%>">
@ -233,22 +222,5 @@
<body
class="<%- if node then %><%= striptags( node.title ) %><%- end %> <% if luci.dispatcher.context.authsession then %>logged-in<% end %> lang_<%=luci.i18n.context.lang%> ">
<!--[if lt IE 9]>
<style>
.chromeframe{
padding:2rem 3rem;
margin:0 auto;
font-size:14px;
color:#fff;
position:relative;
z-index:9999;
text-align:center;
}
.chromeframe a{
color:orangered;
}
</style>
<p class="chromeframe">您使用的IE浏览器版本过低,
<a href="https://www.microsoft.com/edge/" target="_blank" class="textToLink one-pan-link-mark"> 升级 </a>您的IE浏览器<br/>
或使用<a href="http://www.google.com/chromeframe/?redirect=true"> Chrome </a>, <a href="https://www.mozilla.org/zh-CN/firefox/new/"> Firefox </a>等高级浏览器,将会得到更好的体验!</a></p>
<![endif]-->
<p class="chromeframe">您使用的浏览器过于老旧,
请使用<a href="https://www.microsoft.com/zh-cn/edge"> Edge </a>, <a href="https://www.mozilla.org/zh-CN/firefox/new/"> Firefox </a>等高级浏览器.</a></p>

File diff suppressed because one or more lines are too long

View File

@ -40,11 +40,13 @@ sed -i 's|root:x:0:0:root:/root:/bin/ash|root:x:0:0:root:/root:/bin/bash|g' /etc
sed -i '/option disabled/d' /etc/config/wireless
sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
# NEVER DROP THE EXISTING AUTHORS INFO | 禁止删除现有作者信息
sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release
echo "DISTRIB_REVISION='| Mod20.10 by CTCGFW'" >> /etc/openwrt_release
sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release
echo "DISTRIB_DESCRIPTION='OpenWrt 18.06 by Lean '" >> /etc/openwrt_release
# NEVER DROP THE EXISTING AUTHORS INFO | 禁止删除现有作者信息
sed -i 's/LuCI openwrt-18.06 branch/LuCI 18.06 by Lean/g' /usr/lib/lua/luci/version.lua
sed -i '/luciversion/d' /usr/lib/lua/luci/version.lua
echo 'luciversion = "Mod20.10 by CTCGFW"' >> /usr/lib/lua/luci/version.lua

View File

@ -7,13 +7,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=AdGuardHome
PKG_VERSION:=0.103.3
PKG_VERSION:=0.104.0
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=v$(PKG_VERSION)
PKG_SOURCE_URL:=https://github.com/AdguardTeam/AdGuardHome
PKG_MIRROR_HASH:=11ffc493604c10c6c22c973bc69e5697738c12b05219dd123597cadfd174d2af
PKG_MIRROR_HASH:=852861f83c3788a3913cb953b2eb0e2a94c27e2e158feae8c7485480c1481257
PKG_LICENSE:=GPL-3.0-only
PKG_LICENSE_FILES:=LICENSE.txt
@ -59,7 +59,7 @@ endef
ifeq ($(CONFIG_ADGUARDHOME_COMPRESS_GOPROXY),y)
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
export GOPROXY=https://goproxy.io
endif
define Build/Compile

View File

@ -0,0 +1,51 @@
From a3e650911f5e6f67dcff09974df3775dfd615da6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20=C5=A0tetiar?= <ynezz@true.cz>
Date: Sat, 3 Oct 2020 01:29:21 +0200
Subject: [PATCH] file: uci_parse_package: fix heap use after free
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes following issue which is caused by usage of pointer which pointed
to a reallocated address:
ERROR: AddressSanitizer: heap-use-after-free on address 0x619000000087 at pc 0x000000509aa7 bp 0x7ffd6b9c3c40 sp 0x7ffd6b9c3400
READ of size 2 at 0x619000000087 thread T0
#0 0x509aa6 in strdup (test-fuzz+0x509aa6)
#1 0x7fc36d2a1636 in uci_strdup util.c:60:8
#2 0x7fc36d29e1ac in uci_alloc_generic list.c:55:13
#3 0x7fc36d29e241 in uci_alloc_package list.c:253:6
#4 0x7fc36d2a0ba3 in uci_switch_config file.c:375:18
#5 0x7fc36d2a09b8 in uci_parse_package file.c:397:2
#6 0x7fc36d2a09b8 in uci_parse_line file.c:513:6
#7 0x7fc36d2a09b8 in uci_import file.c:681:4
0x619000000087 is located 7 bytes inside of 1024-byte region [0x619000000080,0x619000000480)
freed by thread T0 here:
#0 0x51daa9 in realloc (test-fuzz+0x51daa9)
#1 0x7fc36d2a1612 in uci_realloc util.c:49:8
previously allocated by thread T0 here:
#0 0x51daa9 in realloc (test-fuzz+0x51daa9)
#1 0x7fc36d2a1612 in uci_realloc util.c:49:8
Reported-by: Jeremy Galindo <jgalindo@datto.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
file.c | 2 +-
...sig-06,src-000079,time-22005942,op-ext_AO,pos-8 | Bin 0 -> 56 bytes
2 files changed, 1 insertion(+), 1 deletion(-)
create mode 100644 tests/fuzz/corpus/id-000000,sig-06,src-000079,time-22005942,op-ext_AO,pos-8
--- a/file.c
+++ b/file.c
@@ -387,8 +387,8 @@ static void uci_parse_package(struct uci
pctx->pos += strlen(pctx_cur_str(pctx)) + 1;
ofs_name = next_arg(ctx, true, true, true);
- name = pctx_str(pctx, ofs_name);
assert_eol(ctx);
+ name = pctx_str(pctx, ofs_name);
if (single)
return;

View File

@ -0,0 +1,112 @@
From eae126f66663e5c73e5d290b8e3134449489340f Mon Sep 17 00:00:00 2001
From: Hauke Mehrtens <hauke@hauke-m.de>
Date: Sun, 4 Oct 2020 17:14:49 +0200
Subject: [PATCH] file: Check buffer size after strtok()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fixes a heap overflow in the parsing of the uci line.
The line which is parsed and put into pctx->buf is null terminated and
stored on the heap. In the uci_parse_line() function we use strtok() to
split this string in multiple parts after divided by a space or tab.
strtok() replaces these characters with a NULL byte. If the next byte is
NULL we assume that this NULL byte was added by strtok() and try to
parse the string after this NULL byte. If this NULL byte was not added
by strtok(), but by fgets() to mark the end of the string we would read
over this end of the string in uninitialized memory and later over the
allocated buffer.
Fix this problem by storing how long the line we read was and check if
we would read over the end of the string here.
This also adds the input which detected this crash to the corpus of the
fuzzer.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
[fixed merge conflict in tests]
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
file.c | 19 ++++++++++++++++---
tests/cram/test-san_uci_import.t | 1 +
tests/cram/test_uci_import.t | 1 +
.../2e18ecc3a759dedc9357b1298e9269eccc5c5a6b | 1 +
uci_internal.h | 1 +
5 files changed, 20 insertions(+), 3 deletions(-)
create mode 100644 tests/fuzz/corpus/2e18ecc3a759dedc9357b1298e9269eccc5c5a6b
--- a/file.c
+++ b/file.c
@@ -28,6 +28,7 @@
#include <glob.h>
#include <string.h>
#include <stdlib.h>
+#include <errno.h>
#include "uci.h"
#include "uci_internal.h"
@@ -63,6 +64,7 @@ __private void uci_getln(struct uci_cont
return;
ofs += strlen(p);
+ pctx->buf_filled = ofs;
if (pctx->buf[ofs - 1] == '\n') {
pctx->line++;
return;
@@ -120,6 +122,15 @@ static inline void addc(struct uci_conte
*pos_src += 1;
}
+static int uci_increase_pos(struct uci_parse_context *pctx, size_t add)
+{
+ if (pctx->pos + add > pctx->buf_filled)
+ return -EINVAL;
+
+ pctx->pos += add;
+ return 0;
+}
+
/*
* parse a double quoted string argument from the command line
*/
@@ -384,7 +395,8 @@ static void uci_parse_package(struct uci
char *name;
/* command string null-terminated by strtok */
- pctx->pos += strlen(pctx_cur_str(pctx)) + 1;
+ if (uci_increase_pos(pctx, strlen(pctx_cur_str(pctx)) + 1))
+ uci_parse_error(ctx, "package without name");
ofs_name = next_arg(ctx, true, true, true);
assert_eol(ctx);
@@ -416,7 +428,8 @@ static void uci_parse_config(struct uci_
}
/* command string null-terminated by strtok */
- pctx->pos += strlen(pctx_cur_str(pctx)) + 1;
+ if (uci_increase_pos(pctx, strlen(pctx_cur_str(pctx)) + 1))
+ uci_parse_error(ctx, "config without name");
ofs_type = next_arg(ctx, true, false, false);
type = pctx_str(pctx, ofs_type);
@@ -466,7 +479,8 @@ static void uci_parse_option(struct uci_
uci_parse_error(ctx, "option/list command found before the first section");
/* command string null-terminated by strtok */
- pctx->pos += strlen(pctx_cur_str(pctx)) + 1;
+ if (uci_increase_pos(pctx, strlen(pctx_cur_str(pctx)) + 1))
+ uci_parse_error(ctx, "option without name");
ofs_name = next_arg(ctx, true, true, false);
ofs_value = next_arg(ctx, false, false, false);
--- a/uci_internal.h
+++ b/uci_internal.h
@@ -33,6 +33,7 @@ struct uci_parse_context
const char *name;
char *buf;
int bufsz;
+ size_t buf_filled;
int pos;
};
#define pctx_pos(pctx) ((pctx)->pos)