mirror of
https://github.com/juewuy/ShellCrash.git
synced 2024-11-16 03:32:34 +08:00
v1.9.1alpha8
~修复nftables下tproxy本机代理报错的bug ~修复部分情况下tun本机代理失效的问题 ~增加自动修改Tproxy混合至Tproxy模式的机制
This commit is contained in:
parent
6748da050e
commit
8f109ecf2a
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -4,5 +4,5 @@ clash_v=v1.7.1
|
||||||
meta_v=v1.18.1
|
meta_v=v1.18.1
|
||||||
singboxp_v=1.8.5-73d97226
|
singboxp_v=1.8.5-73d97226
|
||||||
singbox_v=1.8.8
|
singbox_v=1.8.8
|
||||||
versionsh=1.9.1alpha7
|
versionsh=1.9.1alpha8
|
||||||
GeoIP_v=20240302
|
GeoIP_v=20240302
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Copyright (C) Juewuy
|
# Copyright (C) Juewuy
|
||||||
|
|
||||||
version=1.9.1alpha7
|
version=1.9.1alpha8
|
||||||
|
|
||||||
setdir(){
|
setdir(){
|
||||||
dir_avail(){
|
dir_avail(){
|
||||||
|
@ -315,6 +315,7 @@ sed -i "s/ShellClash/ShellCrash/g" $configpath
|
||||||
sed -i "s/cpucore=armv8/cpucore=arm64/g" $configpath
|
sed -i "s/cpucore=armv8/cpucore=arm64/g" $configpath
|
||||||
sed -i "s/redir_mod=Nft基础/redir_mod=Redir模式/g" $configpath
|
sed -i "s/redir_mod=Nft基础/redir_mod=Redir模式/g" $configpath
|
||||||
sed -i "s/redir_mod=Nft混合/redir_mod=Tproxy模式/g" $configpath
|
sed -i "s/redir_mod=Nft混合/redir_mod=Tproxy模式/g" $configpath
|
||||||
|
sed -i "s/redir_mod=Tproxy混合/redir_mod=Tproxy模式/g" $configpath
|
||||||
sed -i "s/redir_mod=纯净模式/firewall_area=4/g" $configpath
|
sed -i "s/redir_mod=纯净模式/firewall_area=4/g" $configpath
|
||||||
|
|
||||||
echo -e "\033[32m脚本初始化完成,请输入\033[30;47m crash \033[0;33m命令开始使用!\033[0m"
|
echo -e "\033[32m脚本初始化完成,请输入\033[30;47m crash \033[0;33m命令开始使用!\033[0m"
|
||||||
|
|
|
@ -1038,7 +1038,7 @@ start_iptables(){ #iptables配置总入口
|
||||||
[ "$lan_proxy" = true ] && {
|
[ "$lan_proxy" = true ] && {
|
||||||
[ "$redir_mod" = "Tun模式" -o "$redir_mod" = "混合模式" ] && {
|
[ "$redir_mod" = "Tun模式" -o "$redir_mod" = "混合模式" ] && {
|
||||||
iptables -I FORWARD -o utun -j ACCEPT
|
iptables -I FORWARD -o utun -j ACCEPT
|
||||||
ip route del 198.18.0.0/16 dev utun proto kernel scope link src 198.18.0.0 #移除内核生成的tun路由
|
#ip route show | grep "dev utun proto kernel scope link src" | while read route; do ip route del $route; done #移除内核生成的tun路由
|
||||||
}
|
}
|
||||||
start_ipt_route iptables mangle PREROUTING shellcrash_mark $protocol
|
start_ipt_route iptables mangle PREROUTING shellcrash_mark $protocol
|
||||||
}
|
}
|
||||||
|
@ -1114,10 +1114,6 @@ start_nft_route(){ #nftables-route通用工具
|
||||||
#添加通用路由
|
#添加通用路由
|
||||||
nft add rule inet shellcrash "$1" "$JUMP"
|
nft add rule inet shellcrash "$1" "$JUMP"
|
||||||
#处理特殊路由
|
#处理特殊路由
|
||||||
[ "$redir_mod" = "Tproxy模式" ] && {
|
|
||||||
nft add chain inet shellcrash ${1}_tproxy { type filter hook $2 priority -100 \; }
|
|
||||||
nft add rule inet shellcrash ${1}_tproxy meta mark $fwmark meta l4proto {tcp, udp} tproxy to :$tproxy_port
|
|
||||||
}
|
|
||||||
[ "$redir_mod" = "混合模式" ] && {
|
[ "$redir_mod" = "混合模式" ] && {
|
||||||
nft add rule inet shellcrash $1 meta l4proto tcp mark set $((fwmark + 1))
|
nft add rule inet shellcrash $1 meta l4proto tcp mark set $((fwmark + 1))
|
||||||
nft add chain inet shellcrash ${1}_mixtcp { type nat hook $2 priority -100 \; }
|
nft add chain inet shellcrash ${1}_mixtcp { type nat hook $2 priority -100 \; }
|
||||||
|
@ -1182,16 +1178,20 @@ start_nftables(){ #nftables配置总入口
|
||||||
[ "$local_proxy" = true ] && start_nft_route output output nat -100
|
[ "$local_proxy" = true ] && start_nft_route output output nat -100
|
||||||
}
|
}
|
||||||
[ "$redir_mod" = "Tproxy模式" ] && modprobe nft_tproxy >/dev/null 2>&1 && {
|
[ "$redir_mod" = "Tproxy模式" ] && modprobe nft_tproxy >/dev/null 2>&1 && {
|
||||||
JUMP="meta l4proto {tcp, udp} mark set $fwmark" #跳转劫持的具体命令
|
JUMP="meta l4proto {tcp, udp} mark set $fwmark tproxy to :$tproxy_port" #跳转劫持的具体命令
|
||||||
[ "$lan_proxy" = true ] && start_nft_route prerouting prerouting nat -150
|
[ "$lan_proxy" = true ] && start_nft_route prerouting prerouting nat -150
|
||||||
[ "$local_proxy" = true ] && start_nft_route output output route -150
|
[ "$local_proxy" = true ] && {
|
||||||
|
JUMP="meta l4proto {tcp, udp} mark set $fwmark" #跳转劫持的具体命令
|
||||||
|
start_nft_route output output route -150
|
||||||
|
nft add chain inet shellcrash mark_out { type filter hook prerouting priority -100 \; }
|
||||||
|
nft add rule inet shellcrash mark_out meta mark $fwmark meta l4proto {tcp, udp} tproxy to :$tproxy_port
|
||||||
|
}
|
||||||
}
|
}
|
||||||
[ "$tun_statu" = true ] && {
|
[ "$tun_statu" = true ] && {
|
||||||
[ "$redir_mod" = "Tun模式" ] && JUMP="meta l4proto {tcp, udp} mark set $fwmark" #跳转劫持的具体命令
|
[ "$redir_mod" = "Tun模式" ] && JUMP="meta l4proto {tcp, udp} mark set $fwmark" #跳转劫持的具体命令
|
||||||
[ "$redir_mod" = "混合模式" ] && JUMP="meta l4proto udp mark set $fwmark" #跳转劫持的具体命令
|
[ "$redir_mod" = "混合模式" ] && JUMP="meta l4proto udp mark set $fwmark" #跳转劫持的具体命令
|
||||||
[ "$lan_proxy" = true ] && {
|
[ "$lan_proxy" = true ] && {
|
||||||
start_nft_route prerouting prerouting nat -150
|
start_nft_route prerouting prerouting nat -150
|
||||||
ip route del 198.18.0.0/16 dev utun proto kernel scope link src 198.18.0.0 #移除内核生成的tun路由
|
|
||||||
#放行流量
|
#放行流量
|
||||||
nft add chain inet shellcrash forward { type filter hook forward priority -150 \; }
|
nft add chain inet shellcrash forward { type filter hook forward priority -150 \; }
|
||||||
nft add rule inet shellcrash forward oifname "utun" accept
|
nft add rule inet shellcrash forward oifname "utun" accept
|
||||||
|
|
Loading…
Reference in New Issue
Block a user