feat(脚本): xray-core reality增加防止流量盗刷配置

This commit is contained in:
mack-a
2025-11-21 12:06:31 +08:00
parent c5bad68044
commit 1ca7059c46
+83 -74
View File
@@ -509,17 +509,17 @@ readInstallProtocolType() {
if echo "${row}" | grep -q VLESS_vision_reality_inbounds; then if echo "${row}" | grep -q VLESS_vision_reality_inbounds; then
currentInstallProtocolType="${currentInstallProtocolType}7," currentInstallProtocolType="${currentInstallProtocolType}7,"
if [[ "${coreInstallType}" == "1" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
xrayVLESSRealityServerName=$(jq -r .inbounds[0].streamSettings.realitySettings.serverNames[0] "${row}.json") xrayVLESSRealityServerName=$(jq -r .inbounds[1].streamSettings.realitySettings.serverNames[0] "${row}.json")
realityServerName=${xrayVLESSRealityServerName} realityServerName=${xrayVLESSRealityServerName}
xrayVLESSRealityPort=$(jq -r .inbounds[0].port "${row}.json") xrayVLESSRealityPort=$(jq -r .inbounds[0].port "${row}.json")
realityDomainPort=$(jq -r .inbounds[0].streamSettings.realitySettings.dest "${row}.json" | awk -F '[:]' '{print $2}') realityDomainPort=$(jq -r .inbounds[1].streamSettings.realitySettings.target "${row}.json" | awk -F '[:]' '{print $2}')
currentRealityPublicKey=$(jq -r .inbounds[0].streamSettings.realitySettings.publicKey "${row}.json") currentRealityPublicKey=$(jq -r .inbounds[1].streamSettings.realitySettings.publicKey "${row}.json")
currentRealityPrivateKey=$(jq -r .inbounds[0].streamSettings.realitySettings.privateKey "${row}.json") currentRealityPrivateKey=$(jq -r .inbounds[1].streamSettings.realitySettings.privateKey "${row}.json")
currentRealityMldsa65Seed=$(jq -r .inbounds[0].streamSettings.realitySettings.mldsa65Seed "${row}.json") currentRealityMldsa65Seed=$(jq -r .inbounds[1].streamSettings.realitySettings.mldsa65Seed "${row}.json")
currentRealityMldsa65Verify=$(jq -r .inbounds[0].streamSettings.realitySettings.mldsa65Verify "${row}.json") currentRealityMldsa65Verify=$(jq -r .inbounds[1].streamSettings.realitySettings.mldsa65Verify "${row}.json")
frontingTypeReality=07_VLESS_vision_reality_inbounds frontingTypeReality=07_VLESS_vision_reality_inbounds
@@ -3990,7 +3990,7 @@ EOF
"security": "reality", "security": "reality",
"realitySettings": { "realitySettings": {
"show": false, "show": false,
"dest": "${realityServerName}:${realityDomainPort}", "target": "${realityServerName}:${realityDomainPort}",
"xver": 0, "xver": 0,
"serverNames": [ "serverNames": [
"${realityServerName}" "${realityServerName}"
@@ -4016,42 +4016,6 @@ EOF
elif [[ -z "$3" ]]; then elif [[ -z "$3" ]]; then
rm /etc/v2ray-agent/xray/conf/12_VLESS_XHTTP_inbounds.json >/dev/null 2>&1 rm /etc/v2ray-agent/xray/conf/12_VLESS_XHTTP_inbounds.json >/dev/null 2>&1
fi fi
# trojan_grpc
# if echo "${selectCustomInstallType}" | grep -q ",2," || [[ "$1" == "all" ]]; then
# if ! echo "${selectCustomInstallType}" | grep -q ",5," && [[ -n ${selectCustomInstallType} ]]; then
# fallbacksList=${fallbacksList//31302/31304}
# fi
# cat <<EOF >/etc/v2ray-agent/xray/conf/04_trojan_gRPC_inbounds.json
#{
# "inbounds": [
# {
# "port": 31304,
# "listen": "127.0.0.1",
# "protocol": "trojan",
# "tag": "trojangRPCTCP",
# "settings": {
# "clients": $(initXrayClients 2),
# "fallbacks": [
# {
# "dest": "31300"
# }
# ]
# },
# "streamSettings": {
# "network": "grpc",
# "grpcSettings": {
# "serviceName": "${customPath}trojangrpc"
# }
# }
# }
# ]
#}
#EOF
# elif [[ -z "$3" ]]; then
# rm /etc/v2ray-agent/xray/conf/04_trojan_gRPC_inbounds.json >/dev/null 2>&1
# fi
# VMess_WS
if echo "${selectCustomInstallType}" | grep -q ",3," || [[ "$1" == "all" ]]; then if echo "${selectCustomInstallType}" | grep -q ",3," || [[ "$1" == "all" ]]; then
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'vws","dest":31299,"xver":1}' fallbacksList=${fallbacksList}',{"path":"/'${customPath}'vws","dest":31299,"xver":1}'
cat <<EOF >/etc/v2ray-agent/xray/conf/05_VMess_WS_inbounds.json cat <<EOF >/etc/v2ray-agent/xray/conf/05_VMess_WS_inbounds.json
@@ -4157,50 +4121,93 @@ EOF
initRealityClientServersName initRealityClientServersName
initRealityKey initRealityKey
initRealityMldsa65 initRealityMldsa65
cat <<EOF >/etc/v2ray-agent/xray/conf/07_VLESS_vision_reality_inbounds.json cat <<EOF >/etc/v2ray-agent/xray/conf/07_VLESS_vision_reality_inbounds.json
{ {
"inbounds": [ "inbounds": [
{ {
"tag": "dokodemo-in-VLESSReality",
"port": ${realityPort}, "port": ${realityPort},
"protocol": "dokodemo-door",
"settings": {
"address": "127.0.0.1",
"port": 45987,
"network": "tcp"
},
"sniffing": {
"enabled": true,
"destOverride": [
"tls"
],
"routeOnly": true
}
},
{
"listen": "127.0.0.1",
"port": 45987,
"protocol": "vless", "protocol": "vless",
"tag": "VLESSReality",
"settings": { "settings": {
"clients": $(initXrayClients 7), "clients": $(initXrayClients 7),
"decryption": "none", "decryption": "none",
"fallbacks":[ "fallbacks":[
{ {
"dest": "31305", "dest": "31305",
"xver": 1 "xver": 1
} }
] ]
}, },
"streamSettings": { "streamSettings": {
"network": "tcp", "network": "tcp",
"security": "reality", "security": "reality",
"realitySettings": { "realitySettings": {
"show": false, "show": false,
"dest": "${realityServerName}:${realityDomainPort}", "target": "${realityServerName}:${realityDomainPort}",
"xver": 0, "xver": 0,
"serverNames": [ "serverNames": [
"${realityServerName}" "${realityServerName}"
], ],
"privateKey": "${realityPrivateKey}", "privateKey": "${realityPrivateKey}",
"publicKey": "${realityPublicKey}", "publicKey": "${realityPublicKey}",
"mldsa65Seed": "${realityMldsa65Seed}", "mldsa65Seed": "${realityMldsa65Seed}",
"mldsa65Verify": "${realityMldsa65Verify}", "mldsa65Verify": "${realityMldsa65Verify}",
"maxTimeDiff": 70000, "maxTimeDiff": 70000,
"shortIds": [ "shortIds": [
"", "",
"6ba85179e30d4fc2" "6ba85179e30d4fc2"
] ]
} }
},
"sniffing": {
"enabled": true,
"destOverride": [
"http",
"tls",
"quic"
],
"routeOnly": true
} }
} }
] ],
"routing": {
"rules": [
{
"inboundTag": [
"dokodemo-in"
],
"domain": [
"${realityServerName}"
],
"outboundTag": "z_direct_outbound"
},
{
"inboundTag": [
"dokodemo-in"
],
"outboundTag": "blackhole_out"
}
]
}
} }
EOF EOF
cat <<EOF >/etc/v2ray-agent/xray/conf/08_VLESS_vision_gRPC_inbounds.json cat <<EOF >/etc/v2ray-agent/xray/conf/08_VLESS_vision_gRPC_inbounds.json
{ {
"inbounds": [ "inbounds": [
@@ -4244,6 +4251,7 @@ EOF
removeXrayOutbound wireguard_out_IPv6 removeXrayOutbound wireguard_out_IPv6
removeXrayOutbound wireguard_out_IPv4 removeXrayOutbound wireguard_out_IPv4
addXrayOutbound z_direct_outbound addXrayOutbound z_direct_outbound
addXrayOutbound blackhole_out
fi fi
} }
@@ -5344,7 +5352,7 @@ showAccounts() {
# VLESS reality vision # VLESS reality vision
if echo ${currentInstallProtocolType} | grep -q ",7,"; then if echo ${currentInstallProtocolType} | grep -q ",7,"; then
echoContent skyBlue "============================= VLESS reality_vision [推荐] ==============================\n" echoContent skyBlue "============================= VLESS reality_vision [推荐] ==============================\n"
jq .inbounds[0].settings.clients//.inbounds[0].users ${configPath}07_VLESS_vision_reality_inbounds.json | jq -c '.[]' | while read -r user; do jq .inbounds[1].settings.clients//.inbounds[0].users ${configPath}07_VLESS_vision_reality_inbounds.json | jq -c '.[]' | while read -r user; do
local email= local email=
email=$(echo "${user}" | jq -r .email//.name) email=$(echo "${user}" | jq -r .email//.name)
@@ -6392,7 +6400,7 @@ ipv6Routing() {
read -r -p "请按照上面示例录入域名:" domainList read -r -p "请按照上面示例录入域名:" domainList
if [[ "${coreInstallType}" == "1" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
addInstallRouting IPv6_out outboundTag "${domainList}" addXrayRouting IPv6_out outboundTag "${domainList}"
addXrayOutbound IPv6_out addXrayOutbound IPv6_out
fi fi
@@ -6603,7 +6611,7 @@ blacklist() {
echoContent yellow "5.添加规则为增量配置,不会删除之前设置的内容\n" echoContent yellow "5.添加规则为增量配置,不会删除之前设置的内容\n"
read -r -p "请按照上面示例录入域名:" domainList read -r -p "请按照上面示例录入域名:" domainList
if [[ "${coreInstallType}" == "1" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
addInstallRouting blackhole_out outboundTag "${domainList}" addXrayRouting blackhole_out outboundTag "${domainList}"
addXrayOutbound blackhole_out addXrayOutbound blackhole_out
fi fi
@@ -6619,7 +6627,7 @@ blacklist() {
if [[ "${coreInstallType}" == "1" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
unInstallRouting blackhole_out outboundTag unInstallRouting blackhole_out outboundTag
addInstallRouting blackhole_out outboundTag "cn" addXrayRouting blackhole_out outboundTag "cn"
addXrayOutbound blackhole_out addXrayOutbound blackhole_out
fi fi
@@ -6658,7 +6666,7 @@ blacklist() {
reloadCore reloadCore
} }
# 添加routing配置 # 添加routing配置
addInstallRouting() { addXrayRouting() {
local tag=$1 # warp-socks local tag=$1 # warp-socks
local type=$2 # outboundTag/inboundTag local type=$2 # outboundTag/inboundTag
@@ -6838,7 +6846,7 @@ addWireGuardRoute() {
# xray # xray
if [[ "${coreInstallType}" == "1" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
addInstallRouting "wireguard_out_${type}" "${tag}" "${domainList}" addXrayRouting "wireguard_out_${type}" "${tag}" "${domainList}"
addXrayOutbound "wireguard_out_${type}" addXrayOutbound "wireguard_out_${type}"
fi fi
# sing-box # sing-box
@@ -7602,7 +7610,7 @@ setVMessWSRoutingOutbounds() {
setVMessWSTLSPath="/${setVMessWSTLSPath}" setVMessWSTLSPath="/${setVMessWSTLSPath}"
fi fi
addXrayOutbound "VMess-out" addXrayOutbound "VMess-out"
addInstallRouting VMess-out outboundTag "${domainList}" addXrayRouting VMess-out outboundTag "${domainList}"
reloadCore reloadCore
echoContent green " ---> 添加分流成功" echoContent green " ---> 添加分流成功"
exit 0 exit 0
@@ -9504,7 +9512,7 @@ menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者:mack-a" echoContent green "作者:mack-a"
echoContent green "当前版本:v3.4.33" echoContent green "当前版本:v3.4.34"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c" echoContent green "描述:八合一共存脚本\c"
showInstallStatus showInstallStatus
@@ -9518,6 +9526,7 @@ menu() {
echoContent yellow "优质常驻套餐DMIT CN2-GIA" echoContent yellow "优质常驻套餐DMIT CN2-GIA"
echoContent green "https://www.v2ray-agent.com/archives/186cee7b-9459-4e57-b9b2-b07a4f36931c" echoContent green "https://www.v2ray-agent.com/archives/186cee7b-9459-4e57-b9b2-b07a4f36931c"
echoContent yellow "VPS探针:https://ping.v2ray-agent.com/" echoContent yellow "VPS探针:https://ping.v2ray-agent.com/"
echoContent red " "
echoContent red "==============================================================" echoContent red "=============================================================="
if [[ -n "${coreInstallType}" ]]; then if [[ -n "${coreInstallType}" ]]; then
echoContent yellow "1.重新安装" echoContent yellow "1.重新安装"