3proxy.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. install_3proxy() {
  2. echo "installing 3proxy"
  3. URL="https://github.com/z3APA3A/3proxy/archive/3proxy-0.8.6.tar.gz"
  4. wget -qO- $URL | bsdtar -xvf-
  5. cd 3proxy-3proxy-0.8.6
  6. make -f Makefile.Linux
  7. mkdir -p /usr/local/etc/3proxy/{bin,logs,stat}
  8. cp src/3proxy /usr/local/etc/3proxy/bin/
  9. cp ./scripts/rc.d/proxy.sh /etc/init.d/3proxy
  10. chmod +x /etc/init.d/3proxy
  11. chkconfig 3proxy on
  12. cd $WORKDIR
  13. }
  14. gen_3proxy() {
  15. cat <<EOF
  16. daemon
  17. maxconn 1000
  18. nscache 65536
  19. timeouts 1 5 30 60 180 1800 15 60
  20. setgid 65535
  21. setuid 65535
  22. flush
  23. auth strong
  24. users $(awk -F "/" 'BEGIN{ORS="";} {print $1 ":CL:" $2 " "}' ${WORKDATA})
  25. $(awk -F "/" '{print "auth strong\n" \
  26. "allow " $1 "\n" \
  27. "proxy -6 -n -a -p" $4 " -i" $3 " -e"$5"\n" \
  28. "flush\n"}' ${WORKDATA})
  29. EOF
  30. }
  31. gen_proxy_file_for_user() {
  32. cat >proxy.txt <<EOF
  33. $(awk -F "/" '{print $3 ":" $4 ":" $1 ":" $2 }' ${WORKDATA})
  34. EOF
  35. }
  36. upload_proxy() {
  37. local PASS=$(random)
  38. zip --password $PASS proxy.zip proxy.txt
  39. URL=$(curl -s --upload-file proxy.zip https://transfer.sh/proxy.zip)
  40. echo "Proxy is ready! Format IP:PORT:LOGIN:PASS"
  41. echo "Download zip archive from: ${URL}"
  42. echo "Password: ${PASS}"
  43. }
  44. gen_data() {
  45. seq $FIRST_PORT $LAST_PORT | while read port; do
  46. echo "usr$(random)/pass$(random)/$IP4/$port/$(gen64 $IP6)"
  47. done
  48. }
  49. gen_iptables() {
  50. cat <<EOF
  51. $(awk -F "/" '{print "iptables -I INPUT -p tcp --dport " $4 " -m state --state NEW -j ACCEPT"}' ${WORKDATA})
  52. EOF
  53. }
  54. gen_ifconfig() {
  55. cat <<EOF
  56. $(awk -F "/" '{print "ifconfig eth0 inet6 add " $5 "/64"}' ${WORKDATA})
  57. EOF
  58. }