mirror of
https://github.com/schroinerxy/Sing-box.git
synced 2026-06-22 04:35:49 +08:00
Update sb_00.sh
This commit is contained in:
@@ -13,8 +13,7 @@ reading() { read -p "$(red "$1")" "$2"; }
|
||||
export LC_ALL=C
|
||||
HOSTNAME=$(hostname)
|
||||
USERNAME=$(whoami | tr '[:upper:]' '[:lower:]')
|
||||
MD5_HASH=$(echo -n "$USERNAME" | md5sum | awk '{print $1}')
|
||||
export UUID=${UUID:-${MD5_HASH:0:8}-${MD5_HASH:8:4}-4${MD5_HASH:12:3}-$(echo $((RANDOM % 4 + 8)) | head -c 1)${MD5_HASH:15:3}-${MD5_HASH:19:12}}
|
||||
export UUID=${UUID:-$(uuidgen)}
|
||||
export NEZHA_SERVER=${NEZHA_SERVER:-''}
|
||||
export NEZHA_PORT=${NEZHA_PORT:-''}
|
||||
export NEZHA_KEY=${NEZHA_KEY:-''}
|
||||
@@ -26,9 +25,9 @@ export SUB_TOKEN=${SUB_TOKEN:-${UUID:0:8}}
|
||||
|
||||
[[ "$HOSTNAME" == "s1.ct8.pl" ]] && WORKDIR="${HOME}/domains/${USERNAME}.ct8.pl/logs" && FILE_PATH="${HOME}/domains/${USERNAME}.ct8.pl/public_html" || WORKDIR="${HOME}/domains/${USERNAME}.serv00.net/logs" && FILE_PATH="${HOME}/domains/${USERNAME}.serv00.net/public_html"
|
||||
rm -rf "$WORKDIR" && mkdir -p "$WORKDIR" "$FILE_PATH" && chmod 777 "$WORKDIR" "$FILE_PATH" >/dev/null 2>&1
|
||||
bash -c 'ps aux | grep $(whoami) | grep -v "sshd\|bash\|grep" | awk "{print \$2}" | xargs -r kill -9 >/dev/null 2>&1' >/dev/null 2>&1
|
||||
command -v curl &>/dev/null && COMMAND="curl -so" || command -v wget &>/dev/null && COMMAND="wget -qO" || { echo "Error: neither curl nor wget found, please install one of them." >&2; exit 1; }
|
||||
|
||||
check_binexec_and_port () {
|
||||
check_port () {
|
||||
port_list=$(devil port list)
|
||||
tcp_ports=$(echo "$port_list" | grep -c "tcp")
|
||||
udp_ports=$(echo "$port_list" | grep -c "udp")
|
||||
@@ -118,6 +117,8 @@ else
|
||||
green "php站点创建完成"
|
||||
fi
|
||||
fi
|
||||
index_url="https://github.com/eooce/Sing-box/releases/download/00/index.html"
|
||||
[ -f "${FILE_PATH}/index.html" ] || $COMMAND "${FILE_PATH}/index.html" "$index_url"
|
||||
}
|
||||
|
||||
argo_configure() {
|
||||
@@ -479,18 +480,30 @@ get_ip() {
|
||||
}
|
||||
|
||||
generate_sub_link () {
|
||||
echo ""
|
||||
cat > ${FILE_PATH}/.htaccess << EOF
|
||||
RewriteEngine On
|
||||
RewriteRule ^${SUB_TOKEN}$ sub.php [L]
|
||||
RewriteRule ^${SUB_TOKEN}$ ${SUB_TOKEN}.php [L]
|
||||
<FilesMatch "^(clash\.yaml|singbox\.yaml|list\.txt|v2\.log||sub\.php)$">
|
||||
Order Allow,Deny
|
||||
Deny from all
|
||||
</FilesMatch>
|
||||
<Files "${SUB_TOKEN}.php">
|
||||
Order Allow,Deny
|
||||
Allow from all
|
||||
</Files>
|
||||
EOF
|
||||
base64 -w0 ${FILE_PATH}/list.txt > ${FILE_PATH}/v2.log
|
||||
V2rayN_LINK="https://${USERNAME}.serv00.net/v2.log"
|
||||
PHP_URL="https://00.ssss.nyc.mn/sub.php"
|
||||
PHP_URL="https://00.ssss.nyc.mn/sub.php"
|
||||
QR_URL="https://00.ssss.nyc.mn/qrencode"
|
||||
$COMMAND "${FILE_PATH}/${SUB_TOKEN}.php" "$PHP_URL"
|
||||
$COMMAND "${WORKDIR}/qrencode" "$QR_URL" && chmod +x "${WORKDIR}/qrencode"
|
||||
curl -sS "https://sublink.eooce.com/clash?config=${V2rayN_LINK}" -o ${FILE_PATH}/clash.yaml
|
||||
curl -sS "https://sublink.eooce.com/singbox?config=${V2rayN_LINK}" -o ${FILE_PATH}/singbox.yaml
|
||||
command -v curl &> /dev/null && curl -s -o "${FILE_PATH}/sub.php" "$PHP_URL" || command -v wget &> /dev/null && wget -q -O "${FILE_PATH}/sub.php" "$PHP_URL" || red "Warning: Neither curl nor wget is installed. You can't use the subscription"
|
||||
purple "\n自适应节点订阅链接: https://${USERNAME}.serv00.net/${SUB_TOKEN}\n"
|
||||
green "节点订阅链接适用于 V2rayN/Nekoray/ShadowRocket/Clash/Mihomo/Sing-box/karing/Loon/sterisand 等\n"
|
||||
"${WORKDIR}/qrencode" -m 2 -t UTF8 "https://${USERNAME}.serv00.net/${SUB_TOKEN}"
|
||||
purple "\n自适应节点订阅链接: https://${USERNAME}.serv00.net/${SUB_TOKEN}\n"
|
||||
green "二维码和节点订阅链接适用于 V2rayN/Nekoray/ShadowRocket/Clash/Mihomo/Sing-box/karing/Loon/sterisand 等\n\n"
|
||||
}
|
||||
|
||||
get_links(){
|
||||
@@ -525,7 +538,7 @@ rm -rf boot.log config.json sb.log core tunnel.yml tunnel.json fake_useragent_0.
|
||||
install_singbox() {
|
||||
clear
|
||||
cd $WORKDIR
|
||||
check_binexec_and_port
|
||||
check_port
|
||||
check_website
|
||||
argo_configure
|
||||
generate_config
|
||||
|
||||
Reference in New Issue
Block a user