-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.增加防护系统 ASD 进程误删可执行程序及数据文件机制。 2.解决去国际 (Github) 站点查询软件最新版本和在线升级 安装过程中遇到的 DNS 污染问题。 3.更新运营商 IP 地址数据文件。
- Loading branch information
Showing
19 changed files
with
316 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# install.sh v4.6.5 | ||
# install.sh v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
|
||
# LZ RULE script for Asuswrt-Merlin Router | ||
|
@@ -11,7 +11,9 @@ | |
|
||
#BEGIN | ||
|
||
LZ_VERSION=v4.6.5 | ||
# shellcheck disable=SC2317 # Don't warn about unreachable commands in this function | ||
|
||
LZ_VERSION=v4.6.6 | ||
TIMEOUT=10 | ||
CURRENT_PATH="${0%/*}" | ||
[ "${CURRENT_PATH:0:1}" != '/' ] && CURRENT_PATH="$( pwd )${CURRENT_PATH#*.}" | ||
|
@@ -153,6 +155,34 @@ PATH_IMAGES="${PATH_LZ}/images" | |
PATH_INTERFACE="${PATH_LZ}/interface" | ||
PATH_DATA="${PATH_LZ}/data" | ||
PATH_TMP="${PATH_LZ}/tmp" | ||
ASD_BIN="/root" | ||
[ -n "${HOME}" ] && ASD_BIN="$( readlink -f "${HOME}" )" | ||
[ -d "/koolshare/bin" ] && ASD_BIN="/koolshare/bin" | ||
|
||
fuck_asd_process() { | ||
[ -z "$( which asd )" ] && return | ||
fuck_asd() { | ||
echo "#!/bin/sh | ||
while true; do | ||
sleep 2147483647 | ||
done | ||
" > "${ASD_BIN}/asd" | ||
[ ! -f "${ASD_BIN}/asd" ] && return 1 | ||
chmod +x "${ASD_BIN}/asd" | ||
killall asd > /dev/null 2>&1 && mount -o bind -o async "${ASD_BIN}/asd" "$( which asd )" > /dev/null 2>&1 | ||
return 0 | ||
} | ||
eval "$( mount | awk -v count=0 '$3 == "'"$( which asd )"'" { | ||
count++; | ||
if (count > 1) | ||
print "usleep 250000; killall asd > /dev/null 2>&1 && umount -f "$3" > /dev/null 2>&1"; | ||
} END { | ||
if (count == 0) | ||
print "fuck_asd"; | ||
}' )" | ||
} | ||
|
||
fuck_asd_process | ||
|
||
mkdir -p "${PATH_CONFIGS}" > /dev/null 2>&1 | ||
mkdir -p "${PATH_FUNC}" > /dev/null 2>&1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# lz_rule_config.sh v4.6.5 | ||
# lz_rule_config.sh v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
|
||
# 本软件采用CIDR(无类别域间路由,Classless Inter-Domain Routing)技术,是一个在Internet上创建附加地 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# lz_clear_custom_scripts_data.sh v4.6.5 | ||
# lz_clear_custom_scripts_data.sh v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
|
||
## 清除用户自定义脚本数据 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# lz_define_global_variables.sh v4.6.5 | ||
# lz_define_global_variables.sh v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
# QnkgTFog5aaZ5aaZ5ZGc77yI6Juk6J+G5aKp5YS/77yJ(首次运行标识,切勿修改) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# lz_initialize_config.sh v4.6.5 | ||
# lz_initialize_config.sh v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
|
||
## 初始化脚本配置 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# lz_rule_address_query.sh v4.6.5 | ||
# lz_rule_address_query.sh v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
|
||
## 网址信息查询脚本 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# lz_rule_func.sh v4.6.5 | ||
# lz_rule_func.sh v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
|
||
#BEGIN | ||
|
@@ -1892,13 +1892,13 @@ fi | |
UPDATE_ISPIP_DATA_A | ||
if [ "${drop_sys_caches}" = "0" ]; then | ||
cat >> "${PATH_LZ}/${UPDATE_FILENAME}" <<UPDATE_ISPIP_DATA_B | ||
cat >> "${PATH_LZ}/${UPDATE_FILENAME}" <<UPDATE_ISPIP_DATA_B | ||
{ [ -f /proc/sys/vm/drop_caches ] && sync && echo 3 > /proc/sys/vm/drop_caches && echo -e "\$(lzdate) [\$\$]:\\n\$(lzdate) [\$\$]: LZ ${LZ_VERSION} Free Memory OK\\n\$(lzdate) [\$\$]:"; } | tee -ai "${SYSLOG}" 2> /dev/null | ||
#END | ||
UPDATE_ISPIP_DATA_B | ||
else | ||
cat >> "${PATH_LZ}/${UPDATE_FILENAME}" <<UPDATE_ISPIP_DATA_C | ||
cat >> "${PATH_LZ}/${UPDATE_FILENAME}" <<UPDATE_ISPIP_DATA_C | ||
echo \$(lzdate) [\$\$]: | tee -ai "${SYSLOG}" 2> /dev/null | ||
#END | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# lz_rule_status.sh v4.6.5 | ||
# lz_rule_status.sh v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
|
||
## 显示脚本运行状态脚本 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# lz_vpn_daemon.sh v4.6.5 | ||
# lz_vpn_daemon.sh v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
|
||
## 虚拟专网客户端路由刷新处理后台守护进程脚本 | ||
|
@@ -10,7 +10,7 @@ | |
#BEGIN | ||
|
||
## 版本号 | ||
LZ_VERSION=v4.6.5 | ||
LZ_VERSION=v4.6.6 | ||
|
||
## 项目接口文件部署路径 | ||
PATH_INTERFACE="${0%/*}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#!/bin/sh | ||
# lz_rule_service.sh v4.6.5 | ||
# lz_rule_service.sh v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
|
||
## 服务接口脚本 | ||
|
@@ -34,12 +34,68 @@ get_repo_site() { | |
echo "${remoteRepo}" | ||
} | ||
|
||
get_pre_dns() { | ||
local preDNS="8.8.8.8" | ||
local configFile="${PATH_LZ}/configs/lz_rule_config.box" | ||
[ ! -s "${configFile}" ] && configFile="${PATH_LZ}/configs/lz_rule_config.sh" | ||
eval "$( awk -F "=" '$0 ~ /^[[:space:]]*(lz_config_)?pre_dns[=]/ && $2 ~ /^(|\")([0-9]+[\.]){3}[0-9]+(|\")$/ { | ||
key=$1; | ||
gsub(/^[[:space:]]*(lz_config_)?/, "", key); | ||
value=$2; | ||
gsub(/[[:space:]#].*$/, "", value); | ||
gsub(/\"/, "", value); | ||
if (key == "pre_dns") { | ||
split(value, arr, "."); | ||
if (arr[1] + 0 < 256 && arr[2] + 0 < 256 && arr[3] + 0 < 256 && arr[4] + 0 < 256) { | ||
print "preDNS=\""value"\""; | ||
delete arr; | ||
exit; | ||
} | ||
delete arr; | ||
} | ||
}' "${configFile}" 2> /dev/null )" | ||
echo "${preDNS}" | ||
} | ||
|
||
get_last_version() { | ||
local RAW_SRC="larsonzh/amdwprprsct/raw/master/source_codes/lz/lz_rule.sh" | ||
local BLOB_URL="larsonzh/amdwprprsct/blob/master/source_codes/lz/lz_rule.sh" | ||
local ROGUE_TERM="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.5304.88 Safari/537.36 Edg/108.0.1462.46" | ||
local REF_URL="${1}larsonzh/amdwprprsct/blob/master/source_codes/lz/lz_rule.sh" | ||
local SRC_URL="${1}larsonzh/amdwprprsct/raw/master/source_codes/lz/lz_rule.sh" | ||
while true | ||
do | ||
[ "${1}" != "https://github.com/" ] && break | ||
local retVal="" | ||
local RAW_SITE="raw.githubusercontent.com" | ||
REF_URL="${SRC_URL}" | ||
SRC_URL="https://${RAW_SITE}/larsonzh/amdwprprsct/master/source_codes/lz/lz_rule.sh" | ||
local PRE_DNS="$( get_pre_dns )" | ||
[ -z "${PRE_DNS}" ] && break | ||
local SRC_IP="$( nslookup "${RAW_SITE}" "${PRE_DNS}" 2> /dev/null \ | ||
| awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ {print $3; exit;}' )" | ||
[ -n "${SRC_IP}" ] \ | ||
&& retVal="$( /usr/sbin/curl -fsLC "-" -m 15 --retry 3 --resolve "${RAW_SITE}:443:${SRC_IP}" \ | ||
-A "${ROGUE_TERM}" \ | ||
-e "${REF_URL}" "${SRC_URL}" \ | ||
| grep -oEw 'LZ_VERSION=v[0-9]+([\.][0-9]+)+' | sed 's/LZ_VERSION=//g' | sed -n 1p )" | ||
[ -z "${retVal}" ] && { | ||
RAW_SITE="github.com" | ||
REF_URL="${1}larsonzh/amdwprprsct/blob/master/source_codes/lz/lz_rule.sh" | ||
SRC_URL="${1}larsonzh/amdwprprsct/raw/master/source_codes/lz/lz_rule.sh" | ||
SRC_IP="$( nslookup "${RAW_SITE}" "${PRE_DNS}" 2> /dev/null \ | ||
| awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ {print $3; exit;}' )" | ||
[ -z "${SRC_IP}" ] && break | ||
retVal="$( /usr/sbin/curl -fsLC "-" -m 15 --retry 3 --resolve "${RAW_SITE}:443:${SRC_IP}" \ | ||
-A "${ROGUE_TERM}" \ | ||
-e "${REF_URL}" "${PRE_DNS}" "${SRC_IP}" "${SRC_URL}" \ | ||
| grep -oEw 'LZ_VERSION=v[0-9]+([\.][0-9]+)+' | sed 's/LZ_VERSION=//g' | sed -n 1p )" | ||
} | ||
[ -z "${retVal}" ] && break | ||
echo "${retVal}" | ||
return | ||
done | ||
/usr/sbin/curl -fsLC "-" -m 15 --retry 3 \ | ||
-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.5304.88 Safari/537.36 Edg/108.0.1462.46" \ | ||
-e "${1}${BLOB_URL}" "${1}${RAW_SRC}" \ | ||
-A "${ROGUE_TERM}" \ | ||
-e "${REF_URL}" "${SRC_URL}" \ | ||
| grep -oEw 'LZ_VERSION=v[0-9]+([\.][0-9]+)+' | sed 's/LZ_VERSION=//g' | sed -n 1p | ||
} | ||
|
||
|
@@ -185,11 +241,40 @@ case "${2}" in | |
printf "%s [%s]:\n" "$( date +"%F %T" )" "${$}" | ||
} >> "/tmp/syslog.log" | ||
mkdir -p "${PATH_LZ}/tmp/doupdate" 2> /dev/null | ||
local PACKAGE_SRC="larsonzh/amdwprprsct/raw/master/installation_package/lz_rule-${remoteVer}.tgz" | ||
local BLOB_URL="larsonzh/amdwprprsct/blob/master/installation_package/lz_rule-${remoteVer}.tgz" | ||
/usr/sbin/curl -fsLC "-" --retry 3 \ | ||
-A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.5304.88 Safari/537.36 Edg/108.0.1462.46" \ | ||
-e "${LZ_REPO}${BLOB_URL}" "${LZ_REPO}${PACKAGE_SRC}" -o "${PATH_LZ}/tmp/doupdate/lz_rule-${remoteVer}.tgz" | ||
local ROGUE_TERM="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.5304.88 Safari/537.36 Edg/108.0.1462.46" | ||
local REF_URL="${LZ_REPO}larsonzh/amdwprprsct/blob/master/installation_package/lz_rule-${remoteVer}.tgz" | ||
local SRC_URL="${LZ_REPO}larsonzh/amdwprprsct/raw/master/installation_package/lz_rule-${remoteVer}.tgz" | ||
while true | ||
do | ||
[ "${LZ_REPO}" != "https://github.com/" ] && break | ||
local RAW_SITE="raw.githubusercontent.com" | ||
REF_URL="${SRC_URL}" | ||
SRC_URL="https://${RAW_SITE}/larsonzh/amdwprprsct/master/installation_package/lz_rule-${remoteVer}.tgz" | ||
local PRE_DNS="$( get_pre_dns )" | ||
[ -z "${PRE_DNS}" ] && break | ||
local SRC_IP="$( nslookup "${RAW_SITE}" "${PRE_DNS}" 2> /dev/null \ | ||
| awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ {print $3; exit;}' )" | ||
[ -n "${SRC_IP}" ] \ | ||
&& /usr/sbin/curl -fsLC "-" --retry 3 --resolve "${RAW_SITE}:443:${SRC_IP}" \ | ||
-A "${ROGUE_TERM}" \ | ||
-e "${REF_URL}" "${SRC_URL}" -o "${PATH_LZ}/tmp/doupdate/lz_rule-${remoteVer}.tgz" | ||
[ ! -f "${PATH_LZ}/tmp/doupdate/lz_rule-${remoteVer}.tgz" ] && { | ||
RAW_SITE="github.com" | ||
REF_URL="${LZ_REPO}larsonzh/amdwprprsct/blob/master/installation_package/lz_rule-${remoteVer}.tgz" | ||
SRC_URL="${LZ_REPO}larsonzh/amdwprprsct/raw/master/installation_package/lz_rule-${remoteVer}.tgz" | ||
SRC_IP="$( nslookup "${RAW_SITE}" "${PRE_DNS}" 2> /dev/null \ | ||
| awk 'NR > 4 && $3 ~ /^([0-9]{1,3}[\.]){3}[0-9]{1,3}$/ {print $3; exit;}' )" | ||
[ -z "${SRC_IP}" ] && break | ||
/usr/sbin/curl -fsLC "-" --retry 3 --resolve "${RAW_SITE}:443:${SRC_IP}" \ | ||
-A "${ROGUE_TERM}" \ | ||
-e "${REF_URL}" "${SRC_URL}" -o "${PATH_LZ}/tmp/doupdate/lz_rule-${remoteVer}.tgz" | ||
} | ||
break | ||
done | ||
[ ! -f "${PATH_LZ}/tmp/doupdate/lz_rule-${remoteVer}.tgz" ] \ | ||
&& /usr/sbin/curl -fsLC "-" --retry 3 \ | ||
-A "${ROGUE_TERM}" \ | ||
-e "${REF_URL}" "${SRC_URL}" -o "${PATH_LZ}/tmp/doupdate/lz_rule-${remoteVer}.tgz" | ||
if [ -f "${PATH_LZ}/tmp/doupdate/lz_rule-${remoteVer}.tgz" ]; then | ||
{ | ||
printf "%s [%s]:\n" "$( date +"%F %T" )" "${$}" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
# lz_policy_routing.js v4.6.5 | ||
# lz_policy_routing.js v4.6.6 | ||
# By LZ 妙妙呜 ([email protected]) | ||
# LZ JavaScript for Asuswrt-Merlin Router | ||
|
Oops, something went wrong.