porttrojan.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. # SL
  3. # ==========================================
  4. # Color
  5. RED='\033[0;31m'
  6. NC='\033[0m'
  7. GREEN='\033[0;32m'
  8. ORANGE='\033[0;33m'
  9. BLUE='\033[0;34m'
  10. PURPLE='\033[0;35m'
  11. CYAN='\033[0;36m'
  12. LIGHT='\033[0;37m'
  13. # ==========================================
  14. # Getting
  15. MYIP=$(wget -qO- ipinfo.io/ip);
  16. echo "Checking VPS"
  17. IZIN=$( curl ipinfo.io/ip | grep $MYIP )
  18. if [ $MYIP = $MYIP ]; then
  19. echo -e "${NC}${GREEN}Permission Accepted...${NC}"
  20. else
  21. echo -e "${NC}${RED}Permission Denied!${NC}";
  22. echo -e "${NC}${LIGHT}Fuck You!!"
  23. exit 0
  24. fi
  25. clear
  26. tr="$(cat ~/log-install.txt | grep -w "Trojan" | cut -d: -f2|sed 's/ //g')"
  27. echo -e "======================================"
  28. echo -e ""
  29. echo -e "Change Port $tr"
  30. echo -e ""
  31. echo -e "======================================"
  32. read -p "New Port Trojan : " tr2
  33. if [ -z $tr2 ]; then
  34. echo "Please Input Port"
  35. exit 0
  36. fi
  37. cek=$(netstat -nutlp | grep -w $tr2)
  38. if [[ -z $cek ]]; then
  39. sed -i "s/$tr/$tr2/g" /etc/xray/config.json
  40. sed -i "s/ - XRAYS Trojan : $tr/ - XRAYS Trojan : $tr2/g" /root/log-install.txt
  41. iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport $tr -j ACCEPT
  42. iptables -D INPUT -m state --state NEW -m udp -p udp --dport $tr -j ACCEPT
  43. iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport $tr2 -j ACCEPT
  44. iptables -I INPUT -m state --state NEW -m udp -p udp --dport $tr2 -j ACCEPT
  45. iptables-save > /etc/iptables.up.rules
  46. iptables-restore -t < /etc/iptables.up.rules
  47. netfilter-persistent save > /dev/null
  48. netfilter-persistent reload > /dev/null
  49. systemctl restart xray.service > /dev/null
  50. echo -e "\e[032;1mPort $tr2 modified successfully\e[0m"
  51. else
  52. echo "Port $tr2 is used"
  53. fi