mirror of
https://github.com/juewuy/ShellCrash.git
synced 2024-11-16 03:32:34 +08:00
~增加对自定义保留地址段的输入校验机制
~尝试修复部分情况下安装时未正确初始化的bug ~修复nftables-redir模式下会错误运行tproxy模式的bug
This commit is contained in:
parent
530c0c4ce6
commit
d8a9ce9ec3
|
@ -61,8 +61,8 @@ gettar(){
|
|||
echo 开始解压文件!
|
||||
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
|
||||
. $CRASHDIR/init.sh >/dev/null
|
||||
if [ -s $CRASHDIR/init.sh ];then
|
||||
. $CRASHDIR/init.sh >/dev/null || $echo "\033[33m初始化失败,请尝试本地安装!\033[0m"
|
||||
else
|
||||
rm -rf /tmp/ShellCrash.tar.gz
|
||||
$echo "\033[33m文件解压失败!\033[0m"
|
||||
|
@ -203,8 +203,8 @@ echo -----------------------------------------------
|
|||
gettar
|
||||
echo -----------------------------------------------
|
||||
echo ShellCrash 已经安装成功!
|
||||
[ "$profile" = "~/.bashrc" ] && echo "请执行【source ~/.bashrc &> /dev/null】命令以加载环境变量!"
|
||||
[ -n "$(ls -l /bin/sh|grep -oE 'zsh')" ] && echo "请执行【source ~/.zshrc &> /dev/null】命令以加载环境变量!"
|
||||
[ "$profile" = "~/.bashrc" ] && echo "请执行【. ~/.bashrc &> /dev/null】命令以加载环境变量!"
|
||||
[ -n "$(ls -l /bin/sh|grep -oE 'zsh')" ] && echo "请执行【. ~/.zshrc &> /dev/null】命令以加载环境变量!"
|
||||
echo -----------------------------------------------
|
||||
$echo "\033[33m输入\033[30;47m crash \033[0;33m命令即可管理!!!\033[0m"
|
||||
echo -----------------------------------------------
|
||||
|
|
|
@ -808,12 +808,14 @@ setfirewall(){ #防火墙设置
|
|||
[ -z "$reserve_ipv4" ] && reserve_ipv4="0.0.0.0/8 10.0.0.0/8 127.0.0.0/8 100.64.0.0/10 169.254.0.0/16 172.16.0.0/12 192.168.0.0/16 224.0.0.0/4 240.0.0.0/4"
|
||||
echo -e "当前网段:\033[36m$reserve_ipv4\033[0m"
|
||||
echo -e "\033[33m地址必须是空格分隔,错误的设置可能导致网络回环或启动报错,请务必谨慎!\033[0m"
|
||||
read -p "请输入 > " reserve_ipv4
|
||||
if [ -n "$reserve_ipv4" ];then
|
||||
read -p "请输入 > " text
|
||||
if [ -n "$(echo $text |grep -E "(((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])/(3[0-2]|[1-2]?[0-9]))( +|$)+"
|
||||
)" ];then
|
||||
reserve_ipv4="$text"
|
||||
echo -e "已将保留地址网段设为:\033[32m$reserve_ipv4\033[0m"
|
||||
setconfig reserve_ipv4 "\'$reserve_ipv4\'"
|
||||
else
|
||||
echo -e "\033[31m操作已取消!\033[0m"
|
||||
echo -e "\033[31m输入有误,操作已取消!\033[0m"
|
||||
fi
|
||||
sleep 1
|
||||
setfirewall
|
||||
|
|
|
@ -1325,7 +1325,7 @@ start_nftables() { #nftables配置总入口
|
|||
[ "$lan_proxy" = true ] && start_nft_route prerouting prerouting nat -100
|
||||
[ "$local_proxy" = true ] && start_nft_route output output nat -100
|
||||
}
|
||||
[ "$redir_mod" = "Tproxy模式" ] && modprobe nft_tproxy >/dev/null 2>&1 || lsmod 2>/dev/null | grep -q nft_tproxy && {
|
||||
[ "$redir_mod" = "Tproxy模式" ] && ( modprobe nft_tproxy >/dev/null 2>&1 || lsmod 2>/dev/null | grep -q nft_tproxy ) && {
|
||||
JUMP="meta l4proto {tcp, udp} mark set $fwmark tproxy to :$tproxy_port" #跳转劫持的具体命令
|
||||
[ "$lan_proxy" = true ] && start_nft_route prerouting prerouting filter -150
|
||||
[ "$local_proxy" = true ] && {
|
||||
|
|
Loading…
Reference in New Issue
Block a user