diff --git a/tools/v1xx_to_v2xx.sh b/tools/v1xx_to_v2xx.sh new file mode 100644 index 0000000..64d96ec --- /dev/null +++ b/tools/v1xx_to_v2xx.sh @@ -0,0 +1,103 @@ +#!/bin/bash +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) +proxy_site=$(sed '$!d' $backup) +if [[ $caddy_status == "true" ]]; then + caddy_installed=true +fi +if [[ $shadowsocks_status == "true" ]]; then + shadowsocks=true +fi +if [[ $blocked_ad_status == "true" ]]; then + is_blocked_ad=true +fi +if [[ $ws_path_status == "true" ]]; then + is_ws_path=true +fi + +cat >/etc/v2ray/233blog_v2ray_backup.conf <<-EOF +# ----------------------------------- +# 警告...请不要修改或删除这个文件...谢谢 +# 警告...请不要修改或删除这个文件...谢谢 +# 警告...请不要修改或删除这个文件...谢谢 +# ----------------------------------- + +# ---- 再次提醒 ---- +# 大胸弟...如果你看到了这个...记得不要修改或更改这个文件 + +# ---- 说明 ---- +# 嗯……这个文件呢,是用来备份一些设置的 +# 我懒...不想用 JQ 去解析 JSON.... +# 那就把 V2Ray 配置文件的一些重要参数提取出来 +# 然后..在修改 V2Ray 配置的时候再重写一下就 OK 啦... +# 嗯…笨笨的方法 + +# ---- V2Ray 传输协议 ----- +v2ray_transport=$v2ray_transport + +#---- V2Ray 端口 ----- +v2ray_port=$v2ray_port + +#---- UUID ----- +v2ray_id=$v2ray_port + +#---- alterId ----- +alterId=233 + +#---- V2Ray 动态端口开始 ----- +v2ray_dynamicPort_start=$v2ray_dynamicPort_start + +#---- V2Ray 动态端口结束 ----- +v2ray_dynamicPort_end=$v2ray_dynamicPort_end + +#---- 域名 ----- +domain=$domain + +#---- caddy ----- +caddy_status=$caddy_installed + +#---- Shadowsocks ----- +shadowsocks_status=$shadowsocks + +#---- Shadowsocks 端口 ----- +ssport=$ssport + +#---- Shadowsocks 密码 ----- +sspass=$sspass + +#---- Shadowsocks 加密协议 ----- +ssciphers=$ssciphers + +#---- 屏蔽广告 ----- +blocked_ad_status=$is_blocked_ad + +#---- 网站伪装 ----- +ws_path_status=$is_ws_path + +#---- 伪装的路径 ----- +ws_path=$ws_path + +#---- 伪装的网址 ----- +proxy_site=$proxy_site + EOF +cp -f /etc/v2ray/233boy/v2ray/v2ray.sh /usr/local/bin/v2ray +chmod +x /usr/local/bin/v2ray +rm -rf $backup +echo +echo -e " 哇哦.. 由于大佬你是从 1.xx 升级到 2.xx 管理脚本的.." +echo +echo -e " 请使用命令$yellow v2ray reload $none重新加载配置...以避免发生莫名其妙的问题" +echo +exit 1 diff --git a/v2ray.old.sh b/v2ray.old.sh index 21aaf1c..e40cd83 100644 --- a/v2ray.old.sh +++ b/v2ray.old.sh @@ -10,7 +10,7 @@ none='\e[0m' # Root [[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1 -_version="v1.72" +_version="v1.73" cmd="apt-get" @@ -46,20 +46,7 @@ backup="/etc/v2ray/233blog_v2ray_backup.txt" 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) + . /etc/v2ray/233boy/v2ray/tools/v1xx_to_v2xx.sh v2ray_ver=$(/usr/bin/v2ray/v2ray -version | head -n 1 | cut -d " " -f2) diff --git a/v2ray.sh b/v2ray.sh index 061fe93..dce1905 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -10,7 +10,7 @@ none='\e[0m' # Root [[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1 -_version="v2.02" +_version="v2.1" cmd="apt-get" @@ -51,14 +51,8 @@ if [[ -f /usr/bin/v2ray/v2ray && -f /etc/v2ray/config.json ]] && [[ -f $backup & 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 + . /etc/v2ray/233boy/v2ray/tools/v1xx_to_v2xx.sh + else echo -e " 哎呀哎呀…… ${red}出错咯...请重新安装V2Ray${none} ${yellow}~(^_^) ${none}" && exit 1 fi @@ -2266,15 +2260,16 @@ get_v2ray_config_link() { echo -e "$green 正在生成链接.... 稍等片刻即可....$none" echo local random=$(echo $RANDOM-$RANDOM-$RANDOM | base64) - local link=$(curl -s --upload-file /etc/v2ray/233blog_v2ray.zip "https://transfer.sh/${random}_233blog_v2ray.zip") + # local link=$(curl -s --upload-file /etc/v2ray/233blog_v2ray.zip "https://transfer.sh/${random}_233blog_v2ray.zip") + local link=$(curl -s --upload-file $v2ray_client_config "https://transfer.sh/${random}_233blog_v2ray.json") if [[ $link ]]; then echo echo "---------- V2Ray 客户端配置文件链接 -------------" echo echo -e "$yellow 链接 = $cyan$link$none" echo - echo -e "$yellow 解压密码 = ${cyan}233blog.com$none" - echo + # echo -e "$yellow 解压密码 = ${cyan}233blog.com$none" + # echo echo -e "$yellow SOCKS 监听端口 = ${cyan}2333${none}" echo echo -e "${yellow} HTTP 监听端口 = ${cyan}6666$none" @@ -3461,7 +3456,7 @@ 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 + # zip -q -r -j --password "233blog.com" /etc/v2ray/233blog_v2ray.zip $v2ray_client_config if [[ $new_shadowsocks ]]; then open_port $new_ssport @@ -3578,7 +3573,8 @@ _boom_() { local random1=$(echo $RANDOM-$RANDOM-$RANDOM | base64) local random2=$(echo $RANDOM-$RANDOM-$RANDOM | base64) local random3=$(echo $RANDOM-$RANDOM-$RANDOM | base64) - local link1=$(curl -s --upload-file /etc/v2ray/233blog_v2ray.zip "https://transfer.sh/${random1}_233blog_v2ray.zip") + # local link1=$(curl -s --upload-file /etc/v2ray/233blog_v2ray.zip "https://transfer.sh/${random1}_233blog_v2ray.zip") + local link1=$(curl -s --upload-file $v2ray_client_config "https://transfer.sh/${random1}_233blog_v2ray.json") local link2=$(curl -s --upload-file /tmp/233blog_v2ray.txt "https://transfer.sh/${random2}_233blog_v2ray.txt") local link3=$(curl -s --upload-file /tmp/233blog_v2ray.png "https://transfer.sh/${random3}_233blog_v2ray.png")