Update 661.sh

This commit is contained in:
甬哥侃侃侃ygkkk 2023-04-06 09:38:00 +00:00
parent af99f42ce4
commit 33d2dbed7b
1 changed files with 15 additions and 17 deletions

32
661.sh
View File

@ -399,12 +399,11 @@ wgcfv6=$(curl -s6m6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cu
wgcfv4=$(curl -s4m6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2) wgcfv4=$(curl -s4m6 https://www.cloudflare.com/cdn-cgi/trace -k | grep warp | cut -d= -f2)
} }
warpclose(){ warpclose(){
wg-quick down wgcf >/dev/null 2>&1 ; systemctl stop wg-quick@wgcf >/dev/null 2>&1 ; systemctl disable wg-quick@wgcf >/dev/null 2>&1;systemctl stop warp-go;systemctl disable warp-go wg-quick down wgcf;systemctl stop wg-quick@wgcf;systemctl disable wg-quick@wgcf;systemctl stop warp-go;systemctl disable warp-go
} }
warpopen(){ warpopen(){
wg-quick down wgcf >/dev/null 2>&1 ; systemctl enable wg-quick@wgcf >/dev/null 2>&1 ; systemctl start wg-quick@wgcf >/dev/null 2>&1 ; systemctl restart wg-quick@wgcf >/dev/null 2>&1;systemctl stop warp-go;systemctl enable warp-go;systemctl start warp-go;systemctl restart warp-go wg-quick down wgcf;systemctl enable wg-quick@wgcf;systemctl start wg-quick@wgcf;systemctl restart wg-quick@wgcf;systemctl stop warp-go;systemctl enable warp-go;systemctl start warp-go;systemctl restart warp-go
} }
warpre(){ warpre(){
i=0 i=0
while [ $i -le 4 ]; do let i++ while [ $i -le 4 ]; do let i++
@ -418,30 +417,27 @@ warpclose
red "由于5次尝试获取warp的IP失败现执行停止并关闭warpVPS恢复原IP状态" red "由于5次尝试获取warp的IP失败现执行停止并关闭warpVPS恢复原IP状态"
fi fi
} }
while true; do while true; do
green "检测warp是否启动中…………" green "检测warp是否启动中…………"
wp=$(cat /root/warpip/wp.log) wp=$(cat /root/warpip/wp.log)
if [[ $wp = w4 ]]; then if [[ $wp = w4 ]]; then
checkwgcf checkwgcf
[[ $wgcfv4 =~ on|plus ]] && green "恭喜WARP IPV4状态为运行中下轮检测将在你设置的60秒后自动执行" && sleep 60s || (warpre ; green "下轮检测将在你设置的50秒后自动执行" ; sleep 50s) [[ $wgcfv4 =~ on|plus ]] && green "恭喜WARP IPV4状态为运行中下轮检测将在60秒后自动执行" && sleep 60s || (warpre ; green "下轮检测将在50秒后自动执行" ; sleep 50s)
elif [[ $wp = w6 ]]; then elif [[ $wp = w6 ]]; then
checkwgcf checkwgcf
[[ $wgcfv6 =~ on|plus ]] && green "恭喜WARP IPV6状态为运行中下轮检测将在你设置的60秒后自动执行" && sleep 60s || (warpre ; green "下轮检测将在你设置的50秒后自动执行" ; sleep 50s) [[ $wgcfv6 =~ on|plus ]] && green "恭喜WARP IPV6状态为运行中下轮检测将在60秒后自动执行" && sleep 60s || (warpre ; green "下轮检测将在50秒后自动执行" ; sleep 50s)
else else
checkwgcf checkwgcf
[[ $wgcfv4 =~ on|plus && $wgcfv6 =~ on|plus ]] && green "恭喜WARP IPV4+IPV6状态为运行中下轮检测将在你设置的60秒后自动执行" && sleep 60s || (warpre ; green "下轮检测将在你设置的50秒后自动执行" ; sleep 50s) [[ $wgcfv4 =~ on|plus && $wgcfv6 =~ on|plus ]] && green "恭喜WARP IPV4+IPV6状态为运行中下轮检测将在60秒后自动执行" && sleep 60s || (warpre ; green "下轮检测将在50秒后自动执行" ; sleep 50s)
fi fi
done done
EOF EOF
readp "warp状态为运行时重新检测warp状态间隔时间回车默认60秒,请输入间隔时间50秒输入50:" stop #readp "warp状态为运行时重新检测warp状态间隔时间回车默认60秒,请输入间隔时间50秒输入50:" stop
[[ -n $stop ]] && sed -i "s/60s/${stop}s/g;s/60秒/${stop}秒/g" /root/WARP-UP.sh || green "默认间隔60秒" #[[ -n $stop ]] && sed -i "s/60s/${stop}s/g;s/60秒/${stop}秒/g" /root/WARP-UP.sh || green "默认间隔60秒"
readp "warp状态为中断时(连续5次失败自动关闭warp)继续检测WARP状态间隔时间回车默认50秒,请输入间隔时间50秒输入50:" goon #readp "warp状态为中断时(连续5次失败自动关闭warp)继续检测WARP状态间隔时间回车默认50秒,请输入间隔时间50秒输入50:" goon
[[ -n $goon ]] && sed -i "s/50s/${goon}s/g;s/50秒/${goon}秒/g" /root/WARP-UP.sh || green "默认间隔50秒" #[[ -n $goon ]] && sed -i "s/50s/${goon}s/g;s/50秒/${goon}秒/g" /root/WARP-UP.sh || green "默认间隔50秒"
[[ -e /root/WARP-UP.sh ]] && screen -S up -X quit ; screen -UdmS up bash -c '/bin/bash /root/WARP-UP.sh' [[ -e /root/WARP-UP.sh ]] && screen -S up -X quit ; screen -UdmS up bash -c '/bin/bash /root/WARP-UP.sh'
green "设置screen窗口名称'up'" && sleep 2 green "查看screen窗口名称up"
grep -qE "^ *@reboot root screen -UdmS up bash -c '/bin/bash /root/WARP-UP.sh' >/dev/null 2>&1" /etc/crontab || echo "@reboot root screen -UdmS up bash -c '/bin/bash /root/WARP-UP.sh' >/dev/null 2>&1" >> /etc/crontab
green "添加warp在线守护进程功能"
fi fi
} }
@ -624,7 +620,8 @@ WGCFmenu;S5menu
reswarp(){ reswarp(){
crontab -l > /tmp/crontab.tmp crontab -l > /tmp/crontab.tmp
echo "0 4 * * * systemctl stop warp-go;systemctl restart warp-go;systemctl restart wg-quick@wgcf;systemctl restart warp-svc" >> /tmp/crontab.tmp echo "0 4 * * * systemctl stop warp-go;systemctl restart warp-go;systemctl restart wg-quick@wgcf;systemctl restart warp-svc" >> /tmp/crontab.tmp
echo "@reboot screen -UdmS up /bin/bash /root/WARP-UP.sh" >> /tmp/crontab.tmp
crontab /tmp/crontab.tmp crontab /tmp/crontab.tmp
rm /tmp/crontab.tmp rm /tmp/crontab.tmp
} }
@ -632,6 +629,7 @@ rm /tmp/crontab.tmp
unreswarp(){ unreswarp(){
crontab -l > /tmp/crontab.tmp crontab -l > /tmp/crontab.tmp
sed -i '/systemctl stop warp-go;systemctl restart warp-go;systemctl restart wg-quick@wgcf;systemctl restart warp-svc/d' /tmp/crontab.tmp sed -i '/systemctl stop warp-go;systemctl restart warp-go;systemctl restart wg-quick@wgcf;systemctl restart warp-svc/d' /tmp/crontab.tmp
sed -i '/@reboot screen/d' /tmp/crontab.tmp
crontab /tmp/crontab.tmp crontab /tmp/crontab.tmp
rm /tmp/crontab.tmp rm /tmp/crontab.tmp
} }
@ -1094,7 +1092,7 @@ systemctl disable warp-go >/dev/null 2>&1
kill -15 $(pgrep warp-go) >/dev/null 2>&1 kill -15 $(pgrep warp-go) >/dev/null 2>&1
chattr -i /etc/resolv.conf >/dev/null 2>&1 chattr -i /etc/resolv.conf >/dev/null 2>&1
sed -i '/^precedence ::ffff:0:0\/96 100/d;/^label 2002::\/16 2/d' /etc/gai.conf 2>/dev/null sed -i '/^precedence ::ffff:0:0\/96 100/d;/^label 2002::\/16 2/d' /etc/gai.conf 2>/dev/null
rm -rf /usr/local/bin/warp-go /usr/local/bin/warpplus.log /usr/local/bin/warp.conf /usr/local/bin/wgwarp.conf /usr/local/bin/sbwarp.json /usr/bin/warp-go /lib/systemd/system/warp-go.service rm -rf /usr/local/bin/warp-go /usr/local/bin/warpplus.log /usr/local/bin/warp.conf /usr/local/bin/wgwarp.conf /usr/local/bin/sbwarp.json /usr/bin/warp-go /lib/systemd/system/warp-go.service /root/WARP-UP.sh
} }
WARPun(){ WARPun(){
ab="1.仅卸载warp\n2.仅卸载socks5-warp\n3.彻底卸载warp1+2\n 请选择:" ab="1.仅卸载warp\n2.仅卸载socks5-warp\n3.彻底卸载warp1+2\n 请选择:"
@ -1624,7 +1622,7 @@ $yumapt remove wireguard-tools
$yumapt autoremove $yumapt autoremove
dig9 dig9
sed -i '/^precedence ::ffff:0:0\/96 100/d;/^label 2002::\/16 2/d' /etc/gai.conf 2>/dev/null sed -i '/^precedence ::ffff:0:0\/96 100/d;/^label 2002::\/16 2/d' /etc/gai.conf 2>/dev/null
rm -rf /usr/local/bin/wgcf /usr/bin/wg-quick /etc/wireguard/wgcf.conf /etc/wireguard/wgcf-profile.conf /etc/wireguard/buckup-account.toml /etc/wireguard/wgcf-account.toml /etc/wireguard/wgcf+p.log /etc/wireguard/ID /usr/bin/wireguard-go /usr/bin/wgcf wgcf-account.toml wgcf-profile.conf rm -rf /usr/local/bin/wgcf /usr/bin/wg-quick /etc/wireguard/wgcf.conf /etc/wireguard/wgcf-profile.conf /etc/wireguard/buckup-account.toml /etc/wireguard/wgcf-account.toml /etc/wireguard/wgcf+p.log /etc/wireguard/ID /usr/bin/wireguard-go /usr/bin/wgcf wgcf-account.toml wgcf-profile.conf /root/WARP-UP.sh
} }
WARPun(){ WARPun(){