@ -10,7 +10,7 @@ none='\e[0m'
# Root
[ [ $( id -u) != 0 ] ] && echo -e " 哎呀……请使用 ${ red } root ${ none } 用户运行 ${ yellow } ~(^_^) ${ none } " && exit 1
_version = "v1.68 "
_version = "v2.01 "
cmd = "apt-get"
@ -42,46 +42,41 @@ else
fi
backup = "/etc/v2ray/233blog_v2ray_backup.txt "
backup = "/etc/v2ray/233blog_v2ray_backup.conf "
if [ [ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ] ] && [ [ -f $backup && -d /etc/v2ray/233boy/v2ray ] ] ; then
v2ray_transport = $( sed -n '17p' $backup )
v2ray_port = $( sed -n '19p' $backup )
v2ray_id = $( sed -n '21p' $backup )
v2ray_dynamicPort_start = $( sed -n '23p' $backup )
v2ray_dynamicPort_end = $( sed -n '25p' $backup )
domain = $( sed -n '27p' $backup )
caddy_status = $( sed -n '29p' $backup )
shadowsocks_status = $( sed -n '31p' $backup )
ssport = $( sed -n '33p' $backup )
sspass = $( sed -n '35p' $backup )
ssciphers = $( sed -n '37p' $backup )
blocked_ad_status = $( sed -n '39p' $backup )
ws_path_status = $( sed -n '41p' $backup )
ws_path = $( sed -n '43p' $backup )
alterId = $( sed -n '45p' $backup )
. $backup
v2ray_ver = $( /usr/bin/v2ray/v2ray -version | head -n 1 | cut -d " " -f2)
elif [ [ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ] ] && [ [ -f /etc/v2ray/233blog_v2ray_backup.txt && -d /etc/v2ray/233boy/v2ray ] ] ; then
cp -f /etc/v2ray/233boy/v2ray/v2ray.old.sh /usr/local/bin/v2ray
chmod +x /usr/local/bin/v2ray
echo
echo -e " 哇哦.. 出现了一点小意外.. 当前环境不能使用 $cyan v2.0 $none版本以上的管理脚本 .. 已自动回退到旧版本 "
echo
echo -e " 请使用命令 $yellow v2ray reload $none重新加载配置 ...以避免发生莫名其妙的问题 "
echo
exit 1
else
echo -e " 哎呀哎呀…… ${ red } 出错咯...请重新安装V2Ray ${ none } ${ yellow } ~(^_^) ${ none } " && exit 1
fi
if [ [ $caddy_status = = "true" ] ] ; then
if [ [ $caddy_status ] ] ; then
caddy_installed = true
fi
if [ [ $shadowsocks_status = = "true" ] ] ; then
if [ [ $shadowsocks_status ] ] ; then
shadowsocks = true
fi
if [ [ $blocked_ad_status = = "true" ] ] ; then
if [ [ $blocked_ad_status ] ] ; then
is_blocked_ad = true
fi
if [ [ $v2ray_transport -ge 9 ] ] ; then
dynamicPort = true
port_range = " ${ v2ray_dynamicPort_start } - ${ v2ray_dynamicPort_end } "
fi
if [ [ $ws_path_status = = "true" ] ] ; then
if [ [ $ws_path_status ] ] ; then
is_ws_path = true
fi
@ -536,9 +531,9 @@ shadowsocks_password_config() {
read -p " $( echo -e " (默认密码: ${ cyan } 233blog.com $none ) " ) : " new_sspass
[ -z " $new_sspass " ] && new_sspass = "233blog.com"
case $new_sspass in
*/ *)
*[ /$] *)
echo
echo -e " 由于这个脚本太辣鸡了..所以密码不能包括 $red / $none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以密码不能包含 $red / $none或 $red $ $none 这两 个符号 .... "
echo
error
; ;
@ -627,7 +622,8 @@ change_shadowsocks_port() {
echo "----------------------------------------------------------------"
echo
pause
sed -i " 33s/ $ssport / $new_ssport / " $backup
# sed -i "45s/=$ssport/=$new_ssport/" $backup
backup_config ssport
del_port $ssport
open_port $new_ssport
ssport = $new_ssport
@ -657,9 +653,9 @@ change_shadowsocks_password() {
echo " 跟当前密码一毛一样....修改个鸡鸡哦"
error
; ;
*/ *)
*[ /$] *)
echo
echo -e " 由于这个脚本太辣鸡了..所以密码不能包括 $red / $none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以密码不能包含 $red / $none或 $red $ $none 这两 个符号 .... "
echo
error
; ;
@ -670,7 +666,8 @@ change_shadowsocks_password() {
echo "----------------------------------------------------------------"
echo
pause
sed -i " 35s/ $sspass / $new_sspass / " $backup
# sed -i "48s/=$sspass/=$new_sspass/" $backup
backup_config sspass
sspass = $new_sspass
config
clear
@ -710,7 +707,8 @@ change_shadowsocks_ciphers() {
echo "----------------------------------------------------------------"
echo
pause
sed -i " 37s/ $ssciphers / $new_ssciphers / " $backup
# sed -i "51s/=$ssciphers/=$new_ssciphers/" $backup
backup_config ssciphers
ssciphers = $new_ssciphers
config
clear
@ -740,7 +738,8 @@ disable_shadowsocks() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "31s/true/false/" $backup
# sed -i "31s/true/false/" $backup
backup_config -ss
del_port $ssport
shadowsocks = ''
config
@ -878,7 +877,8 @@ change_v2ray_port() {
echo "----------------------------------------------------------------"
echo
pause
sed -i " 19s/ $v2ray_port / $v2ray_port_opt / " $backup
# sed -i "19s/$v2ray_port/$v2ray_port_opt/" $backup
backup_config v2ray_port
del_port $v2ray_port
open_port $v2ray_port_opt
v2ray_port = $v2ray_port_opt
@ -1024,13 +1024,15 @@ change_v2ray_transport() {
fi
fi
if [ [ $is_ws_path ] ] ; then
sed -i "41s/true/false/" $backup
# sed -i "41s/true/false/" $backup
backup_config -ws_path
fi
elif [ [ $v2ray_transport -ge 9 ] ] ; then
del_port "multiport"
fi
open_port "multiport"
sed -i " 17s/ $v2ray_transport / $v2ray_transport_opt /; 23s/ $v2ray_dynamicPort_start / $v2ray_dynamic_port_start_input /; 25s/ $v2ray_dynamicPort_end / $v2ray_dynamic_port_end_input / " $backup
# sed -i "17s/$v2ray_transport/$v2ray_transport_opt/; 23s/$v2ray_dynamicPort_start/$v2ray_dynamic_port_start_input/; 25s/$v2ray_dynamicPort_end/$v2ray_dynamic_port_end_input/" $backup
backup_config v2ray_transport v2ray_dynamicPort_start v2ray_dynamicPort_end
port_range = " ${ v2ray_dynamic_port_start_input } - ${ v2ray_dynamic_port_end_input } "
config
clear
@ -1038,7 +1040,8 @@ change_v2ray_transport() {
view_v2ray_config_info
download_v2ray_config_ask
else
sed -i " 17s/ $v2ray_transport / $v2ray_transport_opt / " $backup
# sed -i "17s/$v2ray_transport/$v2ray_transport_opt/" $backup
backup_config v2ray_transport
if [ [ $v2ray_transport = = 4 ] ] ; then
del_port "80"
del_port "443"
@ -1058,7 +1061,8 @@ change_v2ray_transport() {
fi
fi
if [ [ $is_ws_path ] ] ; then
sed -i "41s/true/false/" $backup
# sed -i "41s/true/false/" $backup
backup_config -ws_path
fi
elif [ [ $v2ray_transport -ge 9 ] ] ; then
del_port "multiport"
@ -1121,11 +1125,14 @@ ws_config() {
ws_path_config_ask
pause
domain_check
sed -i " 17s/ $v2ray_transport / $v2ray_transport_opt /; 27s/ $domain / $new_domain / " $backup
# sed -i "17s/$v2ray_transport/$v2ray_transport_opt/; 27s/$domain/$new_domain/" $backup
backup_config v2ray_transport domain
if [ [ $new_ws_path ] ] ; then
sed -i " 41s/false/true/; 43s/ $ws_path / $new_ws_path /; $ d " $backup
echo " $proxy_site " >>$backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path = $new_ws_path
proxy_site = $new_proxy_site
is_ws_path = true
fi
@ -1176,11 +1183,14 @@ ws_config() {
ws_path_config_ask
pause
domain_check
sed -i " 17s/ $v2ray_transport / $v2ray_transport_opt /; 27s/ $domain / $new_domain /; 29s/false/true/ " $backup
# sed -i "17s/$v2ray_transport/$v2ray_transport_opt/; 27s/$domain/$new_domain/; 29s/false/true/" $backup
backup_config v2ray_transport domain caddy
if [ [ $new_ws_path ] ] ; then
sed -i " 41s/false/true/; 43s/ $ws_path / $new_ws_path /; $ d " $backup
echo " $proxy_site " >>$backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path = $new_ws_path
proxy_site = $new_proxy_site
is_ws_path = true
fi
if [ [ $v2ray_transport -ge 9 ] ] ; then
@ -1206,7 +1216,8 @@ ws_config() {
echo
pause
domain_check
sed -i " 17s/ $v2ray_transport / $v2ray_transport_opt /; 27s/ $domain / $new_domain / " $backup
# sed -i "17s/$v2ray_transport/$v2ray_transport_opt/; 27s/$domain/$new_domain/" $backup
backup_config v2ray_transport domain
if [ [ $v2ray_transport -ge 9 ] ] ; then
del_port "multiport"
fi
@ -1263,9 +1274,9 @@ ws_path_config() {
[ [ -z $new_ws_path ] ] && new_ws_path = "233blog"
case $new_ws_path in
*/ *)
*[ /$] *)
echo
echo -e " 由于这个脚本太辣鸡了..所以不能包含 $red / $none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以分流的路径 不能包含 $red / $none或 $red $ $none 这两 个符号 .... "
echo
error
; ;
@ -1285,18 +1296,24 @@ proxy_site_config() {
echo
while :; do
echo -e " 请输入 ${ magenta } 一个正确的 $none ${ cyan } 网址 $none 用来作为 ${ cyan } 网站的伪装 $none , 例如 https://liyafly.com "
echo -e " 举例...你当前的域名是 $green $domain $none , 伪装的网址的是 https://liyafly.com "
echo -e " 举例...假设 你当前的域名是 $green $domain $none , 伪装的网址的是 https://liyafly.com "
echo -e "然后打开你的域名时候...显示出来的内容就是来自 https://liyafly.com 的内容"
echo -e "其实就是一个反代...明白就好..."
echo -e "如果不能伪装成功...可以使用 v2ray config 修改伪装的网址"
read -p " $( echo -e " (默认: [ ${ cyan } https://liyafly.com $none ]): " ) " proxy_site
[ [ -z $proxy_site ] ] && proxy_site = "https://liyafly.com"
read -p " $( echo -e " (默认: [ ${ cyan } https://liyafly.com $none ]): " ) " new_ proxy_site
[ [ -z $new_ proxy_site ] ] && new_ proxy_site= "https://liyafly.com"
case $proxy_site in
case $new_proxy_site in
*[ #$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以伪装的网址不能包含 $red # $none或 $red $ $none这两个符号 .... "
echo
error
; ;
*)
echo
echo
echo -e " $yellow 伪装的网址 = ${ cyan } ${ proxy_site } $none "
echo -e " $yellow 伪装的网址 = ${ cyan } ${ new_ proxy_site} $none "
echo "----------------------------------------------------------------"
echo
break
@ -1363,11 +1380,12 @@ install_caddy() {
caddy_config( ) {
local email = $( shuf -i1-10000000000 -n1)
if [ [ $is_ws_path ] ] ; then
[ [ -z $proxy_site ] ] && proxy_site = $( sed '$!d' $backup )
# [[ -z $proxy_site ]] && proxy_site=$(sed '$!d' $backup )
cat >/etc/caddy/Caddyfile <<-EOF
$domain {
tls ${ email } @gmail.com
gzip
timeouts none
proxy / $proxy_site {
without /${ ws_path }
}
@ -1381,6 +1399,7 @@ $domain {
cat >/etc/caddy/Caddyfile <<-EOF
$domain {
tls ${ email } @gmail.com
timeouts none
proxy / 127.0.0.1:${ v2ray_port } {
websocket
}
@ -1483,12 +1502,13 @@ change_v2ray_dynamicport() {
pause
del_port "multiport"
open_port "multiport"
sed -i " 23s/ $v2ray_dynamicPort_start / $v2ray_dynamic_port_start_input /; 25s/ $v2ray_dynamicPort_end / $v2ray_dynamic_port_end_input / " $backup
# sed -i "23s/$v2ray_dynamicPort_start/$v2ray_dynamic_port_start_input/; 25s/$v2ray_dynamicPort_end/$v2ray_dynamic_port_end_input/" $backup
backup_config v2ray_dynamicPort_start v2ray_dynamicPort_end
port_range = " ${ v2ray_dynamic_port_start_input } - ${ v2ray_dynamic_port_end_input } "
config
# clear
echo
echo -e " $green 动态端口修改成功啦...你不需要修改 V2Ray 客户端配置...保持原有的配置即可... "
echo -e " $green 动态端口修改成功啦...你不需要修改 V2Ray 客户端配置...保持原有的配置即可... $none "
echo
else
echo
@ -1623,7 +1643,8 @@ change_v2ray_id() {
echo "----------------------------------------------------------------"
echo
pause
sed -i " 21s/ $v2ray_id / $uuid /; " $backup
# sed -i "21s/$v2ray_id/$uuid/;" $backup
backup_config uuid
v2ray_id = $uuid
config
clear
@ -1685,7 +1706,8 @@ change_domain() {
echo
pause
domain_check
sed -i " 27s/ $domain / $new_domain / " $backup
# sed -i "27s/$domain/$new_domain/" $backup
backup_config domain
domain = $new_domain
caddy_config
config
@ -1730,9 +1752,9 @@ change_ws_path_config() {
echo
error
; ;
*/ *)
*[ /$] *)
echo
echo -e " 由于这个脚本太辣鸡了..所以不能包含 $red / $none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以分流的路径 不能包含 $red / $none或 $red $ $none 这两 个符号 .... "
echo
error
; ;
@ -1747,7 +1769,8 @@ change_ws_path_config() {
esac
done
pause
sed -i " 43s/ $ws_path / $new_ws_path / " $backup
# sed -i "43s/$ws_path/$new_ws_path/" $backup
backup_config ws_path
ws_path = $new_ws_path
caddy_config
config
@ -1757,9 +1780,11 @@ change_ws_path_config() {
elif [ [ $v2ray_transport = = 4 && $caddy_installed ] ] ; then
ws_path_config_ask
if [ [ $new_ws_path ] ] ; then
sed -i " 41s/false/true/; 43s/ $ws_path / $new_ws_path /; $ d " $backup
echo " $proxy_site " >>$backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path = $new_ws_path
proxy_site = $new_proxy_site
is_ws_path = true
caddy_config
config
@ -1800,14 +1825,20 @@ change_proxy_site_config() {
echo -e "然后打开你的域名时候...显示出来的内容就是来自 https://liyafly.com 的内容"
echo -e "其实就是一个反代...明白就好..."
echo -e "如果不能伪装成功...可以使用 v2ray config 修改伪装的网址"
read -p " $( echo -e " (当前伪装的网址: [ ${ cyan } $( sed '$!d' $backup ) $none ]): " ) " proxy_site
[ [ -z $proxy_site ] ] && error && continue
read -p " $( echo -e " (当前伪装的网址: [ ${ cyan } ${ proxy_site } $none ]): " ) " new_ proxy_site
[ [ -z $new_ proxy_site ] ] && error && continue
case $proxy_site in
case $new_proxy_site in
*[ #$]*)
echo
echo -e " 由于这个脚本太辣鸡了..所以伪装的网址不能包含 $red # $none或 $red $ $none这两个符号 .... "
echo
error
; ;
*)
echo
echo
echo -e " $yellow 伪装的网址 = ${ cyan } ${ proxy_site } $none "
echo -e " $yellow 伪装的网址 = ${ cyan } ${ new_ proxy_site} $none "
echo "----------------------------------------------------------------"
echo
break
@ -1815,8 +1846,10 @@ change_proxy_site_config() {
esac
done
pause
sed -i " $ d " $backup
echo " $proxy_site " >>$backup
# sed -i "$ d" $backup
# echo "$proxy_site" >>$backup
backup_config proxy_site
proxy_site = $new_proxy_site
caddy_config
echo
echo
@ -1828,9 +1861,11 @@ change_proxy_site_config() {
elif [ [ $v2ray_transport = = 4 && $caddy_installed ] ] ; then
ws_path_config_ask
if [ [ $new_ws_path ] ] ; then
sed -i " 41s/false/true/; 43s/ $ws_path / $new_ws_path /; $ d " $backup
echo " $proxy_site " >>$backup
# sed -i "41s/false/true/; 43s/$ws_path/$new_ws_path/; $ d" $backup
# echo "$proxy_site" >>$backup
backup_config +ws_path
ws_path = $new_ws_path
proxy_site = $new_proxy_site
is_ws_path = true
caddy_config
config
@ -1893,7 +1928,8 @@ disable_ws_path() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "41s/true/false/" $backup
# sed -i "41s/true/false/" $backup
backup_config -ws_path
is_ws_path = ''
caddy_config
config
@ -1970,7 +2006,8 @@ blocked_hosts() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "39s/false/true/" $backup
# sed -i "39s/false/true/" $backup
backup_config +ad
is_blocked_ad = true
config
echo
@ -1988,7 +2025,8 @@ blocked_hosts() {
echo "----------------------------------------------------------------"
echo
pause
sed -i "39s/true/false/" $backup
# sed -i "39s/true/false/" $backup
backup_config -ad
is_blocked_ad = ''
config
echo
@ -2013,18 +2051,25 @@ blocked_hosts() {
change_v2ray_alterId( ) {
echo
while :; do
echo -e " 请输入 ${ yellow } alterId ${ none } 的数值 [ ${ magenta } 1 -65535$none ] "
echo -e " 请输入 ${ yellow } alterId ${ none } 的数值 [ ${ magenta } 0 -65535$none ] "
read -p " $( echo -e " (当前数值是: ${ cyan } $alterId $none ): " ) " new_alterId
[ [ -z $new_alterId ] ] && error && continue
case $new_alterId in
[ 1-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | 6[ 0-4] [ 0-9] [ 0-9] [ 0-9] | 65[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
$alterId )
echo
echo -e " 大佬...跟 当前 alterId 一毛一样啊...修改个鸡鸡哦 "
echo
error
; ;
[ 0-9] | [ 1-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] | [ 1-9] [ 0-9] [ 0-9] [ 0-9] | [ 1-5] [ 0-9] [ 0-9] [ 0-9] [ 0-9] | 6[ 0-4] [ 0-9] [ 0-9] [ 0-9] | 65[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
echo
echo
echo -e " $yellow alterId = $cyan $new_alterId $none "
echo "----------------------------------------------------------------"
echo
pause
sed -i " 45s/ $alterId / $new_alterId / " $backup
# sed -i "45s/$alterId/$new_alterId/" $backup
backup_config alterId
alterId = $new_alterId
config
clear
@ -3420,7 +3465,8 @@ config() {
if [ [ $new_shadowsocks ] ] ; then
open_port $new_ssport
sed -i " 31s/false/true/; 33s/ $ssport / $new_ssport /; 35s/ $sspass / $new_sspass /; 37s/ $ssciphers / $new_ssciphers / " $backup
# sed -i "31s/false/true/; 33s/$ssport/$new_ssport/; 35s/$sspass/$new_sspass/; 37s/$ssciphers/$new_ssciphers/" $backup
backup_config +ss
fi
if [ [ $v2ray_port = = "80" ] ] ; then
@ -3434,6 +3480,70 @@ config() {
fi
do_service restart v2ray
}
backup_config( ) {
for keys in $* ; do
case $keys in
v2ray_transport)
sed -i " 18s/= $v2ray_transport /= $v2ray_transport_opt / " $backup
; ;
v2ray_port)
sed -i " 21s/= $v2ray_port /= $v2ray_port_opt / " $backup
; ;
uuid)
sed -i " 24s/= $v2ray_id /= $uuid / " $backup
; ;
alterId)
sed -i " 27s/= $alterId /= $new_alterId / " $backup
; ;
v2ray_dynamicPort_start)
sed -i " 30s/= $v2ray_dynamicPort_start /= $v2ray_dynamic_port_start_input / " $backup
; ;
v2ray_dynamicPort_end)
sed -i " 33s/= $v2ray_dynamicPort_end /= $v2ray_dynamic_port_end_input / " $backup
; ;
domain)
sed -i " 36s/= $domain /= $new_domain / " $backup
; ;
caddy)
sed -i "39s/=/=true/" $backup
; ;
+ss)
sed -i " 42s/=/=true/; 45s/= $ssport /= $new_ssport /; 48s/= $sspass /= $new_sspass /; 51s/= $ssciphers /= $new_ssciphers / " $backup
; ;
-ss)
sed -i "42s/=true/=/" $backup
; ;
ssport)
sed -i " 45s/= $ssport /= $new_ssport / " $backup
; ;
sspass)
sed -i " 48s/= $sspass /= $new_sspass / " $backup
; ;
ssciphers)
sed -i " 51s/= $ssciphers /= $new_ssciphers / " $backup
; ;
+ad)
sed -i "54s/=/=true/" $backup
; ;
-ad)
sed -i "54s/=true/=/" $backup
; ;
+ws_path)
sed -i " 57s/=/=true/; 60s/= $ws_path /= $new_ws_path /; 63s#= $proxy_site #= $new_proxy_site # " $backup
; ;
-ws_path)
sed -i "57s/=true/=/" $backup
; ;
ws_path)
sed -i " 60s/= $ws_path /= $new_ws_path / " $backup
; ;
proxy_site)
sed -i " 63s#= $proxy_site #= $new_proxy_site # " $backup
; ;
esac
done
}
_boom_( ) {
echo
echo -e " $green ........... V2Ray 配置链接集合 by 233blog.com .......... $none "
@ -3686,10 +3796,12 @@ stop)
stop_v2ray
; ;
restart)
[ [ $v2ray_transport = = "4" && $caddy_installed ] ] && do_service restart caddy
restart_v2ray
; ;
reload)
config
[ [ $v2ray_transport = = "4" && $caddy_installed ] ] && caddy_config
clear
view_v2ray_config_info
download_v2ray_config_ask