#!/system/bin/sh
O0O0O0='\033[0;31m'
O0O0OO='\033[0;32m'
OO0O0O='\033[1;33m'
O0OO0O='\033[0;34m'
OO0OO0='\033[0;35m'
O0O00O='\033[0;36m'
OOO000='\033[1;37m'
OO0O00='\033[0m'

if [ "$(id -u)" -ne 0 ];then
    echo -e "${O0O0O0}必须ROOT运行${OO0O00}"
    exit 1
fi

L1() {
    echo -e "${OO0OO0}===== 清理三角洲IP标识 =====${OO0O00}"
    ip6tables=/system/bin/ip6tables
    iptables=/system/bin/iptables
    echo -e "${O0O0OO}赋值完成，IP标识已重置${OO0O00}"
}

L2() {
    echo -e "${O0O00O}===== 清理加密文件 =====${OO0O00}"
    rm -rf /data/data/com.tencent.tmgp.dfm/files/ano_tmp
    rm -rf /data/user/999/com.tencent.tmgp.dfm/files/ano_tmp
    rm -rf /data/user/0/com.tencent.tmgp.dfm/files/ano_tmp
    echo -e "${O0O0OO}加密残留文件清理完毕${OO0O00}"
}

L3() {
    echo -e "${O0OO0O}===== 解决上号三方 =====${OO0O00}"
    echo 16384 > /proc/sys/fs/inotify/max_queued_events
    echo 128 > /proc/sys/fs/inotify/max_user_instances
    echo 8192 > /proc/sys/fs/inotify/max_user_watches
    echo -e "${O0O0OO}三方限制、上号异常已修复${OO0O00}"
}

L4() {
    echo -e "${OO0O0O}===== 清理IP =====${OO0O00}"
    iptables -F
    iptables -X
    iptables -Z
    iptables -t nat -F
    echo -e "${O0O0OO}全网IP规则清空完成${OO0O00}"
}

while true;do
    clear
    # 固定长度的紫色横线，兼容所有终端
    echo -e "${OO0OO0}====================================================${OO0O00}"
    echo -e "${OOO000}           三角洲工具箱${OO0O00}"
    echo -e "${OO0OO0}====================================================${OO0O00}"
    echo -e "${O0O0O0}1${OO0O00}、清理三角洲IP标识"
    echo -e "${O0O0OO}2${OO0O00}、清理加密文件"
    echo -e "${O0OO0O}3${OO0O00}、解决上号三方"
    echo -e "${OO0O0O}4${OO0O00}、清理IP"
    echo -e "${O0O00O}0${OO0O00}、退出脚本"
    echo -e "${OO0OO0}====================================================${OO0O00}"
    echo "请输入数字："
    read x
    case $x in
        1)L1;;
        2)L2;;
        3)L3;;
        4)L4;;
        0)exit 0;;
        *)echo -e "${O0O0O0}输入错误${OO0O00}";;
    esac
    echo "按回车返回菜单"
    read k
done
