mirror of
https://github.com/juewuy/ShellCrash.git
synced 2024-11-15 19:22:54 +08:00
~为华硕设备添加基于下载大师的自启选项(未测试)
~修复部分设备因未开机加载tproxy相关模块而导致tproxy代理不可用的问题 ~修复未安装iptables的用户启动时的大量无意义报错 ~其他优化及修复
This commit is contained in:
parent
1bcd7b69d5
commit
023787a712
23
install.sh
23
install.sh
|
@ -62,7 +62,7 @@ gettar(){
|
|||
mkdir -p $CRASHDIR > /dev/null
|
||||
tar -zxf '/tmp/ShellCrash.tar.gz' -C $CRASHDIR/ || tar -zxf '/tmp/ShellCrash.tar.gz' --no-same-owner -C $CRASHDIR/
|
||||
if [ -f $CRASHDIR/init.sh ];then
|
||||
source $CRASHDIR/init.sh >/dev/null
|
||||
. $CRASHDIR/init.sh >/dev/null
|
||||
else
|
||||
rm -rf /tmp/ShellCrash.tar.gz
|
||||
$echo "\033[33m文件解压失败!\033[0m"
|
||||
|
@ -82,6 +82,16 @@ setdir(){
|
|||
set_usb_dir
|
||||
fi
|
||||
}
|
||||
set_asus_dir(){
|
||||
echo -e "请选择U盘目录"
|
||||
du -hL /tmp/mnt | awk '{print " "NR" "$2" "$1}'
|
||||
read -p "请输入相应数字 > " num
|
||||
dir=$(du -hL /tmp/mnt | awk '{print $2}' | sed -n "$num"p)
|
||||
if [ ! -f "$dir/asusware.arm/etc/init.d/S50downloadmaster" ];then
|
||||
echo -e "\033[31m未找到下载大师自启文件:$dir/asusware.arm/etc/init.d/S50downloadmaster,请检查设置!\033[0m"
|
||||
set_asus_dir
|
||||
fi
|
||||
}
|
||||
set_cust_dir(){
|
||||
echo -----------------------------------------------
|
||||
echo '可用路径 剩余空间:'
|
||||
|
@ -123,6 +133,7 @@ if [ -n "$systype" ];then
|
|||
$echo "\033[33m检测到当前设备为华硕固件,请选择安装方式\033[0m"
|
||||
$echo " 1 基于USB设备安装(限23年9月之前固件,须插入\033[31m任意\033[0mUSB设备)"
|
||||
$echo " 2 基于自启脚本安装(仅支持梅林及部分官改固件)"
|
||||
$echo " 3 基于下载大师安装(支持最新固件,限ARM设备,须插入U盘或移动硬盘)"
|
||||
$echo " 0 退出安装"
|
||||
echo -----------------------------------------------
|
||||
read -p "请输入相应数字 > " num
|
||||
|
@ -131,11 +142,17 @@ if [ -n "$systype" ];then
|
|||
read -p "将脚本安装到USB存储/系统闪存?(1/0) > " res
|
||||
[ "$res" = "1" ] && set_usb_dir || dir=/jffs
|
||||
usb_status=1
|
||||
;;
|
||||
;;
|
||||
2)
|
||||
$echo "如无法正常开机启动,请重新使用USB方式安装!"
|
||||
sleep 2
|
||||
dir=/jffs ;;
|
||||
dir=/jffs
|
||||
;;
|
||||
3)
|
||||
echo -e "请先在路由器网页后台安装下载大师,之后选择外置存储所在目录!"
|
||||
sleep 2
|
||||
set_asus_dir
|
||||
;;
|
||||
*)
|
||||
exit 1 ;;
|
||||
esac
|
||||
|
|
|
@ -17,6 +17,16 @@ setdir(){
|
|||
set_usb_dir
|
||||
fi
|
||||
}
|
||||
set_asus_dir(){
|
||||
echo -e "请选择U盘目录"
|
||||
du -hL /tmp/mnt | awk '{print " "NR" "$2" "$1}'
|
||||
read -p "请输入相应数字 > " num
|
||||
dir=$(du -hL /tmp/mnt | awk '{print $2}' | sed -n "$num"p)
|
||||
if [ ! -f "$dir/asusware.arm/etc/init.d/S50downloadmaster" ];then
|
||||
echo -e "\033[31m未找到下载大师自启文件:$dir/asusware.arm/etc/init.d/S50downloadmaster,请检查设置!\033[0m"
|
||||
set_asus_dir
|
||||
fi
|
||||
}
|
||||
set_cust_dir(){
|
||||
echo -----------------------------------------------
|
||||
echo '可用路径 剩余空间:'
|
||||
|
@ -55,8 +65,9 @@ if [ -n "$systype" ];then
|
|||
}
|
||||
[ "$systype" = "asusrouter" ] && {
|
||||
echo -e "\033[33m检测到当前设备为华硕固件,请选择安装方式\033[0m"
|
||||
echo -e " 1 基于USB设备安装(通用,须插入\033[31m任意\033[0mUSB设备)"
|
||||
echo -e " 1 基于USB设备安装(限23年9月之前固件,须插入\033[31m任意\033[0mUSB设备)"
|
||||
echo -e " 2 基于自启脚本安装(仅支持梅林及部分官改固件)"
|
||||
echo -e " 3 基于下载大师安装(支持最新固件,限ARM设备,须插入U盘或移动硬盘)"
|
||||
echo -e " 0 退出安装"
|
||||
echo -----------------------------------------------
|
||||
read -p "请输入相应数字 > " num
|
||||
|
@ -65,13 +76,20 @@ if [ -n "$systype" ];then
|
|||
read -p "将脚本安装到USB存储/系统闪存?(1/0) > " res
|
||||
[ "$res" = "1" ] && set_usb_dir || dir=/jffs
|
||||
usb_status=1
|
||||
;;
|
||||
;;
|
||||
2)
|
||||
echo -e "如无法正常开机启动,请重新使用USB方式安装!"
|
||||
sleep 2
|
||||
dir=/jffs ;;
|
||||
dir=/jffs
|
||||
;;
|
||||
3)
|
||||
echo -e "请先在路由器网页后台安装下载大师,之后选择外置存储所在目录!"
|
||||
sleep 2
|
||||
set_asus_dir
|
||||
;;
|
||||
*)
|
||||
exit 1 ;;
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
[ "$systype" = "ng_snapshot" ] && dir=/tmp/mnt
|
||||
|
@ -279,6 +297,9 @@ fi
|
|||
nvram set script_usbmount="$CRASHDIR/asus_usb_mount.sh"
|
||||
nvram commit
|
||||
}
|
||||
#华硕下载大师启动额外设置
|
||||
[ -f "$dir/asusware.arm/etc/init.d/S50downloadmaster" ] && \
|
||||
sed -i "/^PATH=/a\\$CRASHDIR/start.sh init #ShellCrash初始化脚本" "$dir/asusware.arm/etc/init.d/S50downloadmaster"
|
||||
#删除临时文件
|
||||
rm -rf /tmp/*rash*gz
|
||||
rm -rf /tmp/SC_tmp
|
||||
|
|
|
@ -1313,7 +1313,7 @@ set_redir_mod(){ #代理模式设置
|
|||
redir_mod=Tproxy模式
|
||||
set_redir_config
|
||||
}
|
||||
elif [ -n "$(grep -E '^TPROXY$' /proc/net/ip_tables_targets)" ] ;then
|
||||
elif grep -qE '^TPROXY$' /proc/net/ip_tables_targets || modprobe xt_TPROXY >/dev/null 2>&1;then
|
||||
redir_mod=Tproxy模式
|
||||
set_redir_config
|
||||
else
|
||||
|
|
|
@ -44,8 +44,8 @@ getconfig() { #读取配置及全局变量
|
|||
core_config="$CRASHDIR"/yamls/config.yaml
|
||||
fi
|
||||
#检查$iptable命令可用性
|
||||
iptables -h | grep -q '\-w' && iptable='iptables -w' || iptable=iptables
|
||||
ip6tables -h | grep -q '\-w' && ip6table='ip6tables -w' || ip6table=ip6tables
|
||||
ckcmd iptables && iptables -h | grep -q '\-w' && iptable='iptables -w' || iptable=iptables
|
||||
ckcmd ip6tables && ip6tables -h | grep -q '\-w' && ip6table='ip6tables -w' || ip6table=ip6tables
|
||||
}
|
||||
setconfig() { #脚本配置工具
|
||||
#参数1代表变量名,参数2代表变量值,参数3即文件路径
|
||||
|
@ -1070,6 +1070,7 @@ start_iptables() { #iptables配置总入口
|
|||
}
|
||||
}
|
||||
[ "$redir_mod" = "Tproxy模式" ] && {
|
||||
modprobe xt_TPROXY >/dev/null 2>&1
|
||||
JUMP="TPROXY --on-port $tproxy_port --tproxy-mark $fwmark" #跳转劫持的具体命令
|
||||
if $iptable -j TPROXY -h 2>/dev/null | grep -q '\--on-port'; then
|
||||
[ "$lan_proxy" = true ] && start_ipt_route iptables mangle PREROUTING shellcrash_mark all
|
||||
|
@ -1487,11 +1488,10 @@ stop_firewall() { #还原防火墙配置
|
|||
$ip6table -D INPUT -p udp --dport 443 $set_cn_ip -j REJECT 2>/dev/null
|
||||
#tun
|
||||
$ip6table -D FORWARD -o utun -j ACCEPT 2>/dev/null
|
||||
$ip6table -D FORWARD -p udp --dport 443 -o utun -j REJECT >/dev/null 2>&1
|
||||
#屏蔽QUIC
|
||||
[ "$dns_mod" != "fake-ip" -a "$cn_ipv6_route" = "已开启" ] && set_cn_ip6='-m set ! --match-set cn_ip6 dst'
|
||||
$ip6table -D INPUT -p udp --dport 443 $set_cn_ip6 -j REJECT 2>/dev/null
|
||||
$ip6table -D FORWARD -p udp --dport 443 -o utun $set_cn_ip -j REJECT 2>/dev/null
|
||||
$ip6table -D FORWARD -p udp --dport 443 -o utun $set_cn_ip6 -j REJECT 2>/dev/null
|
||||
#公网访问
|
||||
$ip6table -D INPUT -p tcp --dport $mix_port -j REJECT 2>/dev/null
|
||||
$ip6table -D INPUT -p tcp --dport $mix_port -j ACCEPT 2>/dev/null
|
||||
|
|
Loading…
Reference in New Issue
Block a user