提交 8180a66f 编写于 作者: T Toyo 提交者: GitHub

# v1.0.6 修复 自定义封禁关键词未保存的问题,新增 升级脚本功能(下个版本更新后才可用)

上级 c75cac9e
......@@ -4,10 +4,11 @@ export PATH
#=================================================
# System Required: CentOS/Debian/Ubuntu
# Description: iptables 封禁 BT、PT、SPAM(垃圾邮件)和自定义端口、关键词
# Version: 1.0.5
# Version: 1.0.6
# Blog: https://doub.io/shell-jc2/
#=================================================
sh_ver="1.0.6"
Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m"
Info="${Green_font_prefix}[信息]${Font_color_suffix}"
Error="${Red_font_prefix}[错误]${Font_color_suffix}"
......@@ -160,6 +161,7 @@ Set_KEY_WORDS(){
Set_key_word $v4iptables "$i" $s
[[ ! -z "$v6iptables" ]] && Set_key_word $v6iptables "$i" $s
done
Save_iptables_v4_v6
}
Set_BT(){
key_word=${bt_key_word}
......@@ -397,6 +399,24 @@ CentOS 系统:yum install iptables -y
Debian / Ubuntu 系统:apt-get install iptables -y"
fi
}
Update_Shell(){
echo -e "当前版本为 [ ${sh_ver} ],开始检测最新版本..."
sh_new_ver=$(wget --no-check-certificate -qO- "https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ban_iptables.sh"|grep 'sh_ver="'|awk -F "=" '{print $NF}'|sed 's/\"//g'|head -1)
[[ -z ${sh_new_ver} ]] && echo -e "${Error} 检测最新版本失败 !" && exit 1
if [[ ${sh_new_ver} != ${sh_ver} ]]; then
echo -e "发现新版本[ ${sh_new_ver} ],是否更新?[Y/n]"
stty erase '^H' && read -p "(默认: y):" yn
[[ -z "${yn}" ]] && yn="y"
if [[ ${yn} == [Yy] ]]; then
wget -N --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/ban_iptables.sh && chmod +x ban_iptables.sh
echo -e "脚本已更新为最新版本[ ${sh_new_ver} ] !"
else
echo && echo " 已取消..." && echo
fi
else
echo -e "当前已是最新版本[ ${sh_new_ver} ] !"
fi
}
check_sys
check_iptables
action=$1
......@@ -408,7 +428,8 @@ if [[ ! -z $action ]]; then
[[ $action = "unbanspam" ]] && UnBan_SPAM && exit 0
[[ $action = "unbanall" ]] && UnBan_ALL && exit 0
fi
echo && echo -e "请输入一个数字来选择选项
echo && echo -e " iptables防火墙 封禁管理脚本 ${Red_font_prefix}[v${sh_ver}]${Font_color_suffix}
-- Toyo | doub.io/shell-jc2 --
${Green_font_prefix}0.${Font_color_suffix} 查看 当前封禁列表
————————————
......@@ -424,8 +445,10 @@ echo && echo -e "请输入一个数字来选择选项
${Green_font_prefix}9.${Font_color_suffix} 解封 自定义 端口
${Green_font_prefix}10.${Font_color_suffix} 解封 自定义关键词
${Green_font_prefix}11.${Font_color_suffix} 解封 所有 关键词
————————————" && echo
stty erase '^H' && read -p " 请输入数字 [0-11]:" num
————————————
${Green_font_prefix}12.${Font_color_suffix} 升级脚本
" && echo
stty erase '^H' && read -p " 请输入数字 [0-12]:" num
case "$num" in
0)
View_ALL
......@@ -463,7 +486,10 @@ case "$num" in
11)
UnBan_KEY_WORDS_ALL
;;
12)
Update_Shell
;;
*)
echo "请输入正确数字 [0-11]"
echo "请输入正确数字 [0-12]"
;;
esac
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册