From b90a9471d7359e851374a6c87846fa385f839662 Mon Sep 17 00:00:00 2001 From: 233boy Date: Sat, 21 Apr 2018 12:36:46 +0800 Subject: [PATCH 1/3] fix centos7 check domain ip addr issues --- install.sh | 2 +- v2ray.old.sh | 4 ++-- v2ray.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index be3060a..24f40e2 100644 --- a/install.sh +++ b/install.sh @@ -674,7 +674,7 @@ domain_check() { # $cmd install dnsutils -y # fi # test_domain=$(dig $domain +short) - test_domain=$(ping $domain -c 1 | grep -oP -m1 "(\d+\.){3}\d+") + test_domain=$(ping $domain -c 1 | grep -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}") if [[ $test_domain != $ip ]]; then echo echo -e "$red 检测域名解析错误....$none" diff --git a/v2ray.old.sh b/v2ray.old.sh index 7068b2f..a20c1b5 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.70" +_version="v1.71" cmd="apt-get" @@ -1861,7 +1861,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 -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}") if [[ $test_domain != $ip ]]; then echo echo -e "$red 检测域名解析错误....$none" diff --git a/v2ray.sh b/v2ray.sh index 41495bf..061fe93 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.01" +_version="v2.02" cmd="apt-get" @@ -1899,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 -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}") if [[ $test_domain != $ip ]]; then echo echo -e "$red 检测域名解析错误....$none" From 7e11e815d4720065ed9ef92dd97a3b6733d7e9af Mon Sep 17 00:00:00 2001 From: 233boy Date: Sun, 22 Apr 2018 10:21:13 +0800 Subject: [PATCH 2/3] bug fix --- v2ray.old.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v2ray.old.sh b/v2ray.old.sh index a20c1b5..21aaf1c 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.71" +_version="v1.72" cmd="apt-get" @@ -2627,7 +2627,7 @@ update_v2ray.sh() { echo cd /etc/v2ray/233boy/v2ray git pull - cp -f /etc/v2ray/233boy/v2ray/v2ray.sh /usr/local/bin/v2ray + cp -f /etc/v2ray/233boy/v2ray/v2ray.old.sh /usr/local/bin/v2ray chmod +x /usr/local/bin/v2ray echo echo -e "$green 更新成功啦...当前 V2Ray 管理脚本 版本: ${cyan}$latest_version$none" From a4bcd45bcc0bbe6bcacb8c53d7feeac310be2433 Mon Sep 17 00:00:00 2001 From: 233boy Date: Sun, 22 Apr 2018 22:11:38 +0800 Subject: [PATCH 3/3] support v1.xx update to v2.xx, use [ v2ray link ] get v2ray config link --- tools/v1xx_to_v2xx.sh | 103 ++++++++++++++++++++++++++++++++++++++++++ v2ray.old.sh | 17 +------ v2ray.sh | 24 ++++------ 3 files changed, 115 insertions(+), 29 deletions(-) create mode 100644 tools/v1xx_to_v2xx.sh 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")