This commit is contained in:
NewName
2024-08-12 01:02:44 +08:00
parent 477cef0717
commit 5938908abb
4 changed files with 27 additions and 18 deletions

View File

@@ -36,19 +36,6 @@ bash <(wget -qO- -o- https://github.com/admin8800/sing-box/raw/main/install.sh)
bash <(wget -qO- https://github.com/sky22333/shell/raw/main/xray.sh) bash <(wget -qO- https://github.com/sky22333/shell/raw/main/xray.sh)
``` ```
### 批量搭建vmess节点并把节点信息传输到另一台机器
一:先把`x.sh`文件中的第88行填入你目的主机的密码和IP
二:目的主机需在`home`目录下创建`xray.txt`文件
```
touch /home/xray.txt
```
三:然后再执行此脚本
```
bash <(wget -qO- https://github.com/sky22333/shell/raw/main/x.sh)
```
### 端口限速脚本 ### 端口限速脚本

13
tmp/README.md Normal file
View File

@@ -0,0 +1,13 @@
### 批量搭建节点并把节点信息传输到另一台机器
一:先在脚本变量中填入目标服务器信息
二:目的主机需在`home`目录下创建`xray.txt`文件
```
touch /home/xray.txt
```
三:然后再执行此脚本
```
bash <(wget -qO- https://github.com/sky22333/shell/raw/main/tmp/shadowsocks.sh)
```

View File

@@ -50,8 +50,8 @@ configure_and_transfer() {
] ]
} }
EOF EOF
local ip=$(curl -s http://ipinfo.io/ip)
local config="ss://$(echo -n "aes-256-gcm:$PASSWORD" | base64 -w 0)@$SERVER_IP:9527#$NODE_NAME" local config="ss://$(echo -n "aes-256-gcm:$PASSWORD" | base64 -w 0)@$ip:9527#$NODE_NAME"
echo -e "${green}Shadowsocks 节点配置信息:${none}" echo -e "${green}Shadowsocks 节点配置信息:${none}"
echo $config echo $config
echo $config > /tmp/xray_config.txt echo $config > /tmp/xray_config.txt
@@ -62,4 +62,5 @@ EOF
install_dependencies install_dependencies
configure_and_transfer configure_and_transfer
systemctl restart xray systemctl restart xray
systemctl enable xray
echo -e "${green}Xray 服务已经重新启动。${none}" echo -e "${green}Xray 服务已经重新启动。${none}"

View File

@@ -1,5 +1,11 @@
#!/bin/bash #!/bin/bash
# 定义变量
SERVER_IP="目标服务器IP"
SERVER_PASSWORD="目标服务器密码"
NODE_NAME="节点名称"
TARGET_DIR="/home/xray.txt"
green='\e[32m' green='\e[32m'
none='\e[0m' none='\e[0m'
config_file="/usr/local/etc/xray/config.json" config_file="/usr/local/etc/xray/config.json"
@@ -74,15 +80,17 @@ configure_and_transfer() {
EOF EOF
local ip=$(curl -s http://ipinfo.io/ip) local ip=$(curl -s http://ipinfo.io/ip)
local config="vmess://$(echo -n "{\"v\":\"2\",\"ps\":\"TK节点定制\",\"add\":\"$ip\",\"port\":$PORT,\"id\":\"$UUID\",\"aid\":\"0\",\"net\":\"ws\",\"path\":\"/$RANDOM_PATH\",\"type\":\"none\",\"host\":\"\",\"tls\":\"\"}" | base64 -w 0)" local config="vmess://$(echo -n "{\"v\":\"2\",\"ps\":\"$NODE_NAME\",\"add\":\"$ip\",\"port\":$PORT,\"id\":\"$UUID\",\"aid\":\"0\",\"net\":\"ws\",\"path\":\"/$RANDOM_PATH\",\"type\":\"none\",\"host\":\"\",\"tls\":\"\"}" | base64 -w 0)"
echo -e "${green}Vmess 节点配置信息:${none}" echo -e "${green}Vmess 节点配置信息:${none}"
echo $config echo $config
echo $config > /tmp/xray_config.txt echo $config > /tmp/xray_config.txt
sshpass -p '密码' ssh -o StrictHostKeyChecking=no root@服务器IP "cat >> /home/xray.txt" < /tmp/xray_config.txt sshpass -p "$SERVER_PASSWORD" ssh -o StrictHostKeyChecking=no root@$SERVER_IP "cat >> $TARGET_DIR" < /tmp/xray_config.txt
} }
# 主执行逻辑 # 主执行逻辑
install_dependencies install_dependencies
configure_and_transfer configure_and_transfer
systemctl restart xray systemctl restart xray
systemctl enable xray
echo -e "${green}Xray 服务已经重新启动。${none}" echo -e "${green}Xray 服务已经重新启动。${none}"