12345678910111213141516171819202122232425262728293031323334 |
- #!/bin/bash
- red='\e[1;31m'
- green='\e[0;32m'
- NC='\e[0m'
- MYIP=$(wget -qO- ifconfig.me/ip);
- echo "Checking VPS"
- clear
- tr="$(cat ~/log-install.txt | grep -w "Trojan GO" | cut -d: -f2|sed 's/ //g')"
- echo -e "Name : Change Port Trojan GO"
- echo -e "============================" | lolcat
- echo -e "Change Port $tr"
- read -p "New Port Trojan-go: " tr2
- if [ -z $tr2 ]; then
- echo "Please Input Port"
- exit 0
- fi
- cek=$(netstat -nutlp | grep -w $tr2)
- if [[ -z $cek ]]; then
- sed -i "s/$tr/$tr2/g" /etc/trojan-go/config.json
- sed -i "s/ - Trojan GO : $tr/ - Trojan GO : $tr2/g" /root/log-install.txt
- iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $tr -j ACCEPT
- iptables -D INPUT -m state --state NEW -m udp -p udp --dport $tr -j ACCEPT
- iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $tr2 -j ACCEPT
- iptables -I INPUT -m state --state NEW -m udp -p udp --dport $tr2 -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 trojan-go > /dev/null
- echo -e "\e[032;1mPort $tr2 modified successfully\e[0m"
- else
- echo "Port $tr2 is used"
- fi
|