@ -10,7 +10,7 @@ none='\e[0m'
# Root
[ [ $( id -u) != 0 ] ] && echo -e " 哎呀……请使用 ${ red } root ${ none } 用户运行 ${ yellow } ~(^_^) ${ none } " && exit 1
_version = "v1.53 "
_version = "v2.01 "
cmd = "apt-get"
@ -42,45 +42,41 @@ else
fi
backup = "/etc/v2ray/233blog_v2ray_backup.txt"
if [ [ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ] ] && [ [ -f $backup ] ] ; 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 )
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
. $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
@ -96,6 +92,11 @@ if [ $v2ray_pid ]; then
else
v2ray_status = " $red未在运行 $none "
fi
if [ [ $v2ray_transport = = "4" && $caddy_installed ] ] && [ [ $caddy_pid ] ] ; then
caddy_run_status = " $green正在运行 $none "
else
caddy_run_status = " $red未在运行 $none "
fi
transport = (
TCP
@ -182,7 +183,7 @@ create_vmess_URL_config() {
"add" : " ${ domain } " ,
"port" : "443" ,
"id" : " ${ v2ray_id } " ,
"aid" : "233 " ,
"aid" : " ${ alterId } " ,
"net" : "ws" ,
"type" : "none" ,
"host" : " ${ host } " ,
@ -197,7 +198,7 @@ create_vmess_URL_config() {
"add" : " ${ ip } " ,
"port" : " ${ v2ray_port } " ,
"id" : " ${ v2ray_id } " ,
"aid" : "233 " ,
"aid" : " ${ alterId } " ,
"net" : " ${ net } " ,
"type" : " ${ header } " ,
"host" : " ${ host } " ,
@ -225,7 +226,7 @@ view_v2ray_config_info() {
echo
echo -e " $yellow 用户ID (User ID / UUID) = $cyan ${ v2ray_id } $none "
echo
echo -e " $yellow 额外ID (Alter Id) = ${ cyan } 233 ${ none } "
echo -e " $yellow 额外ID (Alter Id) = ${ cyan } ${ alterId } ${ none } "
echo
echo -e " $yellow 传输协议 (Network) = ${ cyan } ${ network } $none "
echo
@ -252,7 +253,7 @@ view_v2ray_config_info() {
echo
echo -e " $yellow 用户ID (User ID / UUID) = $cyan ${ v2ray_id } $none "
echo
echo -e " $yellow 额外ID (Alter Id) = ${ cyan } 233 ${ none } "
echo -e " $yellow 额外ID (Alter Id) = ${ cyan } ${ alterId } ${ none } "
echo
echo -e " $yellow 传输协议 (Network) = ${ cyan } ${ network } $none "
echo
@ -477,17 +478,18 @@ shadowsocks_config() {
done
}
shadowsocks_port_config( ) {
local random = $( shuf -i20001-65535 -n1)
while :; do
echo -e "请输入 " $yellow "Shadowsocks" $none " 端口 [" $magenta "1-65535" $none "],不能和 " $yellow "V2ray" $none " 端口相同"
read -p " $( echo -e " (默认端口: ${ cyan } 6666 $none ): " ) " new_ssport
[ -z " $new_ssport " ] && new_ssport = "6666"
read -p " $( echo -e " (默认端口: ${ cyan } ${ random } $none ): " ) " new_ssport
[ -z " $new_ssport " ] && new_ssport = $random
case $new_ssport in
$v2ray_port )
echo
echo -e " 不能和 $cyan V2Ray 端口 $none一毛一样 .... "
error
; ;
[ 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] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 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] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $v2ray_transport = = "4" && $new_ssport = = "80" ] ] || [ [ $v2ray_transport = = "4" && $new_ssport = = "443" ] ] ; then
echo
echo -e "由于你选择了 " $green "WebSocket + TLS" $none " 传输协议."
@ -529,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
; ;
@ -596,7 +598,7 @@ change_shadowsocks_port() {
echo -e " 不能和 $cyan V2Ray 端口 $none一毛一样 .... "
error
; ;
[ 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] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 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] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $v2ray_transport = = "4" && $new_ssport = = "80" ] ] || [ [ $v2ray_transport = = "4" && $new_ssport = = "443" ] ] ; then
echo
echo -e "由于你选择了 " $green "WebSocket + TLS" $none " 传输协议."
@ -620,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
@ -650,9 +653,9 @@ change_shadowsocks_password() {
echo " 跟当前密码一毛一样....修改个鸡鸡哦"
error
; ;
*/ *)
*[ /$] *)
echo
echo -e " 由于这个脚本太辣鸡了..所以密码不能包括 $red / $none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以密码不能包含 $red / $none或 $red $ $none 这两 个符号 .... "
echo
error
; ;
@ -663,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
@ -680,7 +684,7 @@ change_shadowsocks_password() {
change_shadowsocks_ciphers( ) {
echo
while :; do
echo -e "请选择 " $yellow "Shadowsocks" $none " 加密协议 [ ${ magenta } 1-8 $none ] "
echo -e "请选择 " $yellow "Shadowsocks" $none " 加密协议 [ ${ magenta } 1- ${# ciphers [*] } $none ] "
for ( ( i = 1; i <= ${# ciphers [*] } ; i++) ) ; do
ciphers_show = " ${ ciphers [ $i - 1] } "
echo
@ -703,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
@ -733,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
@ -817,6 +823,10 @@ change_v2ray_config() {
blocked_hosts
break
; ;
[ Dd] | [ Aa] [ Ii] | 233 | 233[ Bb] [ Ll] [ Oo] [ Gg] | 233[ Bb] [ Ll] [ Oo] [ Gg] .[ Cc] [ Oo] [ Mm] | 233[ Bb] [ Oo] [ Yy] | [ Aa] [ Ll] [ Tt] [ Ee] [ Rr] [ Ii] [ Dd] )
change_v2ray_alterId
break
; ;
*)
error
; ;
@ -844,7 +854,7 @@ change_v2ray_port() {
echo " 哎呀...跟当前端口一毛一样呀...修改个鸡鸡哦"
error
; ;
[ 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] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 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] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $shadowsocks ] ] && [ [ $v2ray_port_opt = = $ssport ] ] ; then
echo
echo -e " ...不能跟 $cyan Shadowsocks 端口 $none一毛一样 ... "
@ -867,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
@ -923,7 +934,7 @@ change_v2ray_transport_ask() {
change_v2ray_transport( ) {
echo
while :; do
echo -e "请选择 " $yellow "V2Ray" $none " 传输协议 [ ${ magenta } 1-15 $none ] "
echo -e "请选择 " $yellow "V2Ray" $none " 传输协议 [ ${ magenta } 1- ${# transport [*] } $none ] "
echo
for ( ( i = 1; i <= ${# transport [*] } ; i++) ) ; do
Stream = " ${ transport [ $i - 1] } "
@ -1013,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
@ -1027,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"
@ -1047,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"
@ -1110,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
@ -1165,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
@ -1195,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
@ -1252,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
; ;
@ -1274,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
@ -1295,12 +1323,19 @@ proxy_site_config() {
}
install_caddy( ) {
if [ [ $cmd = = "yum" ] ] ; then
[ [ $( pgrep "httpd" ) ] ] && systemctl stop httpd
[ [ $( command -v httpd) ] ] && yum remove httpd -y
else
[ [ $( pgrep "apache2" ) ] ] && service apache2 stop
[ [ $( command -v apache2) ] ] && apt-get remove apache2* -y
fi
local caddy_tmp = "/tmp/install_caddy/"
local caddy_tmp_file = "/tmp/install_caddy/caddy.tar.gz"
if [ [ $sys_bit = = "i386" || $sys_bit = = "i686" ] ] ; then
local caddy_download_link = "https://caddyserver.com/download/linux/386"
local caddy_download_link = "https://caddyserver.com/download/linux/386?license=personal "
elif [ [ $sys_bit = = "x86_64" ] ] ; then
local caddy_download_link = "https://caddyserver.com/download/linux/amd64"
local caddy_download_link = "https://caddyserver.com/download/linux/amd64?license=personal "
else
echo -e " $red 自动安装 Caddy 失败!不支持你的系统。 $none " && exit 1
fi
@ -1318,18 +1353,26 @@ install_caddy() {
echo -e " $red 安装 Caddy 出错! " && exit 1
fi
setcap CAP_NET_BIND_SERVICE = +eip /usr/local/bin/caddy
if [ [ $systemd ] ] ; then
cp -f ${ caddy_tmp } init/linux-systemd/caddy.service /lib/systemd/system/
sed -i "s/www-data/root/g" /lib/systemd/system/caddy.service
# sed -i "s/www-data/root/g" /lib/systemd/system/caddy.service
systemctl enable caddy
else
cp -f ${ caddy_tmp } init/linux-sysvinit/caddy /etc/init.d/caddy
sed -i "s/www-data/root/g" /etc/init.d/caddy
# sed -i "s/www-data/root/g" /etc/init.d/caddy
chmod +x /etc/init.d/caddy
update-rc.d -f caddy defaults
fi
mkdir -p /etc/ssl/caddy
if [ -z " $( grep www-data /etc/passwd) " ] ; then
useradd -M -s /usr/sbin/nologin www-data
fi
chown -R www-data.www-data /etc/ssl/caddy
mkdir -p /etc/caddy/
rm -rf $caddy_tmp
@ -1337,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 }
}
@ -1355,6 +1399,7 @@ $domain {
cat >/etc/caddy/Caddyfile <<-EOF
$domain {
tls ${ email } @gmail.com
timeouts none
proxy / 127.0.0.1:${ v2ray_port } {
websocket
}
@ -1377,7 +1422,7 @@ v2ray_dynamic_port_start() {
echo " 不能和 V2Ray 端口一毛一样...."
error
; ;
[ 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] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 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] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $shadowsocks ] ] && [ [ $v2ray_dynamic_port_start_input = = $ssport ] ] ; then
echo
echo " 不能和 Shadowsocks 端口一毛一样...."
@ -1415,7 +1460,7 @@ v2ray_dynamic_port_end() {
read -p " $( echo -e " (默认结束端口: ${ cyan } 20000 $none ): " ) " v2ray_dynamic_port_end_input
[ -z $v2ray_dynamic_port_end_input ] && v2ray_dynamic_port_end_input = 20000
case $v2ray_dynamic_port_end_input 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] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 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] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $v2ray_dynamic_port_end_input -le $v2ray_dynamic_port_start_input ] ] ; then
echo
@ -1457,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
@ -1506,7 +1552,7 @@ change_v2ray_dynamic_port_start() {
echo " 不能和 V2Ray 端口一毛一样...."
error
; ;
[ 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] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 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] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $shadowsocks ] ] && [ [ $v2ray_dynamic_port_start_input = = $ssport ] ] ; then
echo
echo " 不能和 Shadowsocks 端口一毛一样...."
@ -1544,7 +1590,7 @@ change_v2ray_dynamic_port_end() {
read -p " $( echo -e " (当前动态结束端口: ${ cyan } $v2ray_dynamicPort_end $none ): " ) " v2ray_dynamic_port_end_input
[ -z $v2ray_dynamic_port_end_input ] && error && continue
case $v2ray_dynamic_port_end_input 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] | [ 1-6] [ 0-5] [ 0-5] [ 0-3] [ 0-5] )
[ 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] | 6 5[ 0-4] [ 0-9] [ 0-9] | 655[ 0-3] [ 0-5] )
if [ [ $v2ray_dynamic_port_end_input -le $v2ray_dynamic_port_start_input ] ] ; then
echo
@ -1597,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
@ -1659,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
@ -1704,9 +1752,9 @@ change_ws_path_config() {
echo
error
; ;
*/ *)
*[ /$] *)
echo
echo -e " 由于这个脚本太辣鸡了..所以不能包含 $red / $none 这个符号.... "
echo -e " 由于这个脚本太辣鸡了..所以分流的路径 不能包含 $red / $none或 $red $ $none 这两 个符号 .... "
echo
error
; ;
@ -1721,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
@ -1731,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
@ -1774,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
@ -1789,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
@ -1802,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
@ -1838,7 +1899,7 @@ change_proxy_site_config() {
}
domain_check( ) {
# test_domain=$(dig $new_domain +short)
test_domain = $( ping $new_domain -c 1 | grep -oP -m1 "([ \d.]+ ){3}\d" )
test_domain = $( ping $new_domain -c 1 | grep -oP -m1 "(\d+\ .){3}\d+ " )
if [ [ $test_domain != $ip ] ] ; then
echo
echo -e " $red 检测域名解析错误.... $none "
@ -1867,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
@ -1944,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
@ -1962,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
@ -1984,6 +2048,41 @@ blocked_hosts() {
done
}
change_v2ray_alterId( ) {
echo
while :; do
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
$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
backup_config alterId
alterId = $new_alterId
config
clear
view_v2ray_config_info
download_v2ray_config_ask
break
; ;
*)
error
; ;
esac
done
}
v2ray_service( ) {
while :; do
echo
@ -2211,7 +2310,7 @@ create_v2ray_config_text() {
echo
echo " 用户ID (User ID / UUID) = ${ v2ray_id } "
echo
echo "额外ID (Alter Id) = 233 "
echo " 额外ID (Alter Id) = ${ alterId } "
echo
echo " 传输协议 (Network) = ${ network } "
echo
@ -2238,7 +2337,7 @@ create_v2ray_config_text() {
echo
echo " 用户ID (User ID / UUID) = ${ v2ray_id } "
echo
echo "额外ID (Alter Id) = 233 "
echo " 额外ID (Alter Id) = ${ alterId } "
echo
echo " 传输协议 (Network) = ${ network } "
echo
@ -2332,7 +2431,7 @@ get_v2ray_config_qr_link() {
if [ [ $ios_qr && $link3 ] ] ; then
echo -e " $yellow 适用于 Pepi / ShadowRay = $cyan ${ link3 } $none "
echo
echo " 请在 Pepi / ShadowRay 配置界面将 Alter Id 设置为 233 (如果你使用 Pepi / ShadowRay) "
echo " 请在 Pepi / ShadowRay 配置界面将 Alter Id 设置为 ${ alterId } (如果你使用 Pepi / ShadowRay) "
if [ [ $v2ray_transport = = 4 ] ] ; then
echo
echo " 请在 Pepi / ShadowRay 配置界面打开 TLS (Enable TLS) (如果你使用 Pepi / ShadowRay)"
@ -2488,8 +2587,8 @@ open_port() {
iptables-save >/etc/iptables.rules.v4
ip6tables-save >/etc/iptables.rules.v6
else
service iptables save
service ip6tables save
service iptables save >/dev/null 2>& 1
service ip6tables save >/dev/null 2>& 1
fi
}
@ -2521,8 +2620,8 @@ del_port() {
iptables-save >/etc/iptables.rules.v4
ip6tables-save >/etc/iptables.rules.v6
else
service iptables save
service ip6tables save
service iptables save >/dev/null 2>& 1
service ip6tables save >/dev/null 2>& 1
fi
}
update( ) {
@ -2583,6 +2682,8 @@ update_v2ray() {
echo
echo -e " $green 更新成功啦...当前 V2Ray 版本: ${ cyan } $v2ray_latest_ver $none "
echo
echo -e " $yellow 温馨提示: 为了避免出现莫名其妙的问题...所以客户端 V2Ray 版本最好也是: ${ cyan } $v2ray_latest_ver $none "
echo
rm -rf /tmp/v2ray
else
echo
@ -2720,7 +2821,7 @@ uninstall_v2ray() {
echo
echo "如果你觉得这个脚本有哪些地方不够好的话...请告诉我"
echo
echo "反馈问题: https://github.com/233boy/v2ray/issus"
echo "反馈问题: https://github.com/233boy/v2ray/issue s"
echo
elif [ [ $is_uninstall_v2ray ] ] ; then
@ -2764,7 +2865,7 @@ uninstall_v2ray() {
echo
echo "如果你觉得这个脚本有哪些地方不够好的话...请告诉我"
echo
echo "反馈问题: https://github.com/233boy/v2ray/issus"
echo "反馈问题: https://github.com/233boy/v2ray/issue s"
echo
fi
}
@ -3346,10 +3447,10 @@ config() {
fi
sed -i " 8s/2333/ $v2ray_port /; 14s/ $old_id / $v2ray_id / " $v2ray_server_config
sed -i " 8s/2333/ $v2ray_port /; 14s/ $old_id / $v2ray_id /; 16s/233/ $alterId / " $v2ray_server_config
if [ [ $v2ray_transport_opt -eq 4 || $v2ray_transport -eq 4 ] ] ; then
sed -i " s/233blog.com/ $domain /; 22s/2333/443/; 25s/ $old_id / $v2ray_id / " $v2ray_client_config
sed -i " s/233blog.com/ $domain /; 22s/2333/443/; 25s/ $old_id / $v2ray_id /; 26s/233/ $alterId / " $v2ray_client_config
if [ [ $is_ws_path ] ] ; then
sed -i " 41s/233blog/ $ws_path / " $v2ray_client_config
else
@ -3357,18 +3458,92 @@ config() {
fi
else
[ [ -z $ip ] ] && get_ip
sed -i " s/233blog.com/ $ip /; 22s/2333/ $v2ray_port /; 25s/ $old_id / $v2ray_id / " $v2ray_client_config
sed -i " s/233blog.com/ $ip /; 22s/2333/ $v2ray_port /; 25s/ $old_id / $v2ray_id /; 26s/233/ $alterId / " $v2ray_client_config
fi
zip -q -r -j --password "233blog.com" /etc/v2ray/233blog_v2ray.zip $v2ray_client_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
if [ [ $cmd = = "yum" ] ] ; then
[ [ $( pgrep "httpd" ) ] ] && systemctl stop httpd >/dev/null 2>& 1
[ [ $( command -v httpd) ] ] && yum remove httpd -y >/dev/null 2>& 1
else
[ [ $( pgrep "apache2" ) ] ] && service apache2 stop >/dev/null 2>& 1
[ [ $( command -v apache2) ] ] && apt-get remove apache2* -y >/dev/null 2>& 1
fi
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 "
@ -3607,7 +3782,11 @@ Q | ssqr)
; ;
status)
echo
echo -e " V2Ray 状态: $v2ray_status "
if [ [ $v2ray_transport = = "4" && $caddy_installed ] ] ; then
echo -e " V2Ray 状态: $v2ray_status / Caddy 状态: $caddy_run_status "
else
echo -e " V2Ray 状态: $v2ray_status "
fi
echo
; ;
start)
@ -3617,8 +3796,16 @@ 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
; ;
log)
view_v2ray_log
; ;
@ -3638,6 +3825,11 @@ un | uninstall)
233 | 2333 | 233boy | 233blog | 233blog.com)
_boom_
; ;
v | version)
echo
echo -e " 当前 V2Ray 版本: ${ green } $v2ray_ver $none / 当前 V2Ray 管理脚本版本: ${ cyan } $_version $none "
echo
; ;
bbr)
other
; ;