├── README.md └── xy.sh /README.md: -------------------------------------------------------------------------------- 1 | # xray-fragment 2 | 3 | 4 | Install 5 | ``` 6 | bash <(curl -fsSL https://raw.githubusercontent.com/Ptechgithub/xray-fragment/main/xy.sh) 7 | ``` 8 | - [آموزش در کانال IR_Tech](https://youtu.be/77MWWP4PJsc) 9 | 10 | ![11](https://raw.githubusercontent.com/Ptechgithub/configs/main/media/11.jpg) 11 | 12 | ## برای ایرانسل از socks استفاده کنید و داخل برنامه ی NekoBox در بخش dns به جای 1.1.1.1 از cloudflare-dns.com استفاده کنید. 13 | ![12](https://raw.githubusercontent.com/Ptechgithub/configs/main/media/12.jpg) 14 | - دورزدن محدودیت YouTube و X(Twitter) و Google Play توسط Termux با Fragment xray. 15 | - با این اسکریپت روی Termux یک کانفیگ از نوع vless یا vmess میسازید. 16 | - پورت انتخابی بزرگتر از 1024 باشد 17 | - کانفیگ را در برنامه ی NekoBox کپی کنید. 18 | - مجدد اسکریپت را اجرا میکنید و Run Vpn را انتخاب می‌کنید. 19 | - طبق Gif زیر تنظیمات Dns و Exclude کردن Termux در برنامه ی Nekobox را انجام بدید. 20 | - حالا میتونید YouTube و X را بدون محدودیت نگاه کنید. 21 | - اگه خواستید که log رو در Termux خاموش کنید فایل config.json که در دایرکتوری xy-fragment قرار دارد را ویرایش کنید و ابتدای کد مقدار warning را به none تغییر بدید. 22 | 23 | - Download [Nekobox](https://github.com/MatsuriDayo/NekoBoxForAndroid/releases) دانلود 24 | 25 | ![neko](https://raw.githubusercontent.com/Ptechgithub/configs/main/media/neko.gif) 26 | -------------------------------------------------------------------------------- /xy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #colors 4 | red='\033[0;31m' 5 | green='\033[0;32m' 6 | yellow='\033[0;33m' 7 | blue='\033[0;34m' 8 | purple='\033[0;35m' 9 | cyan='\033[0;36m' 10 | rest='\033[0m' 11 | 12 | #check_dependencies 13 | check_dependencies() { 14 | local dependencies=("curl" "wget" "unzip" "openssl") 15 | 16 | for dep in "${dependencies[@]}"; do 17 | if ! dpkg -s "${dep}" &> /dev/null; then 18 | echo "${dep} is not installed. Installing..." 19 | pkg install "${dep}" -y 20 | fi 21 | done 22 | } 23 | 24 | #Download Xray Core 25 | download-xray() { 26 | if [ ! -f "xy-fragment/xray" ]; then 27 | pkg update -y 28 | check_dependencies 29 | mkdir xy-fragment && cd xy-fragment 30 | wget https://github.com/XTLS/Xray-core/releases/download/v1.8.8/Xray-android-arm64-v8a.zip 31 | unzip Xray-android-arm64-v8a.zip 32 | rm Xray-android-arm64-v8a.zip 33 | chmod +x xray 34 | echo "Xray installed successfully." 35 | else 36 | echo "Xray is already installed." 37 | fi 38 | } 39 | 40 | #config vless 41 | config-vless() { 42 | cat << EOL > ~/xy-fragment/config.json 43 | { 44 | "log": { 45 | "loglevel": "warning" 46 | }, 47 | "inbounds": [ 48 | { 49 | "listen": "0.0.0.0", 50 | "port": $port, 51 | "protocol": "vless", 52 | "settings": { 53 | "clients": [ 54 | { 55 | "id": "$uuid", 56 | "level": 0 57 | } 58 | ], 59 | "decryption": "none", 60 | "fallbacks": [ 61 | { 62 | "dest": 8080 63 | } 64 | ] 65 | }, 66 | "streamSettings": { 67 | "network": "tcp" 68 | } 69 | } 70 | ], 71 | "outbounds": [ 72 | { 73 | "protocol": "freedom", 74 | "tag": "direct", 75 | "settings": { 76 | "domainStrategy": "AsIs", 77 | "fragment": { 78 | "packets": "tlshello", 79 | "length": "100-200", 80 | "interval": "10-20" 81 | } 82 | } 83 | } 84 | ] 85 | } 86 | EOL 87 | } 88 | 89 | #Create Config 90 | config-vmess() { 91 | cat << EOL > ~/xy-fragment/config.json 92 | { 93 | "log": { 94 | "loglevel": "warning" 95 | }, 96 | "routing": { 97 | "domainStrategy": "AsIs", 98 | "rules": [ 99 | { 100 | "type": "field", 101 | "ip": [ 102 | "geoip:private" 103 | ], 104 | "outboundTag": "block" 105 | } 106 | ] 107 | }, 108 | "inbounds": [ 109 | { 110 | "listen": "0.0.0.0", 111 | "port": $port, 112 | "protocol": "vmess", 113 | "settings": { 114 | "clients": [ 115 | { 116 | "id": "$uuid" 117 | } 118 | ] 119 | }, 120 | "streamSettings": { 121 | "network": "ws", 122 | "security": "none" 123 | } 124 | } 125 | ], 126 | "outbounds": [ 127 | { 128 | "protocol": "freedom", 129 | "tag": "direct", 130 | "settings": { 131 | "domainStrategy": "AsIs", 132 | "fragment": { 133 | "packets": "tlshello", 134 | "length": "100-200", 135 | "interval": "10-20" 136 | } 137 | } 138 | }, 139 | { 140 | "protocol": "blackhole", 141 | "tag": "block" 142 | } 143 | ] 144 | } 145 | EOL 146 | } 147 | 148 | config-socks() { 149 | cat << EOL > ~/xy-fragment/config.json 150 | { 151 | "log": { 152 | "loglevel": "warning" 153 | }, 154 | "dns": { 155 | "tag": "dns", 156 | "hosts": { 157 | "cloudflare-dns.com": [ 158 | "104.16.248.249", 159 | "104.16.249.249" 160 | ], 161 | "domain:youtube.com": [ 162 | "google.com" 163 | ], 164 | "domain:x.com": [ 165 | "google.com" 166 | ] 167 | }, 168 | "servers": [ 169 | "https://cloudflare-dns.com/dns-query" 170 | ] 171 | }, 172 | "inbounds": [ 173 | { 174 | "domainOverride": [ 175 | "http", 176 | "tls" 177 | ], 178 | "protocol": "socks", 179 | "tag": "socks-in", 180 | "listen": "127.0.0.1", 181 | "port": $port, 182 | "settings": { 183 | "auth": "noauth", 184 | "udp": true, 185 | "userLevel": 8 186 | }, 187 | "sniffing": { 188 | "enabled": true, 189 | "destOverride": [ 190 | "http", 191 | "tls" 192 | ] 193 | } 194 | } 195 | ], 196 | "outbounds": [ 197 | { 198 | "protocol": "freedom", 199 | "tag": "fragment-out", 200 | "domainStrategy": "UseIP", 201 | "sniffing": { 202 | "enabled": true, 203 | "destOverride": [ 204 | "http", 205 | "tls" 206 | ] 207 | }, 208 | "settings": { 209 | "fragment": { 210 | "packets": "tlshello", 211 | "length": "100-200", 212 | "interval": "10-20" 213 | } 214 | }, 215 | "streamSettings": { 216 | "sockopt": { 217 | "tcpNoDelay": true, 218 | "domainStrategy": "UseIP" 219 | } 220 | } 221 | }, 222 | { 223 | "protocol": "dns", 224 | "tag": "dns-out" 225 | }, 226 | { 227 | "protocol": "vless", 228 | "tag": "fakeproxy-out", 229 | "domainStrategy": "", 230 | "settings": { 231 | "vnext": [ 232 | { 233 | "address": "google.com", 234 | "port": 443, 235 | "users": [ 236 | { 237 | "encryption": "none", 238 | "level": 8, 239 | "id": "UUID", 240 | "security": "auto" 241 | } 242 | ] 243 | } 244 | ] 245 | }, 246 | "streamSettings": { 247 | "network": "ws", 248 | "security": "tls", 249 | "tlsSettings": { 250 | "allowInsecure": false, 251 | "alpn": [ 252 | "h2", 253 | "http/1.1" 254 | ], 255 | "fingerprint": "randomized", 256 | "publicKey": "", 257 | "serverName": "google.com", 258 | "shortId": "", 259 | "show": false, 260 | "spiderX": "" 261 | }, 262 | "wsSettings": { 263 | "headers": { 264 | "Host": "google.com" 265 | }, 266 | "path": "/" 267 | } 268 | } 269 | } 270 | ], 271 | "policy": { 272 | "levels": { 273 | "8": { 274 | "connIdle": 300, 275 | "downlinkOnly": 1, 276 | "handshake": 4, 277 | "uplinkOnly": 1 278 | } 279 | }, 280 | "system": { 281 | "statsOutboundUplink": true, 282 | "statsOutboundDownlink": true 283 | } 284 | }, 285 | "routing": { 286 | "domainStrategy": "IPIfNonMatch", 287 | "rules": [ 288 | { 289 | "inboundTag": [ 290 | "socks-in" 291 | ], 292 | "type": "field", 293 | "port": "8443", 294 | "outboundTag": "dns-out", 295 | "enabled": true 296 | }, 297 | { 298 | "inboundTag": [ 299 | "socks-in" 300 | ], 301 | "type": "field", 302 | "port": "0-65535", 303 | "outboundTag": "fragment-out", 304 | "enabled": true 305 | } 306 | ], 307 | "strategy": "rules" 308 | }, 309 | "stats": {} 310 | } 311 | EOL 312 | } 313 | 314 | #Install 315 | install() { 316 | download-xray 317 | clear 318 | uuid=$(~/xy-fragment/xray uuid) 319 | 320 | echo -e "${purple}Select a Config: ${rest}" 321 | echo -e "${green}1) socks${rest}" 322 | echo -e "${green}2) vmess${rest}" 323 | echo -e "${green}3) vless${rest}" 324 | echo -e "${yellow}select socks for Irancell${rest}" 325 | read -p "Enter the number of Config [1/2/3]. Default: 2 : " choice 326 | 327 | case $choice in 328 | 1) config="socks";; 329 | 3) config="vless";; 330 | *) config="vmess";; 331 | esac 332 | 333 | read -p "Enter a Port between [1024 - 65535]: " port 334 | config=${config:-"vmess"} 335 | 336 | if [ "$config" == "vless" ]; then 337 | config-vless 338 | echo -e "${blue}--------------------------------------${rest}" 339 | vless_url="vless://$uuid@127.0.0.1:$port/?type=tcp&encryption=none#Peyman%20YouTube%20%26%20X" 340 | echo -e "${yellow}$vless_url${rest}" 341 | echo -e "${blue}--------------------------------------${rest}" 342 | echo -e "${green}Copy the config and go back to the main Menu${rest}" 343 | echo -e "${green}and select Run VPN [ Exclude Termux in Your Client [Nekobox] ${rest}" 344 | echo "$vless_url" > ~/xy-fragment/vless-tcp.txt 345 | 346 | elif [ "$config" == "socks" ]; then 347 | config-socks 348 | socks="socks5://127.0.0.1:$port/#Peyman%20YouTube%20%26%20X" 349 | echo -e "${blue}--------------------------------------${rest}" 350 | echo -e "${yellow}$socks${rest}" 351 | echo -e "${blue}--------------------------------------${rest}" 352 | echo "" 353 | echo -e "${purple}Use this DNS --> https://cloudflare-dns.com/dns-query${rest}" 354 | echo -e "${green}Copy the config and go back to the main Menu${rest}" 355 | echo -e "${green}and select Run VPN [ Exclude Termux in Your Client [Nekobox] ${rest}" 356 | echo "$socks" > ~/xy-fragment/socks.txt 357 | 358 | else 359 | config-vmess 360 | vmess="{\"add\":\"127.0.0.1\",\"aid\":\"0\",\"alpn\":\"\",\"fp\":\"\",\"host\":\"\",\"id\":\"$uuid\",\"net\":\"ws\",\"path\":\"\",\"port\":\"$port\",\"ps\":\"Peyman YouTube & X\",\"scy\":\"auto\",\"sni\":\"\",\"tls\":\"\",\"type\":\"\",\"v\":\"2\"}" 361 | encoded_vmess=$(echo -n "$vmess" | base64 -w 0) 362 | 363 | echo -e "${blue}--------------------------------------${rest}" 364 | echo -e "${yellow}vmess://$encoded_vmess${rest}" 365 | echo -e "${blue}--------------------------------------${rest}" 366 | echo "" 367 | echo -e "${green}Copy the config and go back to the main Menu${rest}" 368 | echo -e "${green}and select Run VPN [ Exclude Termux in Your Client [Nekobox] ${rest}" 369 | echo "vmess://$encoded_vmess" > ~/xy-fragment/vmess-ws.txt 370 | fi 371 | } 372 | 373 | #Uninstall 374 | uninstall() { 375 | directory="/data/data/com.termux/files/home/xy-fragment" 376 | if [ -d "$directory" ]; then 377 | rm -r "$directory" 378 | echo -e "${red}Uninstallation completed.${rest}" 379 | else 380 | echo -e "${red}Please Install First.${rest}" 381 | fi 382 | } 383 | 384 | #run 385 | run() { 386 | clear 387 | cd ~ 388 | xray_directory="xy-fragment" 389 | config_file="config.json" 390 | xray_executable="xray" 391 | 392 | if [ -f "$xray_directory/$config_file" ] && [ -f "$xray_directory/$xray_executable" ]; then 393 | clear 394 | echo -e "${green}Starting...${rest}" 395 | cd "$xray_directory" && ./xray run "$config_file" 396 | else 397 | echo -e "${red}Error: The file '$config_file' or '$xray_executable' doesn't exist in the directory: '$xray_directory'.${rest}" 398 | echo -e "${red}Please Get Your Config First. or Reinstall.${rest}" 399 | fi 400 | } 401 | 402 | 403 | #menu 404 | clear 405 | echo -e "${green}By --> Peyman * Github.com/Ptechgithub * ${rest}" 406 | echo "" 407 | echo -e "${cyan}---Bypass Filtering -- Xray Fragment---${rest}" 408 | echo "" 409 | echo -e "${yellow}Select an option:${rest}" 410 | echo -e "${purple}1)${rest} ${green}Get Your Config${rest}" 411 | echo -e "${purple}2)${rest} ${green}Run VPN${rest}" 412 | echo -e "${purple}3)${rest} ${green}Uninstall${rest}" 413 | echo -e "${red}0)${rest} ${green}Exit${rest}" 414 | read -p "Enter your choice: " choice 415 | 416 | case "$choice" in 417 | 1) 418 | install 419 | ;; 420 | 2) 421 | run 422 | ;; 423 | 3) 424 | uninstall 425 | ;; 426 | 0) 427 | exit 428 | ;; 429 | *) 430 | echo "Invalid choice. Please select a valid option." 431 | ;; 432 | esac 433 | --------------------------------------------------------------------------------