1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- #!/bin/bash
- tls="$(cat ~/log-install.txt | grep -w "Vmess TLS" | cut -d: -f2|sed 's/ //g')"
- none="$(cat ~/log-install.txt | grep -w "Vmess None TLS" | cut -d: -f2|sed 's/ //g')"
- echo -e "======================================"
- echo -e ""
- echo -e " [1] Change Port Vmess TLS $tls"
- echo -e " [2] Change Port Vmess None TLS $none"
- echo -e " [x] Exit"
- echo -e "======================================"
- echo -e ""
- read -p " Select From Options [1-2 or x] : " prot
- echo -e ""
- case $prot in
- 1)
- read -p "New Port Vmess TLS: " tls1
- if [ -z $tls1 ]; then
- echo "Please Input Port"
- exit 0
- fi
- cek=$(netstat -nutlp | grep -w $tls1)
- if [[ -z $cek ]]; then
- sed -i "s/$tls/$tls1/g" /etc/v2ray/config.json
- sed -i "s/ - V2RAY Vmess TLS : $tls/ - V2RAY Vmess TLS : $tls1/g" /root/log-install.txt
- iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $tls -j ACCEPT
- iptables -D INPUT -m state --state NEW -m udp -p udp --dport $tls -j ACCEPT
- iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $tls1 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m udp -p udp --dport $tls1 -j ACCEPT
- iptables-save > /etc/iptables.up.rules
- iptables-restore -t < /etc/iptables.up.rules
- netfilter-persistent save > /dev/null
- netfilter-persistent reload > /dev/null
- systemctl restart v2ray > /dev/null
- echo -e "\e[032;1mPort $tls1 modified successfully\e[0m"
- else
- echo "Port $tls1 is used"
- fi
- ;;
- 2)
- echo "Input Only 2 Character (eg : 69)"
- read -p "New Port Vmess None TLS: " none1
- if [ -z $none1 ]; then
- echo "Please Input Port"
- exit 0
- fi
- cek=$(netstat -nutlp | grep -w $none1)
- if [[ -z $cek ]]; then
- sed -i "s/$none/$none1/g" /etc/v2ray/none.json
- sed -i "s/ - V2RAY Vmess None TLS : $none/ - V2RAY Vmess None TLS : $none1/g" /root/log-install.txt
- iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $none -j ACCEPT
- iptables -D INPUT -m state --state NEW -m udp -p udp --dport $none -j ACCEPT
- iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $none1 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m udp -p udp --dport $none1 -j ACCEPT
- iptables-save > /etc/iptables.up.rules
- iptables-restore -t < /etc/iptables.up.rules
- netfilter-persistent save > /dev/null
- netfilter-persistent reload > /dev/null
- systemctl restart v2ray@none > /dev/null
- echo -e "\e[032;1mPort $none1 modified successfully\e[0m"
- else
- echo "Port $none1 is used"
- fi
- ;;
- x)
- exit
- menu
- ;;
- *)
- echo "Please enter an correct number"
- ;;
- esac
|