Skip to content

Commit

Permalink
v4.6.6
Browse files Browse the repository at this point in the history
1.增加防护系统 ASD 进程误删可执行程序及数据文件机制。
2.解决去国际 (Github) 站点查询软件最新版本和在线升级
  安装过程中遇到的 DNS 污染问题。
3.更新运营商 IP 地址数据文件。
  • Loading branch information
larsonzh authored Nov 6, 2024
1 parent 562864c commit 5335886
Show file tree
Hide file tree
Showing 19 changed files with 316 additions and 70 deletions.
34 changes: 32 additions & 2 deletions source_codes/install.sh
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
Expand All @@ -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#*.}"
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions source_codes/lz/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v4.6.6 (2024/11/6)
1.增加防护系统 ASD 进程误删可执行程序及数据文件机制。
2.解决去国际 (Github) 站点查询软件最新版本和在线升级
安装过程中遇到的 DNS 污染问题。
3.更新运营商 IP 地址数据文件。

v4.6.5 (2024/10/27)
1.优化代码。

Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/configs/lz_rule_config.sh
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上创建附加地
Expand Down
3 changes: 1 addition & 2 deletions source_codes/lz/data/lz_all_cn_cidr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2052,7 +2052,6 @@
103.139.212.0/23
103.140.8.0/23
103.140.14.0/23
103.140.70.0/23
103.140.126.0/23
103.140.140.0/23
103.140.144.0/23
Expand Down Expand Up @@ -2084,7 +2083,6 @@
103.142.238.0/23
103.142.248.0/23
103.143.16.0/22
103.143.31.0/24
103.143.74.0/23
103.143.120.0/23
103.143.124.0/23
Expand Down Expand Up @@ -3748,6 +3746,7 @@
160.187.252.0/22
160.191.0.0/23
160.191.104.0/23
160.191.110.0/23
160.202.60.0/22
160.202.148.0/22
160.202.152.0/22
Expand Down
6 changes: 4 additions & 2 deletions source_codes/lz/data/lz_hk_cidr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,8 @@
103.139.90.0/24
103.139.142.0/24
103.139.198.0/23
103.140.68.0/23
103.140.68.0/22
103.140.149.0/24
103.140.150.0/23
103.140.154.0/24
103.140.156.0/23
103.140.170.0/23
Expand Down Expand Up @@ -1680,6 +1679,8 @@
160.30.128.0/23
160.187.92.0/23
160.191.40.0/23
160.191.145.0/24
160.191.154.0/23
160.202.44.0/22
160.202.56.0/22
160.238.84.0/22
Expand Down Expand Up @@ -2067,6 +2068,7 @@
202.181.252.0/22
202.182.224.0/19
202.189.96.0/19
203.0.139.0/24
203.5.244.0/24
203.7.160.0/21
203.8.24.0/21
Expand Down
3 changes: 1 addition & 2 deletions source_codes/lz/data/lz_othernet_cidr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1611,7 +1611,6 @@
103.139.212.0/23
103.140.8.0/23
103.140.14.0/23
103.140.70.0/23
103.140.126.0/23
103.140.140.0/23
103.140.144.0/23
Expand Down Expand Up @@ -1639,7 +1638,6 @@
103.142.238.0/23
103.142.248.0/23
103.143.16.0/22
103.143.31.0/24
103.143.74.0/23
103.143.120.0/23
103.143.124.0/23
Expand Down Expand Up @@ -2859,6 +2857,7 @@
160.187.252.0/22
160.191.0.0/23
160.191.104.0/23
160.191.110.0/23
160.202.168.0/22
160.202.216.0/21
160.202.224.0/19
Expand Down
2 changes: 2 additions & 0 deletions source_codes/lz/data/lz_tw_cidr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
61.216.0.0/13
61.224.0.0/13
61.247.160.0/20
64.25.32.0/20
64.78.160.0/20
85.113.86.0/23
101.0.128.0/17
Expand Down Expand Up @@ -524,6 +525,7 @@
160.187.200.0/23
160.191.4.0/22
160.191.8.0/23
160.191.168.0/23
163.13.0.0/16
163.14.0.0/15
163.16.0.0/12
Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/func/lz_clear_custom_scripts_data.sh
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])

## 清除用户自定义脚本数据
Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/func/lz_define_global_variables.sh
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(首次运行标识,切勿修改)

Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/func/lz_initialize_config.sh
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])

## 初始化脚本配置
Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/func/lz_rule_address_query.sh
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])

## 网址信息查询脚本
Expand Down
6 changes: 3 additions & 3 deletions source_codes/lz/func/lz_rule_func.sh
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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/func/lz_rule_status.sh
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])

## 显示脚本运行状态脚本
Expand Down
4 changes: 2 additions & 2 deletions source_codes/lz/func/lz_vpn_daemon.sh
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])

## 虚拟专网客户端路由刷新处理后台守护进程脚本
Expand All @@ -10,7 +10,7 @@
#BEGIN

## 版本号
LZ_VERSION=v4.6.5
LZ_VERSION=v4.6.6

## 项目接口文件部署路径
PATH_INTERFACE="${0%/*}"
Expand Down
105 changes: 95 additions & 10 deletions source_codes/lz/interface/lz_rule_service.sh
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])

## 服务接口脚本
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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" )" "${$}"
Expand Down
2 changes: 1 addition & 1 deletion source_codes/lz/js/lz_policy_routing.js
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
Expand Down
Loading

0 comments on commit 5335886

Please sign in to comment.