add-ss.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #!/bin/bash
  2. red='\e[1;31m'
  3. green='\e[0;32m'
  4. NC='\e[0m'
  5. MYIP=$(wget -qO- icanhazip.com);
  6. echo "Script By geo"
  7. clear
  8. if [[ "$IP2" = "" ]]; then
  9. domain=$(cat /etc/v2ray/domain)
  10. else
  11. domain=$IP2
  12. fi
  13. IP=$(wget -qO- icanhazip.com);
  14. lastport1=$(grep "port_tls" /etc/shadowsocks-libev/akun.conf | tail -n1 | awk '{print $2}')
  15. lastport2=$(grep "port_http" /etc/shadowsocks-libev/akun.conf | tail -n1 | awk '{print $2}')
  16. if [[ $lastport1 == '' ]]; then
  17. tls=2443
  18. else
  19. tls="$((lastport1+1))"
  20. fi
  21. if [[ $lastport2 == '' ]]; then
  22. http=3443
  23. else
  24. http="$((lastport2+1))"
  25. fi
  26. echo ""
  27. echo "Masukkan password"
  28. until [[ $user =~ ^[a-zA-Z0-9_]+$ && ${CLIENT_EXISTS} == '0' ]]; do
  29. read -rp "Password: " -e user
  30. CLIENT_EXISTS=$(grep -w $user /etc/shadowsocks-libev/akun.conf | wc -l)
  31. if [[ ${CLIENT_EXISTS} == '1' ]]; then
  32. echo ""
  33. echo "A client with the specified name was already created, please choose another name."
  34. exit 1
  35. fi
  36. done
  37. read -p "Expired (hari): " masaaktif
  38. exp=`date -d "$masaaktif days" +"%d-%m-%Y"`
  39. created=`date -d "0 days" +"%d-%m-%Y"`
  40. cat > /etc/shadowsocks-libev/$user-tls.json<<END
  41. {
  42. "server":"0.0.0.0",
  43. "server_port":$tls,
  44. "password":"$user",
  45. "timeout":60,
  46. "method":"aes-256-cfb",
  47. "fast_open":true,
  48. "no_delay":true,
  49. "nameserver":"8.8.8.8",
  50. "mode":"tcp_and_udp",
  51. "plugin":"obfs-server",
  52. "plugin_opts":"obfs=tls"
  53. }
  54. END
  55. cat > /etc/shadowsocks-libev/$user-http.json <<-END
  56. {
  57. "server":"0.0.0.0",
  58. "server_port":$http,
  59. "password":"$user",
  60. "timeout":60,
  61. "method":"aes-256-cfb",
  62. "fast_open":true,
  63. "no_delay":true,
  64. "nameserver":"8.8.8.8",
  65. "mode":"tcp_and_udp",
  66. "plugin":"obfs-server",
  67. "plugin_opts":"obfs=http"
  68. }
  69. END
  70. chmod +x /etc/shadowsocks-libev/$user-tls.json
  71. chmod +x /etc/shadowsocks-libev/$user-http.json
  72. systemctl start shadowsocks-libev-server@$user-tls.service
  73. systemctl enable shadowsocks-libev-server@$user-tls.service
  74. systemctl start shadowsocks-libev-server@$user-http.service
  75. systemctl enable shadowsocks-libev-server@$user-http.service
  76. tmp1=$(echo -n "aes-256-cfb:${user}@${domain}:$tls" | base64 -w0)
  77. tmp2=$(echo -n "aes-256-cfb:${user}@${domain}:$http" | base64 -w0)
  78. linkss1="ss://${tmp1}?plugin=obfs-local;obfs=tls;obfs-host=bing.com"
  79. linkss2="ss://${tmp2}?plugin=obfs-local;obfs=http;obfs-host=bing.com"
  80. echo -e "### $user $exp
  81. port_tls $tls
  82. port_http $http">>"/etc/shadowsocks-libev/akun.conf"
  83. service cron restart
  84. clear
  85. echo -e "=======-Shadowsocks-======="
  86. echo -e "IP/Host : $IP"
  87. echo -e "Domain : ${domain}"
  88. echo -e "Port OBFS TLS : $tls"
  89. echo -e "Port OBFS HTTP : $http"
  90. echo -e "Password : $user"
  91. echo -e "Method : aes-256-cfb"
  92. echo -e "Created : $created"
  93. echo -e "Expired : $exp"
  94. echo -e "==========================="
  95. echo -e "Link OBFS TLS : $linkss1"
  96. echo -e "==========================="
  97. echo -e "Link OBFS HTTP : $linkss2"
  98. echo -e "==========================="
  99. echo -e ""
  100. echo -e ""