port-vless.sh 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. tls="$(cat ~/log-install.txt | grep -w "Vless TLS" | cut -d: -f2|sed 's/ //g')"
  3. none="$(cat ~/log-install.txt | grep -w "Vless None TLS" | cut -d: -f2|sed 's/ //g')"
  4. echo -e "======================================"
  5. echo -e ""
  6. echo -e " [1] Change Port Vless TLS $tls"
  7. echo -e " [2] Change Port Vless None TLS $none"
  8. echo -e " [x] Exit"
  9. echo -e "======================================"
  10. echo -e ""
  11. read -p " Select From Options [1-2 or x] : " prot
  12. echo -e ""
  13. case $prot in
  14. 1)
  15. read -p "New Port Vless TLS: " tls1
  16. if [ -z $tls1 ]; then
  17. echo "Please Input Port"
  18. exit 0
  19. fi
  20. cek=$(netstat -nutlp | grep -w $tls1)
  21. if [[ -z $cek ]]; then
  22. sed -i "s/$tls/$tls1/g" /etc/v2ray/vless.json
  23. sed -i "s/ - V2RAY Vless TLS : $tls/ - V2RAY Vless TLS : $tls1/g" /root/log-install.txt
  24. iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $tls -j ACCEPT
  25. iptables -D INPUT -m state --state NEW -m udp -p udp --dport $tls -j ACCEPT
  26. iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $tls1 -j ACCEPT
  27. iptables -I INPUT -m state --state NEW -m udp -p udp --dport $tls1 -j ACCEPT
  28. iptables-save > /etc/iptables.up.rules
  29. iptables-restore -t < /etc/iptables.up.rules
  30. netfilter-persistent save > /dev/null
  31. netfilter-persistent reload > /dev/null
  32. systemctl restart v2ray@vless > /dev/null
  33. echo -e "\e[032;1mPort $tls1 modified successfully\e[0m"
  34. else
  35. echo "Port $tls1 is used"
  36. fi
  37. ;;
  38. 2)
  39. read -p "New Port Vless None TLS: " none1
  40. if [ -z $none1 ]; then
  41. echo "Please Input Port"
  42. exit 0
  43. fi
  44. cek=$(netstat -nutlp | grep -w $none1)
  45. if [[ -z $cek ]]; then
  46. sed -i "s/$none/$none1/g" /etc/v2ray/vnone.json
  47. sed -i "s/ - V2RAY Vless None TLS : $none/ - V2RAY Vless None TLS : $none1/g" /root/log-install.txt
  48. iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $none -j ACCEPT
  49. iptables -D INPUT -m state --state NEW -m udp -p udp --dport $none -j ACCEPT
  50. iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $none1 -j ACCEPT
  51. iptables -I INPUT -m state --state NEW -m udp -p udp --dport $none1 -j ACCEPT
  52. iptables-save > /etc/iptables.up.rules
  53. iptables-restore -t < /etc/iptables.up.rules
  54. netfilter-persistent save > /dev/null
  55. netfilter-persistent reload > /dev/null
  56. systemctl restart v2ray@vnone > /dev/null
  57. echo -e "\e[032;1mPort $none1 modified successfully\e[0m"
  58. else
  59. echo "Port $none1 is used"
  60. fi
  61. ;;
  62. x)
  63. exit
  64. menu
  65. ;;
  66. *)
  67. echo "Please enter an correct number"
  68. ;;
  69. esac