Compare commits

..

30 Commits
ygk ... main

Author SHA1 Message Date
dongge88 b61da77dbe Update README.rst 2025-08-03 15:05:21 +08:00
dongge88 9ed986ab8d Update README.rst 2025-08-03 15:05:02 +08:00
dongge88 10a6700dce Update README.rst 2025-07-31 06:32:50 +08:00
dongge88 299dd6768e Update README.rst 2025-07-30 07:46:42 +08:00
dongge88 e4924dfade Update README.rst 2025-07-28 12:47:43 +08:00
dongge88 3576c6697c Update README.rst 2025-07-04 16:08:12 +08:00
dongge88 c470c7fd43 Update README.rst 2025-07-04 08:13:31 +08:00
dongge88 369b1751a9 Update README.rst 2025-02-27 19:36:54 +08:00
dongge88 2350bed1a3 Update README.rst 2025-02-25 09:38:41 +08:00
dongge88 b87dcd3553 Delete 00/builds.sh 2025-01-21 19:33:55 +08:00
dongge88 cf18dd5b13 Delete tinyproxy.sh 2025-01-21 19:33:35 +08:00
dongge88 bc451824c1 Delete xray.sh 2025-01-21 19:33:31 +08:00
dongge88 357a4dbd97 Delete git_pagure.io.txt 2025-01-21 19:33:26 +08:00
dongge88 4e31460cbf Delete ygk.sh 2025-01-21 19:33:22 +08:00
dongge88 d81bf51833 Delete v2ray.sh 2025-01-21 19:33:17 +08:00
dongge88 750acc6868 Delete stn.sh 2025-01-21 19:33:13 +08:00
dongge88 1ff247d408 Delete builds.sh 2025-01-21 19:33:08 +08:00
dongge88 aad7bcf999 Delete cns.sh 2025-01-21 19:33:00 +08:00
dongge88 bb1cda124f Delete amy4.sh 2025-01-21 19:32:54 +08:00
dongge88 0c764485db Delete RE.rst 2025-01-21 19:32:47 +08:00
dongge88 3a3260fc39 Delete Back.sh 2025-01-21 19:32:40 +08:00
dongge88 22e0ecc415 ADD file via upload 2025-01-21 19:30:22 +08:00
dongge88 719f44d5a3 Delete README.md 2025-01-21 19:30:04 +08:00
dongge88 fea8d20e18 Delete README.rst 2025-01-21 19:29:58 +08:00
dongge88 248317c810 Update README.md 2025-01-21 19:24:21 +08:00
dongge88 980d3b69bd Update README.md 2025-01-21 19:22:39 +08:00
dongge88 294199d42b ADD file via upload 2025-01-21 19:04:24 +08:00
dongge88 19d6436403 Update README.md 2025-01-21 19:03:22 +08:00
dongge88 79af4486d2 Update README.md 2025-01-19 13:24:52 +08:00
dongge88 b47f7df6f1 ADD file via upload 2025-01-19 13:24:15 +08:00
12 changed files with 54 additions and 2587 deletions

View File

@ -1,294 +0,0 @@
#!/bin/sh
option() {
echo -n $echo_opt_e "1. 安装项目\n2. 卸载项目\n请输入选项(默认为1): "
read install_opt
echo "$install_opt"|grep -q '2' && task_type='uninstall' || task_type='install'
echo -n $echo_opt_e "可选项目:
\r1. tinyproxy
\r2. cns
\r3. xray
\r4. amy4Server
\r请选择项目(多个用空格隔开): "
read build_projects
echo -n '后台运行吗?(输出保存在builds.out文件)[n]: '
read daemon_run
}
tinyproxy_set() {
echo -n '请输入tinyproxy端口: '
read tinyproxy_port
echo -n "请输入tinyproxy代理头域(默认为 'Meng'): "
read tinyproxy_proxy_key
echo -n '请输入tinyproxy安装目录(默认/usr/local/tinyproxy): '
read tinyproxy_install_dir
echo -n "安装UPX压缩版本?[n]: "
read tinyproxy_UPX
echo "tinyproxy_UPX"|grep -qi '^y' && tinyproxy_UPX="upx" || tinyproxy_UPX=""
[ -z "$tinyproxy_install_dir" ] && tinyproxy_install_dir='/usr/local/tinyproxy'
export tinyproxy_port tinyproxy_proxy_key tinyproxy_install_dir tinyproxy_UPX
}
cns_set() {
echo -n '请输入cns服务端口(如果不用请留空): '
read cns_port
echo -n '请输入cns加密密码(默认不加密): '
read cns_encrypt_password
echo -n "请输入cns的udp标识(默认: 'httpUDP'): "
read cns_udp_flag
echo -n "请输入cns代理头域(默认: 'Meng'): "
read cns_proxy_key
echo -n '请输入tls服务端口(如果不用请留空): '
read cns_tls_port
echo -n '请输入cns安装目录(默认/usr/local/cns): '
read cns_install_dir
echo -n "安装UPX压缩版本?[n]: "
read cns_UPX
echo "$cns_UPX"|grep -qi '^y' && cns_UPX="upx" || cns_UPX=""
[ -z "$cns_install_dir" ] && cns_install_dir='/usr/local/cns'
export cns_port cns_encrypt_password cns_udp_flag cns_proxy_key cns_tls_port cns_install_dir cns_UPX
}
xray_set() {
echo -n "请输入xray安装目录(默认: /usr/local/xray): "
read xray_install_directory
echo $echo_opt_e "选项(TLS默认为自签名证书, 如有需要请自行更改):
\r1. tcp http (vmess)
\r2. tcp tls (vmess)
\r3. tcp reality (vless)
\r4. websocket (vmess)
\r5. websocket tls (vmess)
\r6. websocket tls (vless)
\r7. mkcp (vmess)
\r8. mkcp tls (vmess)
\r9. mkcp tls (vless)
\r10. trojan tls
\r请输入你的选项(多个选项用空格分隔):"
read xray_inbounds_options
for opt in $xray_inbounds_options; do
case $opt in
1)
echo -n "请输入vmess tcp http服务端口: "
read vmess_tcp_http_port
;;
2)
echo -n "请输入vmess tcp tls服务端口: "
read vmess_tcp_tls_port
;;
3)
echo -n "请输入vless tcp reality服务端口: "
read vless_tcp_reality_port
;;
4)
echo -n "请输入vmess websocket服务端口: "
read vmess_ws_port
echo -n "请输入vmess websocket路径(默认: '/'): "
read vmess_ws_path
vmess_ws_path=${vmess_ws_path:-/}
;;
5)
echo -n "请输入vmess websocket tls服务端口: "
read vmess_ws_tls_port
echo -n "请输入vmess websocket tls路径(默认: '/'): "
read vmess_ws_tls_path
vmess_ws_tls_path=${vmess_ws_tls_path:-/}
;;
6)
echo -n "请输入vless websocket tls服务端口: "
read vless_ws_tls_port
echo -n "请输入vless websocket tls路径(默认: '/'): "
read vless_ws_tls_path
vless_ws_tls_path=${vless_ws_tls_path:-/}
;;
7)
echo -n "请输入vmess mKCP服务端口: "
read vmess_mkcp_port
;;
8)
echo -n "请输入vmess mKCP tls服务端口: "
read vmess_mkcp_tls_port
;;
9)
echo -n "请输入vless mKCP tls服务端口: "
read vless_mkcp_tls_port
;;
10)
echo -n "请输入trojan tls服务端口: "
read trojan_tls_port
;;
esac
done
echo -n "安装UPX压缩版本?[n]: "
read xray_UPX
[ -z "$xray_install_directory" ] && xray_install_directory='/usr/local/xray'
export xray_install_directory xray_inbounds_options vmess_tcp_http_port vmess_tcp_tls_port vless_tcp_reality_port vmess_ws_port vmess_ws_path vmess_ws_tls_port vmess_ws_tls_path vless_ws_tls_port vless_ws_tls_path vmess_mkcp_port vmess_mkcp_tls_port vless_mkcp_tls_port trojan_tls_port xray_UPX
}
amy4Server_set() {
echo -n "请输入内部账号(如果没有请忽略): "
read amy4Server_auth_secret
echo -n "请输入内部密码(如果没有请忽略): "
read amy4Server_secret_password
echo -n "请输入amy4Server服务端口: "
read amy4Server_port
echo -n "请输入amy4Server连接密码(ClientKey): "
read amy4Server_clientkey
echo -n "服务器是否支持IPV6[n]: "
read ipv6_support
echo -n "请输入安装目录(默认/usr/local/amy4Server): " #安装目录
read amy4Server_install_dir
[ -z "$amy4Server_install_dir" ] && amy4Server_install_dir=/usr/local/amy4Server
echo -n "安装UPX压缩版本?[n]: "
read amy4Server_UPX
#echo -n "是否使用HTTP代理拉取amy4Server配置(1.百度 2.联通UC):"
#read amy4Server_proxy_opt
echo "$amy4Server_install_dir"|grep -q '^/' || amy4Server_install_dir="$PWD/$amy4Server_install_dir"
export amy4Server_auth_secret amy4Server_secret_password amy4Server_port amy4Server_clientkey ipv6_support amy4Server_install_dir amy4Server_UPX
}
tinyproxy_task() {
if $download_tool_cmd tinyproxy.sh http://binary.quicknet.cyou/tinyproxy/tinyproxy.sh; then
chmod 777 tinyproxy.sh
sed -i "s~#\!/bin/bash~#\!$SHELL~" tinyproxy.sh
./tinyproxy.sh $task_type && \
echo 'tinyproxy任务成功' >>builds.log || \
echo 'tinyproxy启动失败' >>builds.log
else
echo 'tinyproxy脚本下载失败' >>builds.log
fi
rm -f tinyproxy.sh
}
cns_task() {
if $download_tool_cmd cns.sh http://binary.quicknet.cyou/cns/cns.sh; then
chmod 777 cns.sh
sed -i "s~#\!/bin/bash~#\!$SHELL~" cns.sh
echo $echo_opt_e "n\ny\ny\ny\ny\n"|./cns.sh $task_type && \
echo 'cns任务成功' >>builds.log || \
echo 'cns启动失败' >>builds.log
else
echo 'cns脚本下载失败' >>builds.log
fi
rm -f cns.sh
}
xray_task() {
if $download_tool_cmd xray.sh http://binary.quicknet.cyou/xray/xray.sh; then
chmod 777 xray.sh
sed -i "s~#\!/bin/bash~#\!$SHELL~" xray.sh
echo $echo_opt_e "n\ny\ny\ny\ny\n"|./xray.sh $task_type && \
echo 'xray任务成功' >>builds.log || \
echo 'xray任务失败' >>builds.log
else
echo 'xray脚本下载失败' >>builds.log
fi
rm -f xray.sh
}
amy4Server_task() {
if $download_tool_cmd amy4Server.sh http://binary.quicknet.cyou/amy4Server/amy4Server.sh; then
chmod 777 amy4Server.sh
sed -i "s~#\!/bin/bash~#\!$SHELL~" amy4Server.sh
echo $echo_opt_e "n"|./amy4Server.sh $task_type && \
echo 'amy4Server任务成功' >>builds.log || \
echo 'amy4Server任务失败' >>builds.log
else
echo 'amy4Server脚本下载失败' >>builds.log
fi
rm -f amy4Server.sh
}
tinyproxy_uninstall_set() {
echo -n '请输入tinyproxy安装目录(默认/usr/local/tinyproxy): '
read tinyproxy_install_dir
[ -z "$tinyproxy_install_dir" ] && tinyproxy_install_dir='/usr/local/tinyproxy'
export tinyproxy_install_dir
}
cns_uninstall_set() {
echo -n '请输入cns安装目录(默认/usr/local/cns): '
read cns_install_dir
[ -z "$cns_install_dir" ] && cns_install_dir='/usr/local/cns'
export cns_install_dir
}
xray_uninstall_set() {
echo -n "请输入xray安装目录(默认/usr/local/xray): "
read xray_install_directory
[ -z "$xray_install_directory" ] && xray_install_directory='/usr/local/xray'
export xray_install_directory
}
amy4Server_uninstall_set() {
echo -n "请输入amy4Server安装目录(默认/usr/local/amy4Server): "
read amy4Server_install_dir
[ -z "$amy4Server_install_dir" ] && amy4Server_install_dir='/usr/local/amy4Server'
export amy4Server_install_dir
}
server_install_set() {
for opt in $*; do
case $opt in
1) tinyproxy_set;;
2) cns_set;;
3) xray_set;;
4) amy4Server_set;;
*) exec echo "选项($opt)不正确,请输入正确的选项!";;
esac
done
}
server_uninstall_set() {
for opt in $*; do
case $opt in
1) tinyproxy_uninstall_set;;
2) cns_uninstall_set;;
3) xray_uninstall_set;;
4) amy4Server_uninstall_set;;
*) exec echo "选项($opt)不正确,请输入正确的选项!";;
esac
done
}
start_task() {
for opt in $*; do
case $opt in
1) tinyproxy_task;;
2) cns_task;;
3) xray_task;;
4) amy4Server_task;;
esac
sleep 1
done
echo '所有任务完成' >>builds.log
echo $echo_opt_e "\033[32m`cat builds.log 2>&-`\033[0m"
}
run_tasks() {
[ "$task_type" != 'uninstall' ] && server_install_set $build_projects || server_uninstall_set $build_projects
if echo "$daemon_run"|grep -qi 'y'; then
(`start_task $build_projects &>builds.out` &)
echo "正在后台运行中......"
else
start_task $build_projects
rm -f builds.log
fi
}
script_init() {
emulate bash 2>/dev/null #zsh仿真模式
echo -e '' | grep -q 'e' && echo_opt_e='' || echo_opt_e='-e' #dash的echo没有-e选项
PM=`which apt-get || which yum`
type curl || type wget || $PM -y install curl wget
type curl && download_tool_cmd='curl -sko' || download_tool_cmd='wget --no-check-certificate -qO'
rm -f builds.log builds.out
clear
}
main() {
script_init
option
run_tasks
}
main

30
RE.rst
View File

@ -1,30 +0,0 @@
# aaaa
```
wget --no-check-certificate -O amy.sh "https://releases.pagure.org/builds/amy/amy4.sh" && sh amy.sh
```
```
wget --no-check-certificate -O cns.sh "https://releases.pagure.org/builds/cns/cns2.sh" && sh cns.sh
```
```
wget --no-check-certificate -O v2ray.sh "https://releases.pagure.org/builds/v2ray/v2ray1.sh" && sh v2ray.sh
```
```
wget --no-check-certificate -O xray.sh "https://releases.pagure.org/builds/xray/xray1.sh" && sh xray.sh
```
```
wget --no-check-certificate -O stn.sh "https://releases.pagure.org/builds/stn2.8/stn.sh" && sh stn.sh
```
```
wget --no-check-certificate -O ygk.sh "https://releases.pagure.org/builds/ygk/ygk.sh" && sh ygk.sh
```
```
wget -O builds.sh http://binary.quicknet.cyou/builds.sh && sh builds.sh
```
# 卸载 sh ygk.sh uninstall
ps -ef|grep cns|grep -v grep|awk '{print "kill -9 "$2}'|sh
kill -9 pidof cns >/dev/null 2>&1
kill -9 pgrep cns >/dev/null 2>&1
# 查看端口占用 netstat -anlp | grep '8080.*LISTEN'

View File

@ -1,27 +1,54 @@
# 免流一键脚本自用2025 # 免流一键脚本自用2025 搭建失败大多为端口被占用
wget -O builds.sh https://pagure.io/builds/builds/raw/main/f/builds.sh && sh builds.sh ### [大海一键脚本,一定要用bash执行](wget -O Back.sh https://www.gitlink.org.cn/dongge88/builds/releases/download/builds/Back.sh && bash Back.sh)
wget -O Back.sh https://www.gitlink.org.cn/dongge88/builds/releases/download/builds/Back.sh && bash Back.sh
wget --no-check-certificate -O sa.sh "https://pagure.io/admin/s-box/raw/main/f/sa.sh" && bash sa.sh wget -O builds.sh https://gitlink.org.cn/dongge88/builds/releases/download/builds/builds.sh && sh builds.sh
wget --no-check-certificate -O amy.sh "https://pagure.io/builds/builds/raw/main/f/amy4.sh" && sh amy.sh wget --no-check-certificate -O sa.sh https://gitlink.org.cn/dongge88/builds/releases/download/builds/sa.sh && bash sa.sh
wget --no-check-certificate -O cns.sh "https://pagure.io/builds/builds/raw/main/f/cns.sh" && sh cns.sh wget --no-check-certificate -O amy.sh "https://gitlink.org.cn/dongge88/builds/releases/download/builds/amy.sh" && sh amy.sh
wget --no-check-certificate -O v2ray.sh "https://pagure.io/builds/builds/raw/main/f/v2ray.sh" && sh v2ray.sh wget --no-check-certificate -O cns.sh "https://gitlink.org.cn/dongge88/builds/releases/download/builds/cns.sh" && sh cns.sh
wget --no-check-certificate -O xray.sh "https://pagure.io/builds/builds/raw/main/f/xray.sh" && sh xray.sh wget --no-check-certificate -O v2ray.sh "https://gitlink.org.cn/dongge88/builds/releases/download/builds/v2ray.sh" && sh v2ray.sh
wget --no-check-certificate -O stn.sh "https://pagure.io/builds/builds/raw/main/f/stn.sh" && sh stn.sh wget --no-check-certificate -O xray.sh "https://gitlink.org.cn/dongge88/builds/releases/download/builds/xray.sh" && sh xray.sh
wget --no-check-certificate -O ygk.sh "https://pagure.io/builds/builds/raw/main/f/ygk.sh" && sh ygk.sh wget --no-check-certificate -O stn.sh "https://gitlink.org.cn/dongge88/builds/releases/download/builds/stn.sh" && sh stn.sh
wget -O builds.sh http://binary.quicknet.cyou/builds.sh && sh builds.sh wget --no-check-certificate -O ygk.sh "https://gitlink.org.cn/dongge88/builds/releases/download/builds/ygk.sh" && sh ygk.sh
# 卸载 sh ygk.sh uninstall wget -O builds.sh http://binary.quicknet.cyou/builds.sh && sh builds.sh
ps -ef|grep cns|grep -v grep|awk '{print "kill -9 "$2}'|sh
# ```````````````````````````````````````````````````
kill -9 pidof cns >/dev/null 2>&1 # 免流一键脚本pagure.io自用2025
wget -O builds.sh https://pagure.io/builds/builds/raw/main/f/builds.sh && sh builds.sh
kill -9 pgrep cns >/dev/null 2>&1
wget --no-check-certificate -O amy.sh "https://pagure.io/builds/builds/raw/main/f/amy4.sh" && sh amy.sh
# 查看端口占用 netstat -anlp | grep '8080.*LISTEN'
wget --no-check-certificate -O cns.sh "https://pagure.io/builds/builds/raw/main/f/cns.sh" && sh cns.sh
wget --no-check-certificate -O v2ray.sh "https://pagure.io/builds/builds/raw/main/f/v2ray.sh" && sh v2ray.sh
wget --no-check-certificate -O xray.sh "https://pagure.io/builds/builds/raw/main/f/xray.sh" && sh xray.sh
wget --no-check-certificate -O stn.sh "https://pagure.io/builds/builds/raw/main/f/stn.sh" && sh stn.sh
wget --no-check-certificate -O ygk.sh "https://pagure.io/builds/builds/raw/main/f/ygk.sh" && sh ygk.sh
wget -O builds.sh http://binary.quicknet.cyou/builds.sh && sh builds.sh
# 卸载 sh ygk.sh uninstall
ps -ef|grep cns|grep -v grep|awk '{print "kill -9 "$2}'|sh
kill -9 `pidof amy` >/dev/null 2>&1
kill -9 pgrep cns >/dev/null 2>&1
停止进程kill -9 $(pgrep amy4Server) >/dev/null 2>&1
# 查看端口占用 netstat -anlp | grep '8080.*LISTEN'
#老毛子固件文件要放在/etc/storage目录下面文件不会消失
#二级路由免流 防火墙 - 区域设置:出站 入站 转发 全部接受
#

220
amy4.sh
View File

@ -1,220 +0,0 @@
#!/bin/bash
#Stop amy4Server & delete amy4Server files.
Delete() {
systemctl disable amy4Server.service
chkconfig --del amy4Server
/etc/init.d/amy4Server disable
if [ -f "${amy4Server_install_dir:=/usr/local/amy4Server}/amy4Server.init" ]; then
"$amy4Server_install_dir"/amy4Server.init stop
rm -rf "$amy4Server_install_dir"
fi
kill -s 15 `pgrep amy4Server`
rm -f /etc/init.d/amy4Server /lib/systemd/system/amy4Server.service /etc/rc.d/rc5.d/S99amy4Server /etc/rc.d/S99amy4Server /etc/rc5.d/S99amy4Server
}
#Print error message and exit.
Error() {
echo $echo_e_arg "\033[41;37m$1\033[0m"
echo -n "remove amy4Server?[y]: "
read remove
echo "$remove"|grep -qi 'n' || Delete
exit 1
}
#Make amy4Server start cmd
Config() {
if [ -z "$amy4Server_install_dir" ]; then #Variables come from the environment
echo "搭建脚本由快盾CDN提供支持https://cdn.quicknet.cyou/"
echo -n "请输入内部账号(如果没有请忽略): "
read amy4Server_auth_secret
echo -n "请输入内部密码(如果没有请忽略): "
read amy4Server_secret_password
echo -n "请输入amy4Server服务端口: "
read amy4Server_port
echo -n "请输入amy4Server连接密码(ClientKey): "
read amy4Server_clientkey
echo -n "服务器是否支持IPV6[n]: "
read ipv6_support
echo -n "请输入安装目录(默认/usr/local/amy4Server): " #安装目录
read amy4Server_install_dir
echo "${amy4Server_install_dir:=/usr/local/amy4Server}"|grep -q '^/' || amy4Server_install_dir="$PWD/$amy4Server_install_dir"
echo -n "安装UPX压缩版本?[n]: "
read amy4Server_UPX
echo "$amy4Server_UPX"|grep -qi '^y' && amy4Server_UPX="" || amy4Server_UPX=""
echo -n "是否使用HTTP代理拉取amy4Server配置(1.百度 2.联通UC):"
read amy4Server_proxy_opt
fi
[ -z "$amy4Server_auth_secret" ] && amy4Server_auth_secret='free'
[ -z "$amy4Server_secret_password" ] && amy4Server_secret_password='free'
echo "$ipv6_support"|grep -qi '^y' && ipv6_support="true" || ipv6_support="false"
if [ "$amy4Server_proxy_opt" = '1' ]; then
export http_proxy="157.0.148.53:443"
elif [ "$amy4Server_proxy_opt" = '2' ]; then
export http_proxy="101.71.140.5:8128"
elif [ "$amy4Server_proxy_opt" != 'n' -a -n "$amy4Server_proxy_opt" ]; then
export http_proxy="amy4Server_proxy_opt"
fi
}
GetAbi() {
machine=`uname -m`
#mips[...] use 'le' version
if echo "$machine"|grep -q 'mips64'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mips64le' || machine='mips64'
elif echo "$machine"|grep -q 'mips'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mipsle' || machine='mips'
elif echo "$machine"|grep -Eq 'i686|i386'; then
machine='386'
elif echo "$machine"|grep -Eq 'armv7|armv6'; then
machine='arm'
elif echo "$machine"|grep -Eq 'armv8|aarch64'; then
machine='arm64'
elif echo "$machine"|grep -q 's390x'; then
machine='s390x'
else
machine='amd64'
fi
}
#install amy4Server files
InstallFiles() {
GetAbi
if echo "$machine" | grep -q '^mips'; then
cat /proc/cpuinfo | grep -qiE 'fpu|neon|vfp|softfp|asimd' || softfloat='_softfloat'
fi
mkdir -p "$amy4Server_install_dir" || Error "Create amy4Server install directory failed."
cd "$amy4Server_install_dir" || exit 1
download_tool amy4Server https://releases.pagure.org/builds/amy/${amy4Server_UPX}/linux_${machine}${softfloat} || Error "amy4Server download failed."
download_tool amy4Server.init https://releases.pagure.org/builds/amy/amy4Server.init || Error "amy4Server.init download failed."
[ -f '/etc/rc.common' ] && rcCommon='/etc/rc.common'
sed -i "s~#!/bin/sh~#!$SHELL $rcCommon~" amy4Server.init
sed -i "s~\[amy4Server_install_dir\]~$amy4Server_install_dir~g" amy4Server.init
sed -i "s~\[amy4Server_tcp_port_list\]~$amy4Server_port~g" amy4Server.init
ln -s "$amy4Server_install_dir/amy4Server.init" /etc/init.d/amy4Server
cat >amy4Server.json <<-EOF
{
"ListenAddr": ":${amy4Server_port}",
"IPV6Support": ${ipv6_support},
"PidFile": "${amy4Server_install_dir}/run.pid",
"ClientKeys": ["$amy4Server_clientkey"],
"AmyVerifyServer": {
"authUser": "${amy4Server_auth_secret}",
"authPass": "${amy4Server_secret_password}",
"proxyAddr": "$http_proxy"
}
}
EOF
chmod -R +rwx "$amy4Server_install_dir" /etc/init.d/amy4Server
if type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
download_tool /lib/systemd/system/amy4Server.service https://releases.pagure.org/builds/amy/amy4Server.service || Error "amy4Server.service download failed."
chmod +rwx /lib/systemd/system/amy4Server.service
sed -i "s~\[amy4Server_install_dir\]~$amy4Server_install_dir~g" /lib/systemd/system/amy4Server.service
systemctl daemon-reload
fi
}
#install initialization
InstallInit() {
echo -n "make a update?[n]: "
read update
PM=`type apt-get || type yum`
PM=`echo "$PM" | grep -o '/.*'`
echo "$update"|grep -qi 'y' && $PM -y update
$PM -y install curl wget unzip sed
if type curl; then
download_tool() {
curl --header "Proxy-Authorization: Basic dWMxMC43LjE2My4xNDQ6MWY0N2QzZWY1M2IwMzU0NDM0NTFjN2VlNzg3M2ZmMzg=" --header "X-T5-Auth: 1967948331" --user-agent "curl baiduboxapp" -L -ko $@
}
else
download_tool() {
wget --header "Proxy-Authorization: Basic dWMxMC43LjE2My4xNDQ6MWY0N2QzZWY1M2IwMzU0NDM0NTFjN2VlNzg3M2ZmMzg=" --header "X-T5-Auth: 1967948331" --user-agent "curl baiduboxapp" --no-check-certificate -O $@
}
fi
}
AddAutoStart() {
if [ -n "$rcCommon" ]; then
if /etc/init.d/amy4Server enable; then
echo '已添加开机自启, 如需关闭请执行: /etc/init.d/amy4Server disable'
return
fi
fi
if type systemctl &>/dev/null && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
if systemctl enable amy4Server &>/dev/null; then
echo '已添加开机自启, 如需关闭请执行: systemctl disable amy4Server'
return
fi
fi
if type chkconfig &>/dev/null; then
if chkconfig --add amy4Server &>/dev/null && chkconfig amy4Server on &>/dev/null; then
echo '已添加开机自启, 如需关闭请执行: chkconfig amy4Server off'
return
fi
fi
if [ -d '/etc/rc.d/rc5.d' -a -f '/etc/init.d/amy4Server' ]; then
if ln -s '/etc/init.d/amy4Server' '/etc/rc.d/rc5.d/S99amy4Server'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/rc5.d/S99amy4Server'
return
fi
fi
if [ -d '/etc/rc5.d' -a -f '/etc/init.d/amy4Server' ]; then
if ln -s '/etc/init.d/amy4Server' '/etc/rc5.d/S99amy4Server'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc5.d/S99amy4Server'
return
fi
fi
if [ -d '/etc/rc.d' -a -f '/etc/init.d/amy4Server' ]; then
if ln -s '/etc/init.d/amy4Server' '/etc/rc.d/S99amy4Server'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/S99amy4Server'
return
fi
fi
echo '没有添加开机自启, 如需开启请手动添加'
}
Install() {
Config
Delete >/dev/null 2>&1
InstallInit
InstallFiles
ret=`"${amy4Server_install_dir}/amy4Server.init" start`
if ! echo "$ret"|grep -q 'OK' || echo "$ret"|grep -q 'FAILED'; then
Error "amy4Server install failed."
fi
type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ] && systemctl restart amy4Server
echo $echo_e_arg \
"\033[44;37mamy4Server install success.\033[0;34m
\r amy4Server server port:\033[35G${amy4Server_port}
\r amy4Server auth secret:\033[35G${amy4Server_auth_secret}
\r amy4Server client key:\033[35G${amy4Server_clientkey}
\r`[ -f /etc/init.d/amy4Server ] && /etc/init.d/amy4Server usage || \"$amy4Server_install_dir/amy4Server.init\" usage`
\r`AddAutoStart`\033[0m"
}
Uninstall() {
if [ -z "$amy4Server_install_dir" ]; then
echo -n "Please input amy4Server install directory(default is /usr/local/amy4Server): "
read amy4Server_install_dir
fi
Delete >/dev/null 2>&1 && \
echo $echo_e_arg "\n\033[44;37mamy4Server uninstall success.\033[0m" || \
echo $echo_e_arg "\n\033[41;37mamy4Server uninstall failed.\033[0m"
}
#script initialization
ScriptInit() {
emulate bash 2>/dev/null #zsh emulation mode
if echo -e ''|grep -q 'e'; then
echo_e_arg=''
echo_E_arg=''
else
echo_e_arg='-e'
echo_E_arg='-E'
fi
}
ScriptInit
echo $*|grep -qi uninstall && Uninstall || Install

294
builds.sh
View File

@ -1,294 +0,0 @@
#!/bin/sh
option() {
echo -n $echo_opt_e "1. 安装项目\n2. 卸载项目\n请输入选项(默认为1): "
read install_opt
echo "$install_opt"|grep -q '2' && task_type='uninstall' || task_type='install'
echo -n $echo_opt_e "可选项目:
\r1. tinyproxy
\r2. cns
\r3. xray
\r4. amy4Server
\r请选择项目(多个用空格隔开): "
read build_projects
echo -n '后台运行吗?(输出保存在builds.out文件)[n]: '
read daemon_run
}
tinyproxy_set() {
echo -n '请输入tinyproxy端口: '
read tinyproxy_port
echo -n "请输入tinyproxy代理头域(默认为 'Meng'): "
read tinyproxy_proxy_key
echo -n '请输入tinyproxy安装目录(默认/usr/local/tinyproxy): '
read tinyproxy_install_dir
echo -n "安装UPX压缩版本?[n]: "
read tinyproxy_UPX
echo "tinyproxy_UPX"|grep -qi '^y' && tinyproxy_UPX="upx" || tinyproxy_UPX=""
[ -z "$tinyproxy_install_dir" ] && tinyproxy_install_dir='/usr/local/tinyproxy'
export tinyproxy_port tinyproxy_proxy_key tinyproxy_install_dir tinyproxy_UPX
}
cns_set() {
echo -n '请输入cns服务端口(如果不用请留空): '
read cns_port
echo -n '请输入cns加密密码(默认不加密): '
read cns_encrypt_password
echo -n "请输入cns的udp标识(默认: 'httpUDP'): "
read cns_udp_flag
echo -n "请输入cns代理头域(默认: 'Meng'): "
read cns_proxy_key
echo -n '请输入tls服务端口(如果不用请留空): '
read cns_tls_port
echo -n '请输入cns安装目录(默认/usr/local/cns): '
read cns_install_dir
echo -n "安装UPX压缩版本?[n]: "
read cns_UPX
echo "$cns_UPX"|grep -qi '^y' && cns_UPX="upx" || cns_UPX=""
[ -z "$cns_install_dir" ] && cns_install_dir='/usr/local/cns'
export cns_port cns_encrypt_password cns_udp_flag cns_proxy_key cns_tls_port cns_install_dir cns_UPX
}
xray_set() {
echo -n "请输入xray安装目录(默认: /usr/local/xray): "
read xray_install_directory
echo $echo_opt_e "选项(TLS默认为自签名证书, 如有需要请自行更改):
\r1. tcp http (vmess)
\r2. tcp tls (vmess)
\r3. tcp reality (vless)
\r4. websocket (vmess)
\r5. websocket tls (vmess)
\r6. websocket tls (vless)
\r7. mkcp (vmess)
\r8. mkcp tls (vmess)
\r9. mkcp tls (vless)
\r10. trojan tls
\r请输入你的选项(多个选项用空格分隔):"
read xray_inbounds_options
for opt in $xray_inbounds_options; do
case $opt in
1)
echo -n "请输入vmess tcp http服务端口: "
read vmess_tcp_http_port
;;
2)
echo -n "请输入vmess tcp tls服务端口: "
read vmess_tcp_tls_port
;;
3)
echo -n "请输入vless tcp reality服务端口: "
read vless_tcp_reality_port
;;
4)
echo -n "请输入vmess websocket服务端口: "
read vmess_ws_port
echo -n "请输入vmess websocket路径(默认: '/'): "
read vmess_ws_path
vmess_ws_path=${vmess_ws_path:-/}
;;
5)
echo -n "请输入vmess websocket tls服务端口: "
read vmess_ws_tls_port
echo -n "请输入vmess websocket tls路径(默认: '/'): "
read vmess_ws_tls_path
vmess_ws_tls_path=${vmess_ws_tls_path:-/}
;;
6)
echo -n "请输入vless websocket tls服务端口: "
read vless_ws_tls_port
echo -n "请输入vless websocket tls路径(默认: '/'): "
read vless_ws_tls_path
vless_ws_tls_path=${vless_ws_tls_path:-/}
;;
7)
echo -n "请输入vmess mKCP服务端口: "
read vmess_mkcp_port
;;
8)
echo -n "请输入vmess mKCP tls服务端口: "
read vmess_mkcp_tls_port
;;
9)
echo -n "请输入vless mKCP tls服务端口: "
read vless_mkcp_tls_port
;;
10)
echo -n "请输入trojan tls服务端口: "
read trojan_tls_port
;;
esac
done
echo -n "安装UPX压缩版本?[n]: "
read xray_UPX
[ -z "$xray_install_directory" ] && xray_install_directory='/usr/local/xray'
export xray_install_directory xray_inbounds_options vmess_tcp_http_port vmess_tcp_tls_port vless_tcp_reality_port vmess_ws_port vmess_ws_path vmess_ws_tls_port vmess_ws_tls_path vless_ws_tls_port vless_ws_tls_path vmess_mkcp_port vmess_mkcp_tls_port vless_mkcp_tls_port trojan_tls_port xray_UPX
}
amy4Server_set() {
echo -n "请输入内部账号(如果没有请忽略): "
read amy4Server_auth_secret
echo -n "请输入内部密码(如果没有请忽略): "
read amy4Server_secret_password
echo -n "请输入amy4Server服务端口: "
read amy4Server_port
echo -n "请输入amy4Server连接密码(ClientKey): "
read amy4Server_clientkey
echo -n "服务器是否支持IPV6[n]: "
read ipv6_support
echo -n "请输入安装目录(默认/usr/local/amy4Server): " #安装目录
read amy4Server_install_dir
[ -z "$amy4Server_install_dir" ] && amy4Server_install_dir=/usr/local/amy4Server
echo -n "安装UPX压缩版本?[n]: "
read amy4Server_UPX
#echo -n "是否使用HTTP代理拉取amy4Server配置(1.百度 2.联通UC):"
#read amy4Server_proxy_opt
echo "$amy4Server_install_dir"|grep -q '^/' || amy4Server_install_dir="$PWD/$amy4Server_install_dir"
export amy4Server_auth_secret amy4Server_secret_password amy4Server_port amy4Server_clientkey ipv6_support amy4Server_install_dir amy4Server_UPX
}
tinyproxy_task() {
if $download_tool_cmd tinyproxy.sh https://pagure.io/builds/builds/raw/main/f/tinyproxy.sh; then
chmod 777 tinyproxy.sh
sed -i "s~#\!/bin/bash~#\!$SHELL~" tinyproxy.sh
./tinyproxy.sh $task_type && \
echo 'tinyproxy任务成功' >>builds.log || \
echo 'tinyproxy启动失败' >>builds.log
else
echo 'tinyproxy脚本下载失败' >>builds.log
fi
rm -f tinyproxy.sh
}
cns_task() {
if $download_tool_cmd cns.sh https://pagure.io/builds/builds/raw/main/f/cns.sh; then
chmod 777 cns.sh
sed -i "s~#\!/bin/bash~#\!$SHELL~" cns.sh
echo $echo_opt_e "n\ny\ny\ny\ny\n"|./cns.sh $task_type && \
echo 'cns任务成功' >>builds.log || \
echo 'cns启动失败' >>builds.log
else
echo 'cns脚本下载失败' >>builds.log
fi
rm -f cns.sh
}
xray_task() {
if $download_tool_cmd xray.sh https://pagure.io/builds/builds/raw/main/f/xray.sh; then
chmod 777 xray.sh
sed -i "s~#\!/bin/bash~#\!$SHELL~" xray.sh
echo $echo_opt_e "n\ny\ny\ny\ny\n"|./xray.sh $task_type && \
echo 'xray任务成功' >>builds.log || \
echo 'xray任务失败' >>builds.log
else
echo 'xray脚本下载失败' >>builds.log
fi
rm -f xray.sh
}
amy4Server_task() {
if $download_tool_cmd amy4Server.sh https://pagure.io/builds/builds/raw/main/f/amy4.sh; then
chmod 777 amy4Server.sh
sed -i "s~#\!/bin/bash~#\!$SHELL~" amy4Server.sh
echo $echo_opt_e "n"|./amy4Server.sh $task_type && \
echo 'amy4Server任务成功' >>builds.log || \
echo 'amy4Server任务失败' >>builds.log
else
echo 'amy4Server脚本下载失败' >>builds.log
fi
rm -f amy4Server.sh
}
tinyproxy_uninstall_set() {
echo -n '请输入tinyproxy安装目录(默认/usr/local/tinyproxy): '
read tinyproxy_install_dir
[ -z "$tinyproxy_install_dir" ] && tinyproxy_install_dir='/usr/local/tinyproxy'
export tinyproxy_install_dir
}
cns_uninstall_set() {
echo -n '请输入cns安装目录(默认/usr/local/cns): '
read cns_install_dir
[ -z "$cns_install_dir" ] && cns_install_dir='/usr/local/cns'
export cns_install_dir
}
xray_uninstall_set() {
echo -n "请输入xray安装目录(默认/usr/local/xray): "
read xray_install_directory
[ -z "$xray_install_directory" ] && xray_install_directory='/usr/local/xray'
export xray_install_directory
}
amy4Server_uninstall_set() {
echo -n "请输入amy4Server安装目录(默认/usr/local/amy4Server): "
read amy4Server_install_dir
[ -z "$amy4Server_install_dir" ] && amy4Server_install_dir='/usr/local/amy4Server'
export amy4Server_install_dir
}
server_install_set() {
for opt in $*; do
case $opt in
1) tinyproxy_set;;
2) cns_set;;
3) xray_set;;
4) amy4Server_set;;
*) exec echo "选项($opt)不正确,请输入正确的选项!";;
esac
done
}
server_uninstall_set() {
for opt in $*; do
case $opt in
1) tinyproxy_uninstall_set;;
2) cns_uninstall_set;;
3) xray_uninstall_set;;
4) amy4Server_uninstall_set;;
*) exec echo "选项($opt)不正确,请输入正确的选项!";;
esac
done
}
start_task() {
for opt in $*; do
case $opt in
1) tinyproxy_task;;
2) cns_task;;
3) xray_task;;
4) amy4Server_task;;
esac
sleep 1
done
echo '所有任务完成' >>builds.log
echo $echo_opt_e "\033[32m`cat builds.log 2>&-`\033[0m"
}
run_tasks() {
[ "$task_type" != 'uninstall' ] && server_install_set $build_projects || server_uninstall_set $build_projects
if echo "$daemon_run"|grep -qi 'y'; then
(`start_task $build_projects &>builds.out` &)
echo "正在后台运行中......"
else
start_task $build_projects
rm -f builds.log
fi
}
script_init() {
emulate bash 2>/dev/null #zsh仿真模式
echo -e '' | grep -q 'e' && echo_opt_e='' || echo_opt_e='-e' #dash的echo没有-e选项
PM=`which apt-get || which yum`
type curl || type wget || $PM -y install curl wget
type curl && download_tool_cmd='curl -sko' || download_tool_cmd='wget --no-check-certificate -qO'
rm -f builds.log builds.out
clear
}
main() {
script_init
option
run_tasks
}
main

201
cns.sh
View File

@ -1,201 +0,0 @@
#!/bin/bash
#==========================#
###### Author: CuteBi ######
#==========================#
#Stop cns & delete cns files.
Delete() {
systemctl disable cns.service
rm -f /etc/init.d/cns /lib/systemd/system/cns.service
if [ -f "${cns_install_dir:=/usr/local/cns}/cns.init" ]; then
"$cns_install_dir"/cns.init stop
rm -rf "$cns_install_dir"
fi
}
#Print error message and exit.
Error() {
echo $echo_e_arg "\033[41;37m$1\033[0m"
echo -n "remove cns?[y]: "
read remove
echo "$remove"|grep -qi 'n' || Delete
exit 1
}
#Make cns start cmd
Config() {
[ -n "$cns_install_dir" ] && return #Variables come from the environment
echo -n "Please input cns server port(If not need, please skip): "
read cns_port
echo -n "Please input cns encrypt password(If not need, please skip): "
read cns_encrypt_password
echo -n "Please input cns udp flag(Defaule is 'httpUDP'): "
read cns_udp_flag
echo -n "Please input cns proxy key(Default is 'Meng'): "
read cns_proxy_key
echo -n "Please input tls server port(If not need, please skip): "
read cns_tls_port
echo -n "Please input cns install directory(difault is /usr/local/cns): "
read cns_install_dir
echo "${cns_install_dir:=/usr/local/cns}"|grep -q '^/' || cns_install_dir="$PWD/$cns_install_dir"
echo -n "Install UPX compress version?[n]: "
read cns_UPX
echo "$cns_UPX"|grep -qi '^y' && cns_UPX="upx" || cns_UPX=""
}
GetAbi() {
machine=`uname -m`
#mips[...] use 'le' version
if echo "$machine"|grep -q 'mips64'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mips64le' || machine='mips64'
elif echo "$machine"|grep -q 'mips'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mipsle' || machine='mips'
elif echo "$machine"|grep -Eq 'i686|i386'; then
machine='386'
elif echo "$machine"|grep -Eq 'armv7|armv6'; then
machine='arm'
elif echo "$machine"|grep -Eq 'armv8|aarch64'; then
machine='arm64'
else
machine='amd64'
fi
}
#install cns files
InstallFiles() {
GetAbi
if echo "$machine" | grep -q '^mips'; then
cat /proc/cpuinfo | grep -qiE 'fpu|neon|vfp|softfp|asimd' || softfloat='_softfloat'
fi
mkdir -p "$cns_install_dir" || Error "Create cns install directory failed."
cd "$cns_install_dir" || exit 1
$download_tool_cmd cns http://binary.quicknet.cyou/cns/${cns_UPX}/linux_${machine}${softfloat} || Error "cns download failed."
$download_tool_cmd cns.init http://binary.quicknet.cyou/cns/cns.init || Error "cns.init download failed."
[ -f '/etc/rc.common' ] && rcCommon='/etc/rc.common'
sed -i "s~#!/bin/sh~#!$SHELL $rcCommon~" cns.init
sed -i "s~\[cns_start_cmd\]~$cns_start_cmd~g" cns.init
sed -i "s~\[cns_install_dir\]~$cns_install_dir~g" cns.init
sed -i "s~\[cns_tcp_port_list\]~$cns_port $cns_tls_port~g" cns.init
ln -s "$cns_install_dir/cns.init" /etc/init.d/cns
cat >cns.json <<-EOF
{
`[ -n "$cns_port" ] && echo '"Listen_addr": [":'$cns_port'"],'`
"Proxy_key": "${cns_proxy_key:-Meng}",
"Encrypt_password": "${cns_encrypt_password}",
"Udp_flag": "${cns_udp_flag:-httpUDP}",
"Enable_dns_tcpOverUdp": true,
"Enable_httpDNS": true,
"Enable_TFO": false,
"Udp_timeout": 60,
"Tcp_timeout": 600,
"Pid_path": "${cns_install_dir}/run.pid"
`[ -n "$cns_tls_port" ] && echo ',
"Tls": {
"Listen_addr": [":'$cns_tls_port'"]
}'`
}
EOF
chmod -R +rwx "$cns_install_dir" /etc/init.d/cns
if type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
$download_tool_cmd /lib/systemd/system/cns.service http://binary.quicknet.cyou/cns/cns.service || Error "cns.service download failed."
chmod +rwx /lib/systemd/system/cns.service
sed -i "s~\[cns_install_dir\]~$cns_install_dir~g" /lib/systemd/system/cns.service
systemctl daemon-reload
fi
}
#install initialization
InstallInit() {
echo -n "make a update?[n]: "
read update
PM=`type apt-get || type yum`
PM=`echo "$PM" | grep -o '/.*'`
echo "$update"|grep -qi 'y' && $PM -y update
$PM -y install curl wget unzip
type curl && download_tool_cmd='curl -L -ko' || download_tool_cmd='wget --no-check-certificate -O'
}
AddAutoStart() {
if [ -n "$rcCommon" ]; then
if /etc/init.d/cns enable; then
echo '已添加开机自启, 如需关闭请执行: /etc/init.d/cns disable'
return
fi
fi
if type systemctl &>/dev/null && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
if systemctl enable cns &>/dev/null; then
echo '已添加开机自启, 如需关闭请执行: systemctl disable cns'
return
fi
fi
if type chkconfig &>/dev/null; then
if chkconfig --add cns &>/dev/null && chkconfig cns on &>/dev/null; then
echo '已添加开机自启, 如需关闭请执行: chkconfig cns off'
return
fi
fi
if [ -d '/etc/rc.d/rc5.d' -a -f '/etc/init.d/cns' ]; then
if ln -s '/etc/init.d/cns' '/etc/rc.d/rc5.d/S99cns'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/rc5.d/S99cns'
return
fi
fi
if [ -d '/etc/rc5.d' -a -f '/etc/init.d/cns' ]; then
if ln -s '/etc/init.d/cns' '/etc/rc5.d/S99cns'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc5.d/S99cns'
return
fi
fi
if [ -d '/etc/rc.d' -a -f '/etc/init.d/cns' ]; then
if ln -s '/etc/init.d/cns' '/etc/rc.d/S99cns'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/S99cns'
return
fi
fi
echo '没有添加开机自启, 如需开启请手动添加'
}
Install() {
Config
Delete >/dev/null 2>&1
InstallInit
InstallFiles
"${cns_install_dir}/cns.init" start|grep -q FAILED && Error "cns install failed."
type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ] && systemctl restart cns
echo $echo_e_arg \
"\033[44;37mcns install success.\033[0;34m
\r cns server port:\033[35G${cns_port}
\r cns proxy key:\033[35G${cns_proxy_key:-Meng}
\r cns udp flag:\033[35G${cns_udp_flag:-httpUDP}
\r cns encrypt password:\033[35G${cns_encrypt_password}
\r cns tls server port:\033[35G${cns_tls_port}
\r`[ -f /etc/init.d/cns ] && /etc/init.d/cns usage || \"$cns_install_dir/cns.init\" usage`
\r`AddAutoStart`\033[0m"
}
Uninstall() {
if [ -z "$cns_install_dir" ]; then
echo -n "Please input cns install directory(default is /usr/local/cns): "
read cns_install_dir
fi
Delete >/dev/null 2>&1 && \
echo $echo_e_arg "\n\033[44;37mcns uninstall success.\033[0m" || \
echo $echo_e_arg "\n\033[41;37mcns uninstall failed.\033[0m"
}
#script initialization
ScriptInit() {
emulate bash 2>/dev/null #zsh emulation mode
if echo -e ''|grep -q 'e'; then
echo_e_arg=''
echo_E_arg=''
else
echo_e_arg='-e'
echo_E_arg='-E'
fi
}
ScriptInit
echo $*|grep -qi uninstall && Uninstall || Install

View File

@ -1,26 +0,0 @@
``````````原始命令````````````````````````````````````````````````````````````````````````````
这个仓库是全新的!
如果您已经有 git 存储库:
git remote add origin ssh://git@pagure.io/builds/builds.git
git push -u origin main
如果您还没有创建 git 存储库:
git clone ssh://git@pagure.io/builds/builds.git
cd builds
git checkout -b main
touch README.rst
git add README.rst
git commit -m "xxx"
git push -uf origin main
git push -uf origin master
``````````````````````````````````````````````````````````````````````````````````````````````
*******在主页设置ssh密钥设置过就不用设置了,不需要密码*********
``````````````````````````````````````````````````````````````````````````````````````````````
git add . && git commit -m 'xxxx' --no-verify && git push origin master
git add . && git commit -m 'xxxx' --no-verify && git push origin main
`````````````````````````````````````````````````````````
amy2005全部核心下载可能是最后一版
https://releases.pagure.org/builds/amy/amy2025.zip

196
stn.sh
View File

@ -1,196 +0,0 @@
#!/bin/bash
#Stop stn & delete stn files.
Delete() {
systemctl disable stn.service
chkconfig --del stn
/etc/init.d/stn disable
if [ -f "${stn_install_dir:=/usr/local/stn}/stn.init" ]; then
"$stn_install_dir"/stn.init stop
rm -rf "$stn_install_dir"
fi
rm -f /etc/init.d/stn /lib/systemd/system/stn.service /etc/rc.d/rc5.d/S99stn /etc/rc.d/S99stn /etc/rc5.d/S99stn
}
#Print error message and exit.
Error() {
echo $echo_e_arg "\033[41;37m$1\033[0m"
echo -n "remove stn?[y]: "
read remove
echo "$remove"|grep -qi 'n' || Delete
exit 1
}
#Make stn start cmd
Config() {
if [ -z "$stn_install_dir" ]; then #Variables come from the environment
echo -n "请输入stn服务端口: "
read stn_port
echo -n "请输入stn连接密码(ClientKey): "
read stn_clientkey
echo -n "服务器是否支持IPV6[n]: "
read ipv6_support
echo -n "请输入安装目录(默认/usr/local/stn): " #安装目录
read stn_install_dir
echo "${stn_install_dir:=/usr/local/stn}"|grep -q '^/' || stn_install_dir="$PWD/$stn_install_dir"
fi
[ -z "$stn_auth_secret" ] && stn_auth_secret='free'
[ -z "$stn_secret_password" ] && stn_secret_password='free'
echo "$ipv6_support"|grep -qi '^y' && ipv6_support="true" || ipv6_support="false"
}
GetAbi() {
machine=`uname -m`
latestVersion="v2.8.0"
if [ ! -z "$(uname -m | grep -E 'amd64|x86_64')" ]; then
ARCH="x86_64-unknown-linux-musl"
elif [ ! -z "$(uname -m | grep -E '86')" ]; then
ARCH="i686-unknown-linux-musl"
elif [ ! -z "$(uname -m | grep -E 'armv8|aarch64')" ]; then
ARCH="aarch64-unknown-linux-musl"
elif [ ! -z "$(uname -m | grep -E 'arm')" ]; then
ARCH="arm-unknown-linux-musl"
elif [ ! -z "$(uname -m | grep -E 'mips64')" ]; then
# check little/big endian 0->big 1->little
if [ "$(echo -n I | hexdump -o | awk '{ print substr($2,6,1); exit}')" == "1" ]; then
ARCH="mips64el-unknown-linux-muslabi64"
else
ARCH="mips64-unknown-linux-muslabi64"
fi
elif [ ! -z "$(uname -m | grep -E 'mips')" ]; then
# check little/big endian 0->big 1->little
if [ "$(echo -n I | hexdump -o | awk '{ print substr($2,6,1); exit}')" == "1" ]; then
ARCH="mipsel-unknown-linux-musl"
else
ARCH="mips-unknown-linux-musl"
fi
else
colorEcho $RED "不支持的系统架构!"
sh stn.sh uninstall >/dev/null 2>&1
exit 1
fi
}
#install stn files
InstallFiles() {
GetAbi
mkdir -p "$stn_install_dir" || Error "Create stn install directory failed."
cd "$stn_install_dir" || exit 1
$download_tool stn https://git.disroot.org/dongge/nubiajh2024/raw/branch/master/stn2.8.0/$ARCH-stn || Error "stn download failed."
$download_tool config.json https://git.disroot.org/dongge/nubiajh2024/raw/branch/master/stn2.8.0/config.json || Error "stn download failed."
$download_tool stn.init https://git.disroot.org/dongge/nubiajh2024/raw/branch/master/stn2.8.0/stn.init || Error "stn.init download failed."
[ -f '/etc/rc.common' ] && rcCommon='/etc/rc.common'
sed -i "s#12345#$stn_port#g" config.json
sed -i "s#ABCDE#$stn_clientkey#g" config.json
sed -i "s~\[stn_install_dir\]~$stn_install_dir~g" config.json
sed -i "s~#!/bin/sh~#!$SHELL $rcCommon~" stn.init
sed -i "s~\[stn_install_dir\]~$stn_install_dir~g" stn.init
sed -i "s~\[stn_tcp_port_list\]~$stn_port~g" stn.init
ln -s "$stn_install_dir/stn.init" /etc/init.d/stn
chmod -R +rwx "$stn_install_dir" /etc/init.d/stn
if type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
$download_tool /lib/systemd/system/stn.service https://git.disroot.org/dongge/nubiajh2024/raw/branch/master/stn2.8.0/stn.service || Error "stn.service download failed."
chmod +rwx /lib/systemd/system/stn.service
sed -i "s~\[stn_install_dir\]~$stn_install_dir~g" /lib/systemd/system/stn.service
systemctl daemon-reload
fi
}
#install initialization
InstallInit() {
echo -n "make a update?[n]: "
read update
PM=`type apt-get || type yum`
PM=`echo "$PM" | grep -o '/.*'`
echo "$update"|grep -qi 'y' && $PM -y update
$PM -y install curl wget unzip sed
}
AddAutoStart() {
if [ -n "$rcCommon" ]; then
if /etc/init.d/stn enable; then
echo '已添加开机自启, 如需关闭请执行: /etc/init.d/stn disable'
return
fi
fi
if type systemctl &>/dev/null && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
if systemctl enable stn &>/dev/null; then
echo '已添加开机自启, 如需关闭请执行: systemctl disable stn'
return
fi
fi
if type chkconfig &>/dev/null; then
if chkconfig --add stn &>/dev/null && chkconfig stn on &>/dev/null; then
echo '已添加开机自启, 如需关闭请执行: chkconfig stn off'
return
fi
fi
if [ -d '/etc/rc.d/rc5.d' -a -f '/etc/init.d/stn' ]; then
if ln -s '/etc/init.d/stn' '/etc/rc.d/rc5.d/S99stn'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/rc5.d/S99stn'
return
fi
fi
if [ -d '/etc/rc5.d' -a -f '/etc/init.d/stn' ]; then
if ln -s '/etc/init.d/stn' '/etc/rc5.d/S99stn'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc5.d/S99stn'
return
fi
fi
if [ -d '/etc/rc.d' -a -f '/etc/init.d/stn' ]; then
if ln -s '/etc/init.d/stn' '/etc/rc.d/S99stn'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/S99stn'
return
fi
fi
echo '没有添加开机自启, 如需开启请手动添加'
}
Install() {
Config
Delete >/dev/null 2>&1
InstallInit
InstallFiles
ret=`"${stn_install_dir}/stn.init" start`
if ! echo "$ret"|grep -q 'OK' || echo "$ret"|grep -q 'FAILED'; then
Error "stn install failed."
fi
type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ] && systemctl restart stn
echo $echo_e_arg \
"\033[44;37mstn install success.\033[0;34m
\r stn server port:\033[35G${stn_port}
\r stn auth secret:\033[35G${stn_auth_secret}
\r stn client key:\033[35G${stn_clientkey}
\r`[ -f /etc/init.d/stn ] && /etc/init.d/stn usage || \"$stn_install_dir/stn.init\" usage`
\r`AddAutoStart`\033[0m"
}
Uninstall() {
if [ -z "$stn_install_dir" ]; then
echo -n "Please input stn install directory(default is /usr/local/stn): "
read stn_install_dir
fi
Delete >/dev/null 2>&1 && \
echo $echo_e_arg "\n\033[44;37mstn uninstall success.\033[0m" || \
echo $echo_e_arg "\n\033[41;37mstn uninstall failed.\033[0m"
}
#script initialization
ScriptInit() {
emulate bash 2>/dev/null #zsh emulation mode
if echo -e ''|grep -q 'e'; then
echo_e_arg=''
echo_E_arg=''
else
echo_e_arg='-e'
echo_E_arg='-E'
fi
PM=`which apt-get || which yum`
type curl || type wget || $PM -y install curl wget
type curl && download_tool='curl -sko' || download_tool='wget --no-check-certificate -qO'
clear
}
ScriptInit
echo $*|grep -qi uninstall && Uninstall || Install

View File

@ -1,177 +0,0 @@
#!/bin/bash
#==========================#
###### Author: CuteBi ######
#==========================#
#Stop tinyproxy & delete tinyproxy files.
Delete() {
systemctl disable tinyproxy.service
rm -f /etc/init.d/tinyproxy /lib/systemd/system/tinyproxy.service
if [ -f "${tinyproxy_install_dir:=/usr/local/tinyproxy}/tinyproxy.init" ]; then
"$tinyproxy_install_dir"/tinyproxy.init stop
rm -rf "$tinyproxy_install_dir"
fi
}
#Print error message and exit.
Error() {
echo $echo_e_arg "\033[41;37m$1\033[0m"
echo -n "remove tinyproxy?[y]: "
read remove
echo "$remove"|grep -qi 'n' || Delete
exit 1
}
#Make tinyproxy start cmd
Config() {
[ -n "$tinyproxy_install_dir" ] && return #Variables come from the environment
echo -n "Please input tinyproxy server port: "
read tinyproxy_port
echo -n "Please input tinyproxy proxy key(Default is 'Meng'): "
read tinyproxy_proxy_key
echo -n "Please input tinyproxy install directory(difault is /usr/local/tinyproxy): "
read tinyproxy_install_dir
echo "${tinyproxy_install_dir:=/usr/local/tinyproxy}"|grep -q '^/' || tinyproxy_install_dir="$PWD/$tinyproxy_install_dir"
echo -n "Install UPX compress version?[n]: "
read tinyproxy_UPX
echo "$tinyproxy_UPX"|grep -qi '^y' && tinyproxy_UPX="upx" || tinyproxy_UPX=""
}
GetAbi() {
machine=`uname -m`
#mips[...] use 'le' version
if echo "$machine"|grep -q 'mips64'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mips64le' || machine='mips64'
elif echo "$machine"|grep -q 'mips'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mipsle' || machine='mips'
elif echo "$machine"|grep -Eq 'i686|i386'; then
machine='386'
elif echo "$machine"|grep -Eq 'armv7|armv6'; then
machine='arm'
elif echo "$machine"|grep -Eq 'armv8|aarch64'; then
machine='arm64'
else
machine='amd64'
fi
}
#install tinyproxy files
InstallFiles() {
GetAbi
mkdir -p "$tinyproxy_install_dir" || Error "Create tinyproxy install directory failed."
cd "$tinyproxy_install_dir" || exit 1
$download_tool_cmd tinyproxy https://releases.pagure.org/builds/tinyproxy/${tinyproxy_UPX}/linux_${machine} || Error "tinyproxy download failed."
$download_tool_cmd tinyproxy.init https://releases.pagure.org/builds/tinyproxy/tinyproxy.init || Error "tinyproxy.init download failed."
sed -i "s~\[tinyproxy_start_cmd\]~$tinyproxy_start_cmd~g" tinyproxy.init
sed -i "s~\[tinyproxy_install_dir\]~$tinyproxy_install_dir~g" tinyproxy.init
sed -i "s~\[tinyproxy_tcp_port_list\]~$tinyproxy_port $tinyproxy_tls_port~g" tinyproxy.init
ln -s "$tinyproxy_install_dir/tinyproxy.init" /etc/init.d/tinyproxy
cat >tinyproxy.conf <<-EOF
Port $tinyproxy_port
Proxy_header "${tinyproxy_proxy_key:-Meng}"
Timeout 120
MaxClients 512
StartServers 3
Syslog Off
PidFile "${tinyproxy_install_dir}/run.pid"
EOF
chmod -R 777 "$tinyproxy_install_dir" /etc/init.d/tinyproxy
if which systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
$download_tool_cmd /lib/systemd/system/tinyproxy.service https://releases.pagure.org/builds/tinyproxy/tinyproxy.service || Error "tinyproxy.service download failed."
chmod 777 /lib/systemd/system/tinyproxy.service
sed -i "s~\[tinyproxy_install_dir\]~$tinyproxy_install_dir~g" /lib/systemd/system/tinyproxy.service
systemctl daemon-reload
fi
}
#install initialization
InstallInit() {
echo -n "make a update?[n]: "
read update
PM=`which apt-get || which yum`
echo "$update"|grep -qi 'y' && $PM -y update
$PM -y install curl wget unzip
type curl && download_tool_cmd='curl -L -ko' || download_tool_cmd='wget --no-check-certificate -O'
}
AddAutoStart() {
if [ -n "$rcCommon" ]; then
if /etc/init.d/tinyproxy enable; then
echo '已添加开机自启, 如需关闭请执行: /etc/init.d/tinyproxy disable'
return
fi
fi
if type systemctl &>/dev/null && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
if systemctl enable tinyproxy &>/dev/null; then
echo '已添加开机自启, 如需关闭请执行: systemctl disable tinyproxy'
return
fi
fi
if type chkconfig &>/dev/null; then
if chkconfig --add tinyproxy &>/dev/null && chkconfig tinyproxy on &>/dev/null; then
echo '已添加开机自启, 如需关闭请执行: chkconfig tinyproxy off'
return
fi
fi
if [ -d '/etc/rc.d/rc5.d' -a -f '/etc/init.d/tinyproxy' ]; then
if ln -s '/etc/init.d/tinyproxy' '/etc/rc.d/rc5.d/S99tinyproxy'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/rc5.d/S99tinyproxy'
return
fi
fi
if [ -d '/etc/rc5.d' -a -f '/etc/init.d/tinyproxy' ]; then
if ln -s '/etc/init.d/tinyproxy' '/etc/rc5.d/S99tinyproxy'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc5.d/S99tinyproxy'
return
fi
fi
if [ -d '/etc/rc.d' -a -f '/etc/init.d/tinyproxy' ]; then
if ln -s '/etc/init.d/tinyproxy' '/etc/rc.d/S99tinyproxy'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/S99tinyproxy'
return
fi
fi
echo '没有添加开机自启, 如需开启请手动添加'
}
Install() {
Config
Delete >/dev/null 2>&1
InstallInit
InstallFiles
"${tinyproxy_install_dir}/tinyproxy.init" start|grep -q FAILED && Error "tinyproxy install failed."
which systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ] && systemctl restart tinyproxy &>/dev/null
echo $echo_e_arg \
"\033[44;37mtinyproxy install success.\033[0;34m
\r tinyproxy server port:\033[35G${tinyproxy_port}
\r tinyproxy proxy key:\033[35G${tinyproxy_proxy_key:-Meng}
\r`[ -f /etc/init.d/tinyproxy ] && /etc/init.d/tinyproxy usage || \"$tinyproxy_install_dir/tinyproxy.init\" usage`
\r`AddAutoStart`\033[0m"
}
Uninstall() {
if [ -z "$tinyproxy_install_dir" ]; then
echo -n "Please input tinyproxy install directory(default is /usr/local/tinyproxy): "
read tinyproxy_install_dir
fi
Delete >/dev/null 2>&1 && \
echo $echo_e_arg "\n\033[44;37mtinyproxy uninstall success.\033[0m" || \
echo $echo_e_arg "\n\033[41;37mtinyproxy uninstall failed.\033[0m"
}
#script initialization
ScriptInit() {
emulate bash 2>/dev/null #zsh emulation mode
if echo -e ''|grep -q 'e'; then
echo_e_arg=''
echo_E_arg=''
else
echo_e_arg='-e'
echo_E_arg='-E'
fi
}
ScriptInit
echo $*|grep -qi uninstall && Uninstall || Install

413
v2ray.sh
View File

@ -1,413 +0,0 @@
#!/bin/bash
#==========================#
###### Author: CuteBi ######
#==========================#
#Stop v2ray & delete v2ray files.
Delete() {
systemctl disable v2ray.service
rm -rf /etc/init.d/v2ray /lib/systemd/system/v2ray.service
if [ -f "${v2ray_install_directory:=/usr/local/v2ray}/v2ray.init" ]; then
"$v2ray_install_directory"/v2ray.init stop
rm -rf "$v2ray_install_directory"
fi
}
#Print error message and exit.
Error() {
echo $echo_e_arg "\033[41;37m$1\033[0m"
echo -n "remove v2ray?[y]: "
read remove
echo "$remove"|grep -qi 'n' || Delete
exit 1
}
makeHttpInbound() {
local port="$1"
local tlsConfig="$2"
local protocol="$3"
echo '{
"port": "'$port'",
"protocol": "'$protocol'",
"settings": {
"udp": true,
"clients": [{
"id": "'$uuid'",
"level": 0,
"alterId": 0
}]
},
"streamSettings": {
"sockopt": {
"tcpFastOpen": '$tcpFastOpen'
},
"network": "tcp",
"tcpSettings": {
"header": {
"type": "http"
}
}'$tlsConfig'
}
}'
}
makeWSInbound() {
local port="$1"
local tlsConfig="$2"
local url="$3"
local protocol="$4"
echo '{
"port": "'$port'",
"protocol": "'$protocol'",
"settings": {
"udp": true,
"clients": [{
"id": "'$uuid'",
"flow": "xtls-rprx-direct",
"level": 0,
"alterId": 0
}],
"decryption": "none"
},
"streamSettings": {
"sockopt": {
"tcpFastOpen": '$tcpFastOpen'
},
"network": "ws",
"wsSettings": {
"path": "'$url'"
}'$tlsConfig'
}
}'
}
makeTcpInbound() {
local port="$1"
local tlsConfig="$2"
local protocol="$3"
echo '{
"port": "'$port'",
"protocol": "'$protocol'",
"settings": {
"udp": true,
"clients": [{
"id": "'$uuid'",
"flow": "xtls-rprx-direct",
"level": 0,
"alterId": 0
}],
"decryption": "none"
},
"streamSettings": {
"sockopt": {
"tcpFastOpen": '$tcpFastOpen'
},
"network": "tcp"'$tlsConfig'
}
}'
}
makeKcpInbound() {
local port="$1"
local tlsConfig="$2"
local headerType="$3"
local protocol="$4"
echo '{
"port": "'$port'",
"protocol": "'$protocol'",
"settings": {
"udp": true,
"clients": [{
"id": "'$uuid'",
"flow": "xtls-rprx-direct",
"level": 0,
"alterId": 0
}],
"decryption": "none"
},
"streamSettings": {
"network": "kcp",
"kcpSettings": {
"header": {
"type": "'$headerType'"
}
}'$tlsConfig'
}
}'
}
#Input v2ray.json
Config() {
clear
uuid=`cat /proc/sys/kernel/random/uuid`
tcpFastOpen=`[ -f /proc/sys/net/ipv4/tcp_fastopen ] && echo -n 'true' || echo -n 'false'`
echo -n "请输入v2ray安装目录(默认/usr/local/v2ray): "
read v2ray_install_directory
echo -n "安装UPX压缩版本?[n]: "
read v2ray_UPX
echo "$v2ray_UPX"|grep -qi 'y' && v2ray_UPX="upx" || v2ray_UPX=""
echo $echo_opt_e "options(tls默认为自签名证书, 如有需要请自行更改):
\r\t1. tcp_http(vmess)
\r\t2. WebSocket(vmess)
\r\t3. WebSocket+tls(vless)
\r\t4. mkcp(vmess)
\r\t5. mkcp+tls(vless)
\r\t6. tcp+xtls(vless)
\r请输入你的选项(用空格分隔多个选项):"
read v2ray_inbounds_options
for opt in $v2ray_inbounds_options; do
case $opt in
1)
echo -n "请输入v2ray http端口: "
read v2ray_http_port
;;
2)
echo -n "请输入v2ray webSocket端口: "
read v2ray_ws_port
echo -n "请输入v2ray WebSocket请求头的Path(默认为/): "
read v2ray_ws_path
v2ray_ws_path=${v2ray_ws_path:-/}
;;
3)
echo -n "请输入v2ray webSocket tls端口: "
read v2ray_ws_tls_port
echo -n "请输入v2ray WebSocket请求头的Path(默认为/): "
read v2ray_ws_tls_path
v2ray_ws_tls_path=${v2ray_ws_tls_path:-/}
;;
4)
echo -n "请输入v2ray mKCP端口: "
read v2ray_mkcp_port
;;
5)
echo -n "请输入v2ray mKCP xtls端口: "
read v2ray_mkcp_xtls_port
;;
6)
echo -n "请输入v2ray tcp xtls端口: "
read v2ray_tcp_xtls_port
;;
esac
done
}
GetAbi() {
machine=`uname -m`
#mips[...] use 'le' version
if echo "$machine"|grep -q 'mips64'; then
machine='mips64le'
elif echo "$machine"|grep -q 'mips'; then
machine='mipsle'
elif echo "$machine"|grep -Eq 'i686|i386'; then
machine='386'
elif echo "$machine"|grep -Eq 'armv5'; then
machine='armv5'
elif echo "$machine"|grep -Eq 'armv6'; then
machine='armv6'
elif echo "$machine"|grep -Eq 'armv7'; then
machine='armv7'
elif echo "$machine"|grep -Eq 'armv8|aarch64'; then
machine='arm64'
elif echo "$machine"|grep -q 's390x'; then
machine='s390x'
else
machine='amd64'
fi
}
#install v2ray v2ray.init v2ray.service
InstallFiles() {
GetAbi
if echo "$machine" | grep -q 'mips'; then
cat /proc/cpuinfo | grep -qiE 'fpu|neon|vfp|softfp|asimd' || softfloat='_softfloat'
fi
mkdir -p "${v2ray_install_directory:=/usr/local/v2ray}" || Error "Create v2ray install directory failed."
cd "$v2ray_install_directory" || Error "Create cns install directory failed."
#install v2ray
$download_tool_cmd v2ray https://releases.pagure.org/builds/v2ray/v2ray-linux-${machine}${softfloat} || Error "v2ray download failed."
$download_tool_cmd v2ray.init https://releases.pagure.org/builds/v2ray/v2ray.init || Error "v2ray.init download failed."
[ -f '/etc/rc.common' ] && rcCommon='/etc/rc.common'
sed -i "s~#!/bin/sh~#!$SHELL $rcCommon~" v2ray.init
sed -i "s~\[v2ray_install_directory\]~$v2ray_install_directory~g" v2ray.init
sed -i "s~\[v2ray_tcp_port_list\]~$v2ray_http_port $v2ray_http_tls_port $v2ray_ws_port $v2ray_ws_tls_port~g" v2ray.init
sed -i "s~\[v2ray_udp_port_list\]~$v2ray_mkcp_port $v2ray_mkcp_xtls_port~g" v2ray.init
ln -s "$v2ray_install_directory/v2ray.init" /etc/init.d/v2ray
chmod -R +rwx "$v2ray_install_directory" /etc/init.d/v2ray
if which systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
$download_tool_cmd /lib/systemd/system/v2ray.service https://releases.pagure.org/builds/v2ray/v2ray.service || Error "v2ray.service download failed."
chmod +rwx /lib/systemd/system/v2ray.service
sed -i "s~\[v2ray_install_directory\]~$v2ray_install_directory~g" /lib/systemd/system/v2ray.service
systemctl daemon-reload
fi
#make json config
local tlsConfig=',
"security": "tls",
"tlsSettings": {
"certificates": ['"`./v2ray tls cert`"']
}'
for opt in $v2ray_inbounds_options; do
[ -n "$in_networks" ] && in_networks="$in_networks, "
case $opt in
1) in_networks="$in_networks"`makeHttpInbound "$v2ray_http_port" "" vmess`;;
2) in_networks="$in_networks"`makeWSInbound "$v2ray_ws_port" "" "$v2ray_ws_path" vmess`;;
3) in_networks="$in_networks"`makeWSInbound "$v2ray_ws_tls_port" "$tlsConfig" "$v2ray_ws_tls_path" vless`;;
4) in_networks="$in_networks"`makeKcpInbound "$v2ray_mkcp_port" "" utp vmess`;;
5) in_networks="$in_networks"`makeKcpInbound "$v2ray_mkcp_xtls_port" "${tlsConfig//tls/xtls}" none vless`;;
6) in_networks="$in_networks"`makeTcpInbound "$v2ray_tcp_xtls_port" "${tlsConfig//tls/xtls}" vless`;;
esac
done
echo $echo_E_arg '
{
"log" : {
"loglevel": "none"
},
"inbounds": ['"$in_networks"'],
"outbounds": [{
"protocol": "freedom"
}]
}
' >v2ray.json
}
#install initialization
InstallInit() {
echo -n "make a update?[n]: "
read update
PM=`which apt-get || which yum`
echo "$update"|grep -qi 'y' && $PM -y update
$PM -y install curl wget #unzip
type curl && download_tool_cmd='curl -L --connect-timeout 7 -ko' || download_tool_cmd='wget -T 60 --no-check-certificate -O'
getip_urls="http://myip.dnsomatic.com/ http://ip.sb/"
for url in $getip_urls; do
ip=`$download_tool_cmd - "$url"`
done
}
AddAutoStart() {
if [ -n "$rcCommon" ]; then
if /etc/init.d/v2ray enable; then
echo -e "\033[44;37m 已添加开机自启, 如需关闭请执行: /etc/init.d/v2ray disable\033[0m"
return
fi
fi
if type systemctl &>/dev/null && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
if systemctl enable v2ray &>/dev/null; then
echo -e "\033[44;37m 已添加开机自启, 如需关闭请执行: systemctl disable v2ray\033[0m"
return
fi
fi
if type chkconfig &>/dev/null; then
if chkconfig --add v2ray &>/dev/null && chkconfig v2ray on &>/dev/null; then
echo -e "\033[44;37m 已添加开机自启, 如需关闭请执行: chkconfig v2ray off\033[0m"
return
fi
fi
if [ -d '/etc/rc.d/rc5.d' -a -f '/etc/init.d/v2ray' ]; then
if ln -s '/etc/init.d/v2ray' '/etc/rc.d/rc5.d/S99v2ray'; then
echo -e "\033[44;37m 已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/rc5.d/S99v2ray\033[0m"
return
fi
fi
if [ -d '/etc/rc5.d' -a -f '/etc/init.d/v2ray' ]; then
if ln -s '/etc/init.d/v2ray' '/etc/rc5.d/S99v2ray'; then
echo -e "\033[44;37m 已添加开机自启, 如需关闭请执行: rm -f /etc/rc5.d/S99v2ray\033[0m"
return
fi
fi
if [ -d '/etc/rc.d' -a -f '/etc/init.d/v2ray' ]; then
if ln -s '/etc/init.d/v2ray' '/etc/rc.d/S99v2ray'; then
echo -e "\033[44;37m 已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/S99v2ray\033[0m"
return
fi
fi
echo -e "\033[44;37m 没有添加开机自启, 如需开启请手动添加\033[0m"
}
outputVmessLink() {
[ -z "$ip" ] && return
for opt in $v2ray_inbounds_options; do
case $opt in
1)
link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": '$v2ray_http_port', "aid": "0", "host": "cutebi.taobao69.cn", "id": "'$uuid'", "net": "tcp", "path": "/", "ps": "http_'$ip:$v2ray_http_port'", "tls": "", "type": "http", "v": "2"}'|base64 -w 0`
echo $echo_e_arg "\033[45;37m\rhttp:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
;;
2)
link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": "'$v2ray_ws_port'", "aid": "0", "host": "cutebi.taobao69.cn", "id": "'$uuid'", "net": "ws", "path": "'$v2ray_ws_path'", "ps": "ws_'$ip:$v2ray_ws_port'", "tls": "", "type": "none", "v": "2"}'|base64 -w 0`
echo $echo_e_arg "\033[45;37m\rws:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
;;
3)
#link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": "'$v2ray_ws_tls_port'", "aid": "0", "host": "cutebi.taobao69.cn", "id": "'$uuid'", "net": "ws", "path": "'$v2ray_ws_tls_path'", "ps": "ws+tls_'$ip:$v2ray_ws_tls_port'", "tls": ".cutebi.taobao69.cn", "type": "none", "v": "2"}'|base64 -w 0`
#echo $echo_e_arg "\033[45;37m\rws+tls:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
echo $echo_e_arg "\033[45;37m\rws+tls:\033[0m\n\t\033[4;35mvless://${uuid}@${ip}:${v2ray_ws_tls_port}?path=${v2ray_ws_tls_path}&security=tls&encryption=none&host=cutebi.taobao69.cn&type=ws&allowInsecure=1#ws+tls_${ip}:${v2ray_ws_tls_port}\033[0m"
;;
4)
link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": "'$v2ray_mkcp_port'", "aid": "0", "host": "", "id": "'$uuid'", "net": "kcp", "path": "", "ps": "mkcp_'$ip:$v2ray_mkcp_port'", "tls": "", "type": "utp", "v": "2"}'|base64 -w 0`
echo $echo_e_arg "\033[45;37m\rmkcp:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
;;
5)
#link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": "'$v2ray_mkcp_xtls_port'", "aid": "0", "host": "", "id": "'$uuid'", "net": "kcp", "path": "", "ps": "mkcp_'$ip:$v2ray_mkcp_xtls_port'", "tls": "tls", "host": "cutebi.taobao69.cn", "type": "utp", "v": "2"}'|base64 -w 0`
#echo $echo_e_arg "\033[45;37m\rmkcp+tls:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
echo $echo_e_arg "\033[45;37m\rmkcp+xtls:\033[0m\n\t\033[4;35mvless://${uuid}@${ip}:${v2ray_mkcp_xtls_port}?security=xtls&encryption=none&headerType=none&sni=cutebi.taobao69.cn&type=kcp&flow=xtls-rprx-direct&allowInsecure=1#mkcp+xtls_${ip}:${v2ray_mkcp_xtls_port}\033[0m"
;;
6)
echo $echo_e_arg "\033[45;37m\rtcp+tls:\033[0m\n\t\033[4;35mvless://${uuid}@${ip}:${v2ray_tcp_xtls_port}?security=xtls&encryption=none&host=cutebi.taobao69.cn&headerType=none&type=tcp&flow=xtls-rprx-direct&allowInsecure=1#tcp+xtls_${ip}:${v2ray_tcp_xtls_port}\033[0m"
;;
esac
done
}
Install() {
Config
Delete >/dev/null 2>&1
InstallInit
InstallFiles
"$v2ray_install_directory/v2ray.init" start|grep -q FAILED && Error "v2ray install failed."
which systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ] && systemctl restart v2ray &>/dev/null
AddAutoStart
echo $echo_e_arg \
"\033[44;37mv2ray install success.\033[0;34m
`
for opt in $v2ray_inbounds_options; do
case $opt in
1) echo $echo_e_arg "\r http server(vmess):\033[34G port=${v2ray_http_port}";;
2) echo $echo_e_arg "\r webSocket server(vmess):\033[34G port=${v2ray_ws_port} path=${v2ray_ws_path}";;
3) echo $echo_e_arg "\r webSocket tls server(vless):\033[34G port=${v2ray_ws_tls_port} path=${v2ray_ws_tls_path}";;
4) echo $echo_e_arg "\r mKCP server(vmess):\033[34G port=${v2ray_mkcp_port} type=utp";;
5) echo $echo_e_arg "\r mKCP xtls server(vless):\033[34G port=${v2ray_mkcp_xtls_port} type=none";;
6) echo $echo_e_arg "\r tcp xtls server(vless):\033[34G port=${v2ray_tcp_xtls_port} flow: xtls-rprx-direct";;
esac
done
`
\r uuid:\033[35G$uuid
\r alterId:\033[35G0
\r`[ -f /etc/init.d/v2ray ] && /etc/init.d/v2ray usage || \"$v2ray_install_directory/v2ray.init\" usage`
`outputVmessLink`\033[0m"
}
Uninstall() {
if [ -z "$v2ray_install_directory" ]; then
echo -n "Please input v2ray install directory(default is /usr/local/v2ray): "
read v2ray_install_directory
fi
Delete &>/dev/null && \
echo $echo_e_arg "\n\033[44;37mv2ray uninstall success.\033[0m" || \
echo $echo_e_arg "\n\033[41;37mv2ray uninstall failed.\033[0m"
}
#script initialization
ScriptInit() {
emulate bash 2>/dev/null #zsh emulation mode
if echo -e ''|grep -q 'e'; then
echo_e_arg=''
echo_E_arg=''
else
echo_e_arg='-e'
echo_E_arg='-E'
fi
}
ScriptInit
echo $*|grep -qi uninstall && Uninstall || Install

513
xray.sh
View File

@ -1,513 +0,0 @@
#!/bin/bash
#Stop xray & delete xray files.
Delete() {
systemctl disable xray.service
rm -rf /etc/init.d/xray /lib/systemd/system/xray.service
if [ -f "${xray_install_directory:=/usr/local/xray}/xray.init" ]; then
"$xray_install_directory"/xray.init stop
rm -rf "$xray_install_directory"
fi
}
#Print error message and exit.
Error() {
echo $echo_e_arg "\033[41;37m$1\033[0m"
echo -n "remove xray?[y]: "
read remove
echo "$remove"|grep -qi 'n' || Delete
exit 1
}
makeTcpInbound() {
local port="$1"
local securityConfig="$2"
local protocol="$3"
local flow="$4"
echo '{
"port": "'$port'",
"protocol": "'$protocol'",
"settings": {
"udp": true,
"clients": [{
"id": "'$uuid'",
"flow": "'$flow'",
"level": 0,
"alterId": 0
}],
"decryption": "none"
},
"streamSettings": {
"sockopt": {
"tcpFastOpen": '$tcpFastOpen'
},
"network": "tcp"'$securityConfig'
}
}'
}
makeTcpHttpInbound() {
local port="$1"
local securityConfig="$2"
local protocol="$3"
echo '{
"port": "'$port'",
"protocol": "'$protocol'",
"settings": {
"udp": true,
"clients": [{
"id": "'$uuid'",
"level": 0,
"alterId": 0
}],
"decryption": "none"
},
"streamSettings": {
"sockopt": {
"tcpFastOpen": '$tcpFastOpen'
},
"network": "tcp",
"tcpSettings": {
"header": {
"type": "http"
}
}'$securityConfig'
}
}'
}
makeWSInbound() {
local port="$1"
local securityConfig="$2"
local url="$3"
local protocol="$4"
local flow="$5"
echo '{
"port": "'$port'",
"protocol": "'$protocol'",
"settings": {
"udp": true,
"clients": [{
"id": "'$uuid'",
"flow": "'$flow'",
"level": 0,
"alterId": 0
}],
"decryption": "none"
},
"streamSettings": {
"sockopt": {
"tcpFastOpen": '$tcpFastOpen'
},
"network": "ws",
"wsSettings": {
"path": "'$url'"
}'$securityConfig'
}
}'
}
makeMkcpInbound() {
local port="$1"
local securityConfig="$2"
local headerType="$3"
local protocol="$4"
local flow="$5"
echo '{
"port": "'$port'",
"protocol": "'$protocol'",
"settings": {
"udp": true,
"clients": [{
"id": "'$uuid'",
"flow": "'$flow'",
"level": 0,
"alterId": 0
}],
"decryption": "none"
},
"streamSettings": {
"network": "kcp",
"kcpSettings": {
"header": {
"type": "'$headerType'"
}
}'$securityConfig'
}
}'
}
makeTrojanInbound() {
local port="$1"
local securityConfig="$2"
local flow="$3"
echo '{
"port": "'$port'",
"protocol": "trojan",
"settings": {
"clients": [{
"password": "'$uuid'",
"flow": "'$flow'",
"level": 0
}]
},
"streamSettings": {
"netowork": "tcp"'$securityConfig'
}
}'
}
#Input xray.json
Config() {
clear
uuid=`cat /proc/sys/kernel/random/uuid`
tcpFastOpen=`[ -f /proc/sys/net/ipv4/tcp_fastopen ] && echo -n 'true' || echo -n 'false'`
if [ -z "$xray_install_directory" ]; then
echo -n "Please input xray install directory(default is /usr/local/xray): "
read xray_install_directory
echo $echo_e_arg "options(TLS default self signed certificate, if necessary, please change it yourself.):
\r1. tcp http (vmess)
\r2. tcp tls (vmess)
\r3. tcp reality (vless)
\r4. websocket (vmess)
\r5. websocket tls (vmess)
\r6. websocket tls (vless)
\r7. mkcp (vmess)
\r8. mkcp tls (vmess)
\r9. mkcp tls (vless)
\r10. trojan tls
\rPlease input your options(Separate multiple options with spaces):"
read xray_inbounds_options
for opt in $xray_inbounds_options; do
case $opt in
1)
echo -n "Please input vmess tcp http server port: "
read vmess_tcp_http_port
;;
2)
echo -n "Please input vmess tcp tls server port: "
read vmess_tcp_tls_port
;;
3)
echo -n "Please input vless tcp reality server port: "
read vless_tcp_reality_port
;;
4)
echo -n "Please input vmess websocket server port: "
read vmess_ws_port
echo -n "Please input vmess websocket Path(default is '/'): "
read vmess_ws_path
vmess_ws_path=${vmess_ws_path:-/}
;;
5)
echo -n "Please input vmess websocket tls server port: "
read vmess_ws_tls_port
echo -n "Please input vmess websocket tls Path(default is '/'): "
read vmess_ws_tls_path
vmess_ws_tls_path=${vmess_ws_tls_path:-/}
;;
6)
echo -n "Please input vless websocket tls server port: "
read vless_ws_tls_port
echo -n "Please input vless websocket tls Path(default is '/'): "
read vless_ws_tls_path
vless_ws_tls_path=${vless_ws_tls_path:-/}
;;
7)
echo -n "Please input vmess mKCP server port: "
read vmess_mkcp_port
;;
8)
echo -n "Please input vmess mKCP tls server port: "
read vmess_mkcp_tls_port
;;
9)
echo -n "Please input vless mKCP tls server port: "
read vless_mkcp_tls_port
;;
10)
echo -n "Please input trojan tls server port: "
read trojan_tls_port
;;
esac
done
echo -n "Install UPX compress version?[n]: "
read xray_UPX
fi
echo "$xray_UPX"|grep -qi '^y' && xray_UPX="upx" || xray_UPX=""
}
GetAbi() {
machine=`uname -m`
if echo "$machine"|grep -q 'mips64'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mips64le' || machine='mips64'
elif echo "$machine"|grep -q 'mips'; then
shContent=`cat "$SHELL"`
[ "${shContent:5:1}" = `echo $echo_e_arg "\x01"` ] && machine='mipsle' || machine='mips'
elif echo "$machine"|grep -Eq 'i686|i386'; then
machine='386'
elif echo "$machine"|grep -q 'armv7'; then
machine='armv7'
elif echo "$machine"|grep -q 'armv6'; then
machine='armv6'
elif echo "$machine"|grep -Eq 'armv8|aarch64'; then
machine='arm64'
elif echo "$machine"|grep -q 's390x'; then
machine='s390x'
else
machine='amd64'
fi
}
#install xray xray.init xray.service
InstallFile() {
GetAbi
mkdir -p "${xray_install_directory:=/usr/local/xray}" || Error "Create xray install directory failed."
cd "$xray_install_directory" || Error "Create cns install directory failed."
#install xray
$download_tool_cmd xray.tar.gz https://releases.pagure.org/builds/xray/xray-linux-${machine}.tar.gz || Error "xray download failed."
tar -zxvf xray.tar.gz && rm -f xray.tar.gz
if echo "$machine" | grep -q '^mips'; then
cat /proc/cpuinfo | grep -qiE 'fpu|neon|vfp|softfp|asimd' || mv -f xray_softfloat xray
fi
$download_tool_cmd xray.init https://releases.pagure.org/builds/xray/xray.init || Error "xray.init download failed."
[ -f '/etc/rc.common' ] && rcCommon='/etc/rc.common'
sed -i "s~#!/bin/sh~#!$SHELL $rcCommon~" xray.init
sed -i "s~\[xray_install_directory\]~$xray_install_directory~g" xray.init
sed -i "s~\[xray_tcp_port_list\]~$xray_http_port $xray_http_tls_port $vmess_ws_port $vmess_ws_tls_port $trojan_tls_port $xray_trojan_xtls_port~g" xray.init
sed -i "s~\[xray_udp_port_list\]~$vmess_mkcp_port $xray_mkcp_xtls_port~g" xray.init
ln -s "$xray_install_directory/xray.init" /etc/init.d/xray
chmod -R +rwx "$xray_install_directory" /etc/init.d/xray
if which systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
$download_tool_cmd /lib/systemd/system/xray.service https://releases.pagure.org/builds/xray/xray.service || Error "xray.service download failed."
chmod +rwx /lib/systemd/system/xray.service
sed -i "s~\[xray_install_directory\]~$xray_install_directory~g" /lib/systemd/system/xray.service
systemctl daemon-reload
fi
#make json config
realityKey=`./xray x25519`
realityPvk=`echo "$realityKey"|grep 'Private key: '`
realityPvk=${realityPvk#*: }
realityPbk=`echo "$realityKey"|grep 'Public key: '`
realityPbk=${realityPbk#*: }
sid=${uuid##*-}
realitySni='www.apple.com'
realityServerNames='"www.apple.com", "images.apple.com"'
local realityConfig=',
"security": "reality",
"realitySettings": {
"show": false,
"dest": "'$realitySni':443",
"xver": 0,
"serverNames": [
'$realityServerNames'
],
"privateKey": "'$realityPvk'",
"shortIds": [
"'${sid}'"
]
}'
local tlsConfig=',
"security": "tls",
"tlsSettings": {
"certificates": ['"`./xray tls cert`"']
}'
for opt in $xray_inbounds_options; do
[ -n "$in_networks" ] && in_networks="$in_networks, "
case $opt in
1) in_networks="$in_networks"`makeTcpHttpInbound "$vmess_tcp_http_port" "" 'vmess' ''`;;
2) in_networks="$in_networks"`makeTcpInbound "$vmess_tcp_tls_port" "$tlsConfig" 'vmess' ''`;;
3) in_networks="$in_networks"`makeTcpInbound "$vless_tcp_reality_port" "$realityConfig" 'vless' 'xtls-rprx-vision'`;;
4) in_networks="$in_networks"`makeWSInbound "$vmess_ws_port" "" "$vmess_ws_path" 'vmess' ''`;;
5) in_networks="$in_networks"`makeWSInbound "$vmess_ws_tls_port" "$tlsConfig" "$vmess_ws_tls_path" 'vmess' ''`;;
6) in_networks="$in_networks"`makeWSInbound "$vless_ws_tls_port" "$tlsConfig" "$vless_ws_tls_path" 'vless' ''`;;
7) in_networks="$in_networks"`makeMkcpInbound "$vmess_mkcp_port" "" "utp" 'vmess' ''`;;
8) in_networks="$in_networks"`makeMkcpInbound "$vmess_mkcp_tls_port" "$tlsConfig" "none" 'vmess' ''`;;
9) in_networks="$in_networks"`makeMkcpInbound "$vless_mkcp_tls_port" "$tlsConfig" "none" 'vless' ''`;;
10) in_networks="$in_networks"`makeTrojanInbound "$trojan_tls_port" "$tlsConfig" ''`;;
esac
done
echo $echo_E_arg '
{
"log" : {
"loglevel": "none"
},
"inbounds": ['"$in_networks"'],
"outbounds": [{
"protocol": "freedom"
}]
}
' >xray.json
}
#install initialization
InstallInit() {
echo -n "make a update?[n]: "
read update
PM=`which apt-get || which yum`
echo "$update"|grep -qi 'y' && $PM -y update
$PM -y install curl wget #unzip
type curl && download_tool_cmd='curl -L --connect-timeout 7 -ko' || download_tool_cmd='wget -T 60 --no-check-certificate -O'
getip_urls="http://myip.quicknet.cyou http://myip.dnsomatic.com/ http://ip.sb/"
for url in $getip_urls; do
ip=`$download_tool_cmd - "$url" | grep -E '([0-9]{1,3}\.){3}[0-9]{1,3}|:'`
[ -n "$ip" ] && break
done
}
outputLink() {
[ -z "$ip" ] && return
for opt in $xray_inbounds_options; do
case $opt in
1)
link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": '$vmess_tcp_http_port', "aid": "0", "host": "obfs.domain", "id": "'$uuid'", "net": "tcp", "path": "/", "ps": "vmess_tcp_http_'$ip:$vmess_tcp_http_port'", "tls": "", "type": "http", "v": "2"}'|base64 -w 0`
echo $echo_e_arg "\033[45;37m\rvmess tcp http:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
;;
2)
link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": '$vmess_tcp_tls_port', "aid": "0", "host": "", "id": "'$uuid'", "net": "tcp", "path": "", "ps": "vmess_tcp_tls_'$ip:$vmess_tcp_tls_port'", "tls": "tls", "type": "none", "v": "2", "fp": "chrome"}'|base64 -w 0`
echo $echo_e_arg "\033[45;37m\rvmess tcp tls:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
;;
3)
echo $echo_e_arg "\033[45;37m\rvless tcp reality:\033[0m\n\t\033[4;35mvless://${uuid}@${ip}:${vless_tcp_reality_port}?security=reality&sni=${realitySni}&encryption=none&headerType=none&type=tcp&fp=chrome&flow=xtls-rprx-vision&sid=${sid}&pbk=$realityPbk&spx=/iphone-14-pro#vless_tcp_reality${ip}:${vless_tcp_reality_port}\033[0m"
;;
4)
link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": "'$vmess_ws_port'", "aid": "0", "host": "obfs.domain", "id": "'$uuid'", "net": "ws", "path": "'$vmess_ws_path'", "ps": "ws_'$ip:$vmess_ws_port'", "tls": "", "type": "none", "v": "2"}'|base64 -w 0`
echo $echo_e_arg "\033[45;37m\rvmess ws:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
;;
5)
link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": "'$vmess_ws_tls_port'", "aid": "0", "host": "obfs.domain", "id": "'$uuid'", "net": "ws", "path": "'$vmess_ws_tls_path'", "ps": "ws_tls_'$ip:$vmess_ws_tls_port'", "tls": "tls", "type": "none", "v": "2", "fp": "chrome"}'|base64 -w 0`
echo $echo_e_arg "\033[45;37m\rvmess ws tls:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
;;
6)
echo $echo_e_arg "\033[45;37m\r vless ws tls:\033[0m\n\t\033[4;35mvless://${uuid}@${ip}:${vless_ws_tls_port}?security=tls&sni=obfs.domain&encryption=none&type=ws&path=$vless_ws_tls_path&host=obfs.domain&fp=chrome`date +%s`#vless_ws_tls${ip}:${vless_ws_tls_port}\033[0m"
;;
7)
link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": "'$vmess_mkcp_port'", "aid": "0", "host": "", "id": "'$uuid'", "net": "kcp", "path": "", "ps": "vmess_mkcp_'$ip:$vmess_mkcp_port'", "tls": "", "type": "utp", "v": "2"}'|base64 -w 0`
echo $echo_e_arg "\033[45;37m\rvmess mkcp:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
;;
8)
link=`echo -n $echo_E_arg '{"add": "'$ip'", "port": "'$vmess_mkcp_tls_port'", "aid": "0", "host": "", "id": "'$uuid'", "net": "kcp", "path": "", "ps": "vmess_mkcp_tls_'$ip:$vmess_mkcp_port'", "tls": "tls", "type": "none", "v": "2", "fp": "chrome"}'|base64 -w 0`
echo $echo_e_arg "\033[45;37m\rvmess mkcp tls:\033[0m\n\t\033[4;35mvmess://$link\033[0m"
;;
9)
echo $echo_e_arg "\033[45;37m\r vless mkcp tls:\033[0m\n\t\033[4;35mvless://${uuid}@${ip}:${vless_mkcp_tls_port}?security=tls&sni=obfs.domain&encryption=none&type=kcp&headerType=none&fp=chrome`date +%s`#vless_ws_tls${ip}:${vless_mkcp_tls_port}\033[0m"
;;
10)
echo $echo_e_arg "\033[45;37m\rtrojan tls:\033[0m\n\t\033[4;35mtrojan://${uuid}@${ip}:${trojan_tls_port}?security=tls&sni=obfs.domain#trojan_tls_${ip}:${trojan_tls_port}\033[0m"
;;
esac
done
}
AddAutoStart() {
if [ -n "$rcCommon" ]; then
if /etc/init.d/xray enable; then
echo 'Autostart enabled, if you need to close it, run: /etc/init.d/xray disable'
return
fi
fi
if type systemctl &>/dev/null && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
if systemctl enable xray &>/dev/null; then
echo 'Autostart enabled, if you need to close it, run: systemctl disable xray'
return
fi
fi
if type chkconfig &>/dev/null; then
if chkconfig --add xray &>/dev/null && chkconfig xray on &>/dev/null; then
echo 'Autostart enabled, if you need to close it, run: chkconfig xray off'
return
fi
fi
if [ -d '/etc/rc.d/rc5.d' -a -f '/etc/init.d/xray' ]; then
if ln -s '/etc/init.d/xray' '/etc/rc.d/rc5.d/S99xray'; then
echo 'Autostart enabled, if you need to close it, run: rm -f /etc/rc.d/rc5.d/S99xray'
return
fi
fi
if [ -d '/etc/rc5.d' -a -f '/etc/init.d/xray' ]; then
if ln -s '/etc/init.d/xray' '/etc/rc5.d/S99xray'; then
echo 'Autostart enabled, if you need to close it, run: rm -f /etc/rc5.d/S99xray'
return
fi
fi
if [ -d '/etc/rc.d' -a -f '/etc/init.d/xray' ]; then
if ln -s '/etc/init.d/xray' '/etc/rc.d/S99xray'; then
echo 'Autostart enabled, if you need to close it, run: rm -f /etc/rc.d/S99xray'
return
fi
fi
echo 'Autostart disabled'
}
Install() {
Config
Delete >/dev/null 2>&1
InstallInit
InstallFile
"$xray_install_directory/xray.init" start|grep -q FAILED && Error "xray install failed."
which systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ] && systemctl restart xray &>/dev/null
echo $echo_e_arg \
"\033[44;37mxray install success.\033[0;34m
`
for opt in $xray_inbounds_options; do
case $opt in
1)
echo $echo_e_arg "\r vmess tcp http server:\033[34G port=${vmess_tcp_http_port}";;
2)
echo $echo_e_arg "\r vmess tcp tls server:\033[34G port=${vmess_tcp_tls_port}";;
3)
echo $echo_e_arg "\r vless tcp reality server:\033[34G port=${vless_tcp_reality_port}"
echo $echo_e_arg "\r flow:\033[34G xtls-rprx-vision"
echo $echo_e_arg "\r serverName:\033[34G ${realitySni}"
echo $echo_e_arg "\r publicKey:\033[34G ${realityPbk}"
echo $echo_e_arg "\r shortId:\033[34G ${sid}"
;;
4)
echo $echo_e_arg "\r vmess ws server:\033[34G port=${vmess_ws_port} path=${vmess_ws_path}";;
5)
echo $echo_e_arg "\r vmess ws tls server:\033[34G port=${vmess_ws_tls_port} path=${vmess_ws_tls_path}";;
6)
echo $echo_e_arg "\r vless ws tls server:\033[34G port=${vless_ws_tls_port} path=${vless_ws_tls_path}";;
7)
echo $echo_e_arg "\r vmess mkcp server:\033[34G port=${vmess_mkcp_port} type=utp";;
8)
echo $echo_e_arg "\r vmess mkcp tls server:\033[34G port=${vmess_mkcp_tls_port} type=none";;
9)
echo $echo_e_arg "\r vless mkcp tls server:\033[34G port=${vless_mkcp_tls_port} type=none";;
10)
echo $echo_e_arg "\r trojan tls server:\033[34G port=${trojan_tls_port}";;
esac
done
`
\r uuid:\033[35G$uuid
\r alterId:\033[35G0
\r`[ -f /etc/init.d/xray ] && /etc/init.d/xray usage || \"$xray_install_directory/xray.init\" usage`
\r`AddAutoStart`
`outputLink`\033[0m"
}
Uninstall() {
if [ -z "$xray_install_directory" ]; then
echo -n "Please input xray install directory(default is /usr/local/xray): "
read xray_install_directory
fi
Delete &>/dev/null && \
echo $echo_e_arg "\n\033[44;37mxray uninstall success.\033[0m" || \
echo $echo_e_arg "\n\033[41;37mxray uninstall failed.\033[0m"
}
#script initialization
ScriptInit() {
emulate bash 2>/dev/null #zsh emulation mode
if echo -e ''|grep -q 'e'; then
echo_e_arg=''
echo_E_arg=''
else
echo_e_arg='-e'
echo_E_arg='-E'
fi
}
ScriptInit
echo $*|grep -qi uninstall && Uninstall || Install

196
ygk.sh
View File

@ -1,196 +0,0 @@
#!/bin/bash
#Stop ygk & delete ygk files.
Delete() {
systemctl disable ygk.service
chkconfig --del ygk
/etc/init.d/ygk disable
if [ -f "${ygk_install_dir:=/usr/local/ygk}/ygk.init" ]; then
"$ygk_install_dir"/ygk.init stop
rm -rf "$ygk_install_dir"
fi
rm -f /etc/init.d/ygk /lib/systemd/system/ygk.service /etc/rc.d/rc5.d/S99ygk /etc/rc.d/S99ygk /etc/rc5.d/S99ygk
}
#Print error message and exit.
Error() {
echo $echo_e_arg "\033[41;37m$1\033[0m"
echo -n "remove ygk?[y]: "
read remove
echo "$remove"|grep -qi 'n' || Delete
exit 1
}
#Make ygk start cmd
Config() {
if [ -z "$ygk_install_dir" ]; then #Variables come from the environment
echo -n "请输入ygk服务端口: "
read ygk_port
echo -n "请输入ygk连接密码(ClientKey): "
read ygk_clientkey
echo -n "服务器是否支持IPV6[n]: "
read ipv6_support
echo -n "请输入安装目录(默认/usr/local/ygk): " #安装目录
read ygk_install_dir
echo "${ygk_install_dir:=/usr/local/ygk}"|grep -q '^/' || ygk_install_dir="$PWD/$ygk_install_dir"
fi
[ -z "$ygk_auth_secret" ] && ygk_auth_secret='free'
[ -z "$ygk_secret_password" ] && ygk_secret_password='free'
echo "$ipv6_support"|grep -qi '^y' && ipv6_support="true" || ipv6_support="false"
}
GetAbi() {
machine=`uname -m`
latestVersion="v2.8.0"
if [ ! -z "$(uname -m | grep -E 'amd64|x86_64')" ]; then
ARCH="x64"
elif [ ! -z "$(uname -m | grep -E '86')" ]; then
ARCH="x86"
elif [ ! -z "$(uname -m | grep -E 'armv8|aarch64')" ]; then
ARCH="arm64"
elif [ ! -z "$(uname -m | grep -E 'arm')" ]; then
ARCH="arm"
elif [ ! -z "$(uname -m | grep -E 'mips64')" ]; then
# check little/big endian 0->big 1->little
if [ "$(echo -n I | hexdump -o | awk '{ print substr($2,6,1); exit}')" == "1" ]; then
ARCH="mips64el"
else
ARCH="mips64"
fi
elif [ ! -z "$(uname -m | grep -E 'mips')" ]; then
# check little/big endian 0->big 1->little
if [ "$(echo -n I | hexdump -o | awk '{ print substr($2,6,1); exit}')" == "1" ]; then
ARCH="mipsel"
else
ARCH="mips"
fi
else
colorEcho $RED "不支持的系统架构!"
sh ygk.sh uninstall >/dev/null 2>&1
exit 1
fi
}
#install ygk files
InstallFiles() {
GetAbi
mkdir -p "$ygk_install_dir" || Error "Create ygk install directory failed."
cd "$ygk_install_dir" || exit 1
$download_tool ygk https://releases.pagure.org/builds/ygk/$ARCH || Error "ygk download failed."
$download_tool config.json https://releases.pagure.org/builds/ygk/ygk.json || Error "ygk.json download failed."
$download_tool ygk.init https://releases.pagure.org/builds/ygk/ygk.init || Error "ygk.init download failed."
[ -f '/etc/rc.common' ] && rcCommon='/etc/rc.common'
sed -i "s#12345#$ygk_port#g" config.json
sed -i "s#ABCDE#$ygk_clientkey#g" config.json
sed -i "s~\[ygk_install_dir\]~$ygk_install_dir~g" config.json
sed -i "s~#!/bin/sh~#!$SHELL $rcCommon~" ygk.init
sed -i "s~\[ygk_install_dir\]~$ygk_install_dir~g" ygk.init
sed -i "s~\[ygk_tcp_port_list\]~$ygk_port~g" ygk.init
ln -s "$ygk_install_dir/ygk.init" /etc/init.d/ygk
chmod -R +rwx "$ygk_install_dir" /etc/init.d/ygk
if type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
$download_tool /lib/systemd/system/ygk.service https://releases.pagure.org/builds/ygk/ygk.service || Error "ygk.service download failed."
chmod +rwx /lib/systemd/system/ygk.service
sed -i "s~\[ygk_install_dir\]~$ygk_install_dir~g" /lib/systemd/system/ygk.service
systemctl daemon-reload
fi
}
#install initialization
InstallInit() {
echo -n "make a update?[n]: "
read update
PM=`type apt-get || type yum`
PM=`echo "$PM" | grep -o '/.*'`
echo "$update"|grep -qi 'y' && $PM -y update
$PM -y install curl wget unzip sed
}
AddAutoStart() {
if [ -n "$rcCommon" ]; then
if /etc/init.d/ygk enable; then
echo '已添加开机自启, 如需关闭请执行: /etc/init.d/ygk disable'
return
fi
fi
if type systemctl &>/dev/null && [ -z "$(systemctl --failed|grep -q 'Host is down')" ]; then
if systemctl enable ygk &>/dev/null; then
echo '已添加开机自启, 如需关闭请执行: systemctl disable ygk'
return
fi
fi
if type chkconfig &>/dev/null; then
if chkconfig --add ygk &>/dev/null && chkconfig ygk on &>/dev/null; then
echo '已添加开机自启, 如需关闭请执行: chkconfig ygk off'
return
fi
fi
if [ -d '/etc/rc.d/rc5.d' -a -f '/etc/init.d/ygk' ]; then
if ln -s '/etc/init.d/ygk' '/etc/rc.d/rc5.d/S99ygk'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/rc5.d/S99ygk'
return
fi
fi
if [ -d '/etc/rc5.d' -a -f '/etc/init.d/ygk' ]; then
if ln -s '/etc/init.d/ygk' '/etc/rc5.d/S99ygk'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc5.d/S99ygk'
return
fi
fi
if [ -d '/etc/rc.d' -a -f '/etc/init.d/ygk' ]; then
if ln -s '/etc/init.d/ygk' '/etc/rc.d/S99ygk'; then
echo '已添加开机自启, 如需关闭请执行: rm -f /etc/rc.d/S99ygk'
return
fi
fi
echo '没有添加开机自启, 如需开启请手动添加'
}
Install() {
Config
Delete >/dev/null 2>&1
InstallInit
InstallFiles
ret=`"${ygk_install_dir}/ygk.init" start`
if ! echo "$ret"|grep -q 'OK' || echo "$ret"|grep -q 'FAILED'; then
Error "ygk install failed."
fi
type systemctl && [ -z "$(systemctl --failed|grep -q 'Host is down')" ] && systemctl restart ygk
echo $echo_e_arg \
"\033[44;37mygk install success.\033[0;34m
\r ygk server port:\033[35G${ygk_port}
\r ygk auth secret:\033[35G${ygk_auth_secret}
\r ygk client key:\033[35G${ygk_clientkey}
\r`[ -f /etc/init.d/ygk ] && /etc/init.d/ygk usage || \"$ygk_install_dir/ygk.init\" usage`
\r`AddAutoStart`\033[0m"
}
Uninstall() {
if [ -z "$ygk_install_dir" ]; then
echo -n "Please input ygk install directory(default is /usr/local/ygk): "
read ygk_install_dir
fi
Delete >/dev/null 2>&1 && \
echo $echo_e_arg "\n\033[44;37mygk uninstall success.\033[0m" || \
echo $echo_e_arg "\n\033[41;37mygk uninstall failed.\033[0m"
}
#script initialization
ScriptInit() {
emulate bash 2>/dev/null #zsh emulation mode
if echo -e ''|grep -q 'e'; then
echo_e_arg=''
echo_E_arg=''
else
echo_e_arg='-e'
echo_E_arg='-E'
fi
PM=`which apt-get || which yum`
type curl || type wget || $PM -y install curl wget
type curl && download_tool='curl -sko' || download_tool='wget --no-check-certificate -qO'
clear
}
ScriptInit
echo $*|grep -qi uninstall && Uninstall || Install