mirror of
https://github.com/juewuy/ShellCrash.git
synced 2024-11-16 11:42:18 +08:00
~修复dns局域网过滤失效的bug
~修复初始化脚本报错的bug ~尝试修复部分华硕设备开机启动失效的问题 ~尝试修复部分小米设备开机启动失效的问题
This commit is contained in:
parent
6eff925b1d
commit
f5618ef3d8
|
@ -121,7 +121,7 @@ if [ -n "$systype" ];then
|
|||
}
|
||||
[ "$systype" = "asusrouter" ] && {
|
||||
$echo "\033[33m检测到当前设备为华硕固件,请选择安装方式\033[0m"
|
||||
$echo " 1 基于USB设备安装(通用,须插入\033[31m任意\033[0mUSB设备)"
|
||||
$echo " 1 基于USB设备安装(限23年9月之前固件,须插入\033[31m任意\033[0mUSB设备)"
|
||||
$echo " 2 基于自启脚本安装(仅支持梅林及部分官改固件)"
|
||||
$echo " 0 退出安装"
|
||||
echo -----------------------------------------------
|
||||
|
|
|
@ -136,6 +136,9 @@ setconfig(){
|
|||
systype=asusrouter #华硕固件
|
||||
[ -f "/jffs/.asusrouter" ] && initdir='/jffs/.asusrouter'
|
||||
[ -d "/jffs/scripts" ] && initdir='/jffs/scripts/nat-start'
|
||||
#华硕启用jffs
|
||||
nvram set jffs2_scripts="1"
|
||||
nvram commit
|
||||
}
|
||||
[ -f "/data/etc/crontabs/root" ] && systype=mi_snapshot #小米设备
|
||||
[ -w "/var/mnt/cfg/firewall" ] && systype=ng_snapshot #NETGEAR设备
|
||||
|
@ -234,18 +237,18 @@ if [ -n "$profile" ];then
|
|||
echo "export CRASHDIR=\"$CRASHDIR\"" >> ~/.zshrc
|
||||
source ~/.zshrc >/dev/null 2>&1
|
||||
}
|
||||
#在允许的情况下创建/usr/bin/crash文件
|
||||
[ -w /usr/bin ] && {
|
||||
cat > /usr/bin/crash <<EOF
|
||||
#/bin/$shtype
|
||||
$CRASHDIR/menu.sh \$1 \$2 \$3 \$4 \$5
|
||||
EOF
|
||||
chmod +x /usr/bin/crash
|
||||
}
|
||||
else
|
||||
echo -e "\033[33m无法写入环境变量!请检查安装权限!\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
#在允许的情况下创建/usr/bin/crash文件
|
||||
touch /usr/bin/crash 2>/dev/null && {
|
||||
cat > /usr/bin/crash <<EOF
|
||||
#/bin/$shtype
|
||||
$CRASHDIR/menu.sh \$1 \$2 \$3 \$4 \$5
|
||||
EOF
|
||||
chmod +x /usr/bin/crash
|
||||
}
|
||||
#梅林/Padavan额外设置
|
||||
[ -n "$initdir" ] && {
|
||||
sed -i '/ShellCrash初始化/'d $initdir
|
||||
|
|
|
@ -43,10 +43,10 @@ tproxyfix(){
|
|||
}
|
||||
init(){
|
||||
#等待启动完成
|
||||
log_file=$(uci get system.@system[0].log_file)
|
||||
while ! /sbin/ip a| grep -q lan; do
|
||||
while ! ip a| grep -q lan; do
|
||||
sleep 10
|
||||
done
|
||||
sleep 20
|
||||
#初始化环境变量
|
||||
sed -i "/alias crash/d" $profile
|
||||
sed -i "/alias clash/d" $profile
|
||||
|
|
|
@ -940,12 +940,12 @@ start_ipt_dns(){ #iptables-dns通用工具
|
|||
$1 -t nat -A $3 -p udp -s $bypass_host -j RETURN
|
||||
}
|
||||
#局域网mac地址黑名单过滤
|
||||
[ "$3" = 'PREROUTING' ] && [ -s "$(cat ${CRASHDIR}/configs/mac)" ] && [ "$macfilter_type" != "白名单" ] && {
|
||||
[ "$2" = 'PREROUTING' ] && [ -s ${CRASHDIR}/configs/mac ] && [ "$macfilter_type" != "白名单" ] && {
|
||||
for mac in $(cat ${CRASHDIR}/configs/mac); do
|
||||
$1 -t nat -A $3 -m mac --mac-source $mac -j RETURN
|
||||
done
|
||||
}
|
||||
if [ "$3" = 'PREROUTING' ] && [ "$macfilter_type" = "白名单" ] && [ -n "$(cat ${CRASHDIR}/configs/mac)" ];then
|
||||
if [ "$2" = 'PREROUTING' ] && [ -s ${CRASHDIR}/configs/mac ] && [ "$macfilter_type" = "白名单" ];then
|
||||
for mac in $(cat ${CRASHDIR}/configs/mac); do
|
||||
$1 -t nat -A $3 -p tcp -m mac --mac-source $mac -j REDIRECT --to-ports $dns_port
|
||||
$1 -t nat -A $3 -p udp -m mac --mac-source $mac -j REDIRECT --to-ports $dns_port
|
||||
|
|
Loading…
Reference in New Issue
Block a user