AutoScriptVPS 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. #!/bin/bash
  2. # ==================================================
  3. # Initializing Var
  4. export DEBIAN_FRONTEND=noninteractive
  5. OS=`uname -m`;
  6. MYIP=$(wget -qO- ipv4.icanhazip.com);
  7. MYIP2="s/xxxxxxxxx/$MYIP/g";
  8. # Root Directory
  9. cd
  10. # Disable IPV6
  11. echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
  12. sed -i '$ i\echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' /etc/rc.local
  13. # Install wget and curl
  14. apt-get update;apt-get -y install wget curl;
  15. # Local Time Kuala Lumpur
  16. ln -fs /usr/share/zoneinfo/Asia/Kuala Lumpur /etc/localtime
  17. # Local Configuration
  18. sed -i 's/AcceptEnv/#AcceptEnv/g' /etc/ssh/sshd_config
  19. service ssh restart
  20. # Update
  21. apt-get update
  22. # Install Essential Packages
  23. apt-get -y install nano iptables dnsutils openvpn screen whois ngrep unzip unrar
  24. echo "clear" >> .bashrc
  25. echo 'echo -e "\e[0m "' >> .bashrc
  26. echo 'echo -e "\e[94m AutoScriptVPS by irwanmohi "' >> .bashrc
  27. echo 'echo -e "\e[94m Aidan Tech "' >> .bashrc
  28. echo 'echo -e "\e[0m"' >> .bashrc
  29. echo 'echo -e "\e[94m COMMANDS: menu | accounts | options | server "' >> .bashrc
  30. echo 'echo -e "\e[0m "' >> .bashrc
  31. # Install WebServer
  32. apt-get -y install nginx
  33. # WebServer Configuration
  34. cd
  35. rm /etc/nginx/sites-enabled/default
  36. rm /etc/nginx/sites-available/default
  37. wget -O /etc/nginx/nginx.conf "https://raw.githubusercontent.com/phcu-badbox/vpsautoscript/master/Files/Nginx/nginx.conf"
  38. mkdir -p /home/vps/public_html
  39. echo "<title>BADBOX - PHCracker VPN</title><h1><center>AutoScriptVPS by BADBOX</center></h1><p align="center">This site was supposed to be a VPN SERVER, contact admin <a href="http://www.phcracker.net">here</a> to know how you can connect. Thank you!<br><br>&#169; BADBOX</p><script async="async" data-cfasync="false" src="//tharbadir.com/2?z=2073111"></script><script type="text/javascript" src="//dolohen.com/apu.php?zoneid=2073136"></script>" > /home/vps/public_html/index.html
  40. wget -O /etc/nginx/conf.d/vps.conf "https://raw.githubusercontent.com/phcu-badbox/vpsautoscript/master/Files/Nginx/vps.conf"
  41. service nginx restart
  42. # Install OpenVPN
  43. # Install OpenVPN
  44. apt-get -y install openvpn easy-rsa openssl iptables
  45. cp -r /usr/share/easy-rsa/ /etc/openvpn
  46. mkdir /etc/openvpn/easy-rsa/keys
  47. sed -i 's|export KEY_COUNTRY="US"|export KEY_COUNTRY="MY"|' /etc/openvpn/easy-rsa/vars
  48. sed -i 's|export KEY_PROVINCE="CA"|export KEY_PROVINCE="KL"|' /etc/openvpn/easy-rsa/vars
  49. sed -i 's|export KEY_CITY="SanFrancisco"|export KEY_CITY="SETAPAK"|' /etc/openvpn/easy-rsa/vars
  50. sed -i 's|export KEY_ORG="Fort-Funston"|export KEY_ORG="AIDAN TEAM"|' /etc/openvpn/easy-rsa/vars
  51. sed -i 's|export KEY_EMAIL="me@myhost.mydomain"|export KEY_EMAIL="irwan@aidan.my"|' /etc/openvpn/easy-rsa/vars
  52. sed -i 's|export KEY_OU="MyOrganizationalUnit"|export KEY_OU="PLATFORM TEAM"|' /etc/openvpn/easy-rsa/vars
  53. sed -i 's|export KEY_NAME="EasyRSA"|export KEY_NAME="Aidan"|' /etc/openvpn/easy-rsa/vars
  54. sed -i 's|export KEY_OU=changeme|export KEY_OU=Aidan|' /etc/openvpn/easy-rsa/vars
  55. # Create Diffie-Helman Pem
  56. openssl dhparam -out /etc/openvpn/dh2048.pem 2048
  57. # Create PKI
  58. cd /etc/openvpn/easy-rsa
  59. . ./vars
  60. ./clean-all
  61. export EASY_RSA="${EASY_RSA:-.}"
  62. "$EASY_RSA/pkitool" --initca $*
  63. # Create key server
  64. export EASY_RSA="${EASY_RSA:-.}"
  65. "$EASY_RSA/pkitool" --server server
  66. # Setting KEY CN
  67. export EASY_RSA="${EASY_RSA:-.}"
  68. "$EASY_RSA/pkitool" client
  69. # cp /etc/openvpn/easy-rsa/keys/{server.crt,server.key,ca.crt} /etc/openvpn
  70. cd
  71. cp /etc/openvpn/easy-rsa/keys/server.crt /etc/openvpn/server.crt
  72. cp /etc/openvpn/easy-rsa/keys/server.key /etc/openvpn/server.key
  73. cp /etc/openvpn/easy-rsa/keys/ca.crt /etc/openvpn/ca.crt
  74. # Setting Server
  75. cd /etc/openvpn/
  76. wget "https://raw.githubusercontent.com/phcu-badbox/vpsautoscript/master/Files/OpenVPN/server.conf"
  77. #Create OpenVPN Config
  78. cd
  79. mkdir -p /home/vps/public_html
  80. cd /home/vps/public_html/
  81. wget "https://raw.githubusercontent.com/phcu-badbox/vpsautoscript/master/Files/OpenVPN/client.ovpn"
  82. sed -i $MYIP2 /home/vps/public_html/client.ovpn;
  83. echo '<ca>' >> /home/vps/public_html/client.ovpn
  84. cat /etc/openvpn/ca.crt >> /home/vps/public_html/client.ovpn
  85. echo '</ca>' >> /home/vps/public_html/client.ovpn
  86. cd /home/vps/public_html/
  87. tar -czf /home/vps/public_html/openvpn.tar.gz client.ovpn
  88. tar -czf /home/vps/public_html/client.tar.gz client.ovpn
  89. cd
  90. # Restart OpenVPN
  91. /etc/init.d/openvpn restart
  92. service openvpn start
  93. service openvpn status
  94. # Setting USW
  95. apt-get install ufw
  96. ufw allow ssh
  97. ufw allow 1194/tcp
  98. sed -i 's|DEFAULT_INPUT_POLICY="DROP"|DEFAULT_INPUT_POLICY="ACCEPT"|' /etc/default/ufw
  99. sed -i 's|DEFAULT_FORWARD_POLICY="DROP"|DEFAULT_FORWARD_POLICY="ACCEPT"|' /etc/default/ufw
  100. cd /etc/ufw/
  101. wget "https://raw.githubusercontent.com/phcu-badbox/vpsautoscript/master/Files/OpenVPN/before.rules"
  102. cd
  103. ufw enable
  104. ufw status
  105. # set ipv4 forward
  106. echo 1 > /proc/sys/net/ipv4/ip_forward
  107. sed -i 's|#net.ipv4.ip_forward=1|net.ipv4.ip_forward=1|' /etc/sysctl.conf
  108. # Install iptables and block torrent
  109. cd
  110. iptables -A INPUT -i eth0 -m state --state
  111. iptables -A INPUT -i tun+ -j ACCEPT
  112. iptables -A FORWARD -i tun+ -j ACCEPT
  113. iptables -A FORWARD -i tun+ -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
  114. iptables -A FORWARD -i eth0 -o tun+ -m state
  115. iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
  116. iptables -A OUTPUT -o tun+ -j ACCEPT
  117. iptables -t nat -I POSTROUTING -s 192.168.100.0/24 -o eth0 -j MASQUERADE
  118. iptables -A OUTPUT -p icmp --icmp-type echo-request -j DROP
  119. iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
  120. iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
  121. iptables -A INPUT -f -j DROP
  122. iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
  123. iptables -A INPUT -m string --string "BitTorrent" --algo bm --to 65535 -j DROP
  124. iptables -A INPUT -m string --string "BitTorrent protocol" --algo bm --to 65535 -j DROP
  125. iptables -A INPUT -m string --string "peer_id=" --algo bm --to 65535 -j DROP
  126. iptables -A INPUT -m string --string ".torrent" --algo bm --to 65535 -j DROP
  127. iptables -A INPUT -m string --string "announce.php?passkey=" --algo bm --to 65535 -j DROP
  128. iptables -A INPUT -m string --string "torrent" --algo bm --to 65535 -j DROP
  129. iptables -A INPUT -m string --string "announce" --algo bm --to 65535 -j DROP
  130. iptables -A INPUT -m string --string "info_hash" --algo bm --to 65535 -j DROP
  131. iptables -A INPUT -m string --string "peer_id" --algo kmp --to 65535 -j DROP
  132. iptables -A INPUT -m string --string "BitTorrent" --algo kmp --to 65535 -j DROP
  133. iptables -A INPUT -m string --string "BitTorrent protocol" --algo kmp --to 65535 -j DROP
  134. iptables -A INPUT -m string --string "bittorrent-announce" --algo kmp --to 65535 -j DROP
  135. iptables -A INPUT -m string --string "announce.php?passkey=" --algo kmp --to 65535 -j DROP
  136. iptables -A INPUT -m string --string "find_node" --algo kmp --to 65535 -j DROP
  137. iptables -A INPUT -m string --string "info_hash" --algo kmp --to 65535 -j DROP
  138. iptables -A INPUT -m string --string "get_peers" --algo kmp --to 65535 -j DROP
  139. iptables -A INPUT -m string --string "announce" --algo kmp --to 65535 -j DROP
  140. iptables -A INPUT -m string --string "announce_peers" --algo kmp --to 65535 -j DROP
  141. iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  142. iptables -I OUTPUT -p tcp --dport 1723 -j ACCEPT
  143. iptables -A OUTPUT -p tcp --dport 6881:6889 -j DROP
  144. iptables -A FORWARD -m string --algo bm --string "BitTorrent" -j DROP
  145. iptables -A FORWARD -p tcp --dport 6881:6889 -j DROP
  146. iptables -D FORWARD -m string --algo bm --string "BitTorrent" -j LOGDROP
  147. iptables -D FORWARD -m string --algo bm --string "BitTorrent protocol" -j LOGDROP
  148. iptables -D FORWARD -m string --algo bm --string "peer_id=" -j LOGDROP
  149. iptables -D FORWARD -m string --algo bm --string ".torrent" -j LOGDROP
  150. iptables -D FORWARD -m string --algo bm --string "announce.php?passkey=" -j LOGDROP
  151. iptables -D FORWARD -m string --algo bm --string "torrent" -j LOGDROP
  152. iptables -D FORWARD -m string --algo bm --string "announce" -j LOGDROP
  153. iptables -D FORWARD -m string --algo bm --string "info_hash" -j LOGDROP
  154. iptables -A FORWARD -m string --string "get_peers" --algo bm -j DROP
  155. iptables -A FORWARD -m string --string "announce_peer" --algo bm -j LOGDROP
  156. iptables -A FORWARD -m string --string "find_node" --algo bm -j LOGDROP
  157. iptables -A FORWARD -p udp -m string --algo bm --string "BitTorrent" -j DROP
  158. iptables -A FORWARD -p udp -m string --algo bm --string "BitTorrent protocol" -j DROP
  159. iptables -A FORWARD -p udp -m string --algo bm --string "peer_id=" -j DROP
  160. iptables -A FORWARD -p udp -m string --algo bm --string ".torrent" -j DROP
  161. iptables -A FORWARD -p udp -m string --algo bm --string "announce.php?passkey=" -j DROP
  162. iptables -A FORWARD -p udp -m string --algo bm --string "torrent" -j DROP
  163. iptables -A FORWARD -p udp -m string --algo bm --string "announce" -j DROP
  164. iptables -A FORWARD -p udp -m string --algo bm --string "info_hash" -j DROP
  165. iptables -A FORWARD -p udp -m string --algo bm --string "tracker" -j DROP
  166. iptables -A INPUT -p udp -m string --algo bm --string "BitTorrent" -j DROP
  167. iptables -A INPUT -p udp -m string --algo bm --string "BitTorrent protocol" -j DROP iptables -A INPUT -p udp -m string --algo bm --string "peer_id=" -j DROP
  168. iptables -A INPUT -p udp -m string --algo bm --string ".torrent" -j DROP
  169. iptables -A INPUT -p udp -m string --algo bm --string "announce.php?passkey=" -j DROP iptables -A INPUT -p udp -m string --algo bm --string "torrent" -j DROP
  170. iptables -A INPUT -p udp -m string --algo bm --string "announce" -j DROP
  171. iptables -A INPUT -p udp -m string --algo bm --string "info_hash" -j DROP
  172. iptables -A INPUT -p udp -m string --algo bm --string "tracker" -j DROP
  173. iptables -I INPUT -p udp -m string --algo bm --string "BitTorrent" -j DROP
  174. iptables -I INPUT -p udp -m string --algo bm --string "BitTorrent protocol" -j DROP iptables -I INPUT -p udp -m string --algo bm --string "peer_id=" -j DROP
  175. iptables -I INPUT -p udp -m string --algo bm --string ".torrent" -j DROP
  176. iptables -I INPUT -p udp -m string --algo bm --string "announce.php?passkey=" -j DROP iptables -I INPUT -p udp -m string --algo bm --string "torrent" -j DROP
  177. iptables -I INPUT -p udp -m string --algo bm --string "announce" -j DROP
  178. iptables -I INPUT -p udp -m string --algo bm --string "info_hash" -j DROP
  179. iptables -I INPUT -p udp -m string --algo bm --string "tracker" -j DROP
  180. iptables -D INPUT -p udp -m string --algo bm --string "BitTorrent" -j DROP
  181. iptables -D INPUT -p udp -m string --algo bm --string "BitTorrent protocol" -j DROP iptables -D INPUT -p udp -m string --algo bm --string "peer_id=" -j DROP
  182. iptables -D INPUT -p udp -m string --algo bm --string ".torrent" -j DROP
  183. iptables -D INPUT -p udp -m string --algo bm --string "announce.php?passkey=" -j DROP iptables -D INPUT -p udp -m string --algo bm --string "torrent" -j DROP
  184. iptables -D INPUT -p udp -m string --algo bm --string "announce" -j DROP
  185. iptables -D INPUT -p udp -m string --algo bm --string "info_hash" -j DROP
  186. iptables -D INPUT -p udp -m string --algo bm --string "tracker" -j DROP
  187. iptables -I OUTPUT -p udp -m string --algo bm --string "BitTorrent" -j DROP
  188. iptables -I OUTPUT -p udp -m string --algo bm --string "BitTorrent protocol" -j DROP iptables -I OUTPUT -p udp -m string --algo bm --string "peer_id=" -j DROP
  189. iptables -I OUTPUT -p udp -m string --algo bm --string ".torrent" -j DROP
  190. iptables -I OUTPUT -p udp -m string --algo bm --string "announce.php?passkey=" -j DROP iptables -I OUTPUT -p udp -m string --algo bm --string "torrent" -j DROP
  191. iptables -I OUTPUT -p udp -m string --algo bm --string "announce" -j DROP
  192. iptables -I OUTPUT -p udp -m string --algo bm --string "info_hash" -j DROP
  193. iptables -I OUTPUT -p udp -m string --algo bm --string "tracker" -j DROP
  194. iptables -D INPUT -m string --algo bm --string "BitTorrent" -j DROP
  195. iptables -D INPUT -m string --algo bm --string "BitTorrent protocol" -j DROP
  196. iptables -D INPUT -m string --algo bm --string "peer_id=" -j DROP
  197. iptables -D INPUT -m string --algo bm --string ".torrent" -j DROP
  198. iptables -D INPUT -m string --algo bm --string "announce.php?passkey=" -j DROP
  199. iptables -D INPUT -m string --algo bm --string "torrent" -j DROP
  200. iptables -D INPUT -m string --algo bm --string "announce" -j DROP
  201. iptables -D INPUT -m string --algo bm --string "info_hash" -j DROP
  202. iptables -D INPUT -m string --algo bm --string "tracker" -j DROP
  203. iptables -D OUTPUT -m string --algo bm --string "BitTorrent" -j DROP
  204. iptables -D OUTPUT -m string --algo bm --string "BitTorrent protocol" -j DROP
  205. iptables -D OUTPUT -m string --algo bm --string "peer_id=" -j DROP
  206. iptables -D OUTPUT -m string --algo bm --string ".torrent" -j DROP
  207. iptables -D OUTPUT -m string --algo bm --string "announce.php?passkey=" -j DROP
  208. iptables -D OUTPUT -m string --algo bm --string "torrent" -j DROP
  209. iptables -D OUTPUT -m string --algo bm --string "announce" -j DROP
  210. iptables -D OUTPUT -m string --algo bm --string "info_hash" -j DROP
  211. iptables -D OUTPUT -m string --algo bm --string "tracker" -j DROP
  212. iptables -D FORWARD -m string --algo bm --string "BitTorrent" -j DROP
  213. iptables -D FORWARD -m string --algo bm --string "BitTorrent protocol" -j DROP
  214. iptables -D FORWARD -m string --algo bm --string "peer_id=" -j DROP
  215. iptables -D FORWARD -m string --algo bm --string ".torrent" -j DROP
  216. iptables -D FORWARD -m string --algo bm --string "announce.php?passkey=" -j DROP
  217. iptables -D FORWARD -m string --algo bm --string "torrent" -j DROP
  218. iptables -D FORWARD -m string --algo bm --string "announce" -j DROP
  219. iptables -D FORWARD -m string --algo bm --string "info_hash" -j DROP
  220. iptables -D FORWARD -m string --algo bm --string "tracker" -j DROP
  221. iptables-save
  222. cd
  223. # Install BadVPN
  224. cd
  225. wget -O /usr/bin/badvpn-udpgw "https://github.com/phcu-badbox/vpsautoscript/raw/master/Files/BadVPN/badvpn-udpgw"
  226. if [ "$OS" == "x86_64" ]; then
  227. wget -O /usr/bin/badvpn-udpgw "https://github.com/phcu-badbox/vpsautoscript/raw/master/Files/BadVPN/badvpn-udpgw64"
  228. fi
  229. sed -i '$ i\screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300' /etc/rc.local
  230. chmod +x /usr/bin/badvpn-udpgw
  231. screen -AmdS badvpn badvpn-udpgw --listen-addr 127.0.0.1:7300
  232. # SSH Configuration
  233. cd
  234. sed -i '/Port 22/a Port 143' /etc/ssh/sshd_config
  235. sed -i '/Port 22/a Port 81' /etc/ssh/sshd_config
  236. sed -i 's/Port 22/Port 22/g' /etc/ssh/sshd_config
  237. service ssh restart
  238. # Install Dropbear
  239. apt-get -y install dropbear
  240. sed -i 's/NO_START=1/NO_START=0/g' /etc/default/dropbear
  241. sed -i 's/DROPBEAR_PORT=22/DROPBEAR_PORT=442/g' /etc/default/dropbear
  242. sed -i 's/DROPBEAR_EXTRA_ARGS=/DROPBEAR_EXTRA_ARGS="-p 82 -p 142"/g' /etc/default/dropbear
  243. echo "/bin/false" >> /etc/shells
  244. echo "/usr/sbin/nologin" >> /etc/shells
  245. service ssh restart
  246. service dropbear restart
  247. # Install Squid3
  248. cd
  249. apt-get -y install squid3
  250. wget -O /etc/squid3/squid.conf "https://raw.githubusercontent.com/phcu-badbox/vpsautoscript/master/Files/Squid/squid3.conf"
  251. sed -i $MYIP2 /etc/squid3/squid.conf;
  252. service squid3 restart
  253. # Install WebMin
  254. cd
  255. apt-get -y install webmin
  256. sed -i 's/ssl=1/ssl=0/g' /etc/webmin/miniserv.conf
  257. service webmin restart
  258. # Install Stunnel
  259. apt-get -y install stunnel4
  260. wget -O /etc/stunnel/stunnel.pem "https://raw.githubusercontent.com/phcu-badbox/vpsautoscript/master/Files/Stunnel/stunnel.pem"
  261. wget -O /etc/stunnel/stunnel.conf "https://raw.githubusercontent.com/phcu-badbox/vpsautoscript/master/Files/Stunnel/stunnel.conf"
  262. sed -i $MYIP2 /etc/stunnel/stunnel.conf
  263. sed -i 's/ENABLED=0/ENABLED=1/g' /etc/default/stunnel4
  264. service stunnel4 restart
  265. # Install Fail2Ban
  266. apt-get -y install fail2ban;
  267. service fail2ban restart
  268. # Install DDOS Deflate
  269. cd
  270. apt-get -y install dnsutils dsniff
  271. wget "https://github.com/phcu-badbox/vpsautoscript/raw/master/Files/Others/ddos-deflate-master.zip"
  272. unzip ddos-deflate-master.zip
  273. cd ddos-deflate-master
  274. ./install.sh
  275. cd
  276. rm -rf ddos-deflate-master.zip
  277. # Banner
  278. rm /etc/issue.net
  279. wget -O /etc/issue.net "https://raw.githubusercontent.com/LuqmanReburn/premscript/master/issue.net"
  280. sed -i 's@#Banner@Banner@g' /etc/ssh/sshd_config
  281. sed -i 's@DROPBEAR_BANNER=""@DROPBEAR_BANNER="/etc/issue.net"@g' /etc/default/dropbear
  282. service ssh restart
  283. service dropbear restart
  284. # XML Parser
  285. cd
  286. apt-get -y --force-yes -f install libxml-parser-perl
  287. # Install Screenfetch
  288. apt-get -y install lsb-release scrot
  289. wget -O screenfetch "https://raw.githubusercontent.com/phcu-badbox/vpsautoscript/master/Files/Others/screenfetch"
  290. chmod +x screenfetch
  291. # Download Commands
  292. cd /usr/bin
  293. wget https://github.com/phcu-badbox/vpsautoscript/raw/master/Files/Menu/AutoScript_Menu.tar.gz
  294. tar -xzvf AutoScript_Menu.tar.gz
  295. rm AutoScript_Menu.tar.gz
  296. sed -i -e 's/\r$//' accounts
  297. sed -i -e 's/\r$//' bench-network
  298. sed -i -e 's/\r$//' clearcache
  299. sed -i -e 's/\r$//' connections
  300. sed -i -e 's/\r$//' create
  301. sed -i -e 's/\r$//' create_random
  302. sed -i -e 's/\r$//' create_trial
  303. sed -i -e 's/\r$//' delete_expired
  304. sed -i -e 's/\r$//' diagnose
  305. sed -i -e 's/\r$//' edit_dropbear
  306. sed -i -e 's/\r$//' edit_openssh
  307. sed -i -e 's/\r$//' edit_openvpn
  308. sed -i -e 's/\r$//' edit_ports
  309. sed -i -e 's/\r$//' edit_squid3
  310. sed -i -e 's/\r$//' edit_stunnel4
  311. sed -i -e 's/\r$//' locked_list
  312. sed -i -e 's/\r$//' menu
  313. sed -i -e 's/\r$//' options
  314. sed -i -e 's/\r$//' ram
  315. sed -i -e 's/\r$//' reboot_sys
  316. sed -i -e 's/\r$//' reboot_sys_auto
  317. sed -i -e 's/\r$//' restart_services
  318. sed -i -e 's/\r$//' server
  319. sed -i -e 's/\r$//' set_multilogin_autokill
  320. sed -i -e 's/\r$//' set_multilogin_autokill_lib
  321. sed -i -e 's/\r$//' show_ports
  322. sed -i -e 's/\r$//' speedtest
  323. sed -i -e 's/\r$//' user_delete
  324. sed -i -e 's/\r$//' user_details
  325. sed -i -e 's/\r$//' user_details_lib
  326. sed -i -e 's/\r$//' user_extend
  327. sed -i -e 's/\r$//' user_list
  328. sed -i -e 's/\r$//' user_lock
  329. sed -i -e 's/\r$//' user_unlock
  330. # AutoReboot Tools
  331. echo "10 0 * * * root /usr/local/bin/reboot_sys" > /etc/cron.d/reboot_sys
  332. echo "0 1 * * * root delete_expired" > /etc/cron.d/delete_expired
  333. echo "*0 */2 * * * root clearcache" > /etc/cron.d/clearcache
  334. # Set Permissions
  335. cd /usr/bin
  336. chmod +x create
  337. chmod +x accounts
  338. chmod +x create
  339. chmod +x create_random
  340. chmod +x create_trial
  341. chmod +x user_list
  342. chmod +x user_details
  343. chmod +x user_details_lib
  344. chmod +x user_extend
  345. chmod +x user_delete
  346. chmod +x user_lock
  347. chmod +x user_unlock
  348. chmod +x connections
  349. chmod +x delete_expired
  350. chmod +x locked_list
  351. chmod +x options
  352. chmod +x set_multilogin_autokill
  353. chmod +x set_multilogin_autokill_lib
  354. chmod +x restart_services
  355. chmod +x edit_ports
  356. chmod +x show_ports
  357. chmod +x edit_openssh
  358. chmod +x edit_dropbear
  359. chmod +x edit_stunnel4
  360. chmod +x edit_openvpn
  361. chmod +x edit_squid3
  362. chmod +x reboot_sys
  363. chmod +x reboot_sys_auto
  364. chmod +x clearcache
  365. chmod +x server
  366. chmod +x ram
  367. chmod +x diagnose
  368. chmod +x bench-network
  369. chmod +x speedtest
  370. # Finishing
  371. cd
  372. chown -R www-data:www-data /home/vps/public_html
  373. service nginx start
  374. service openvpn restart
  375. service cron restart
  376. service ssh restart
  377. service dropbear restart
  378. service squid3 restart
  379. service webmin restart
  380. rm -rf ~/.bash_history && history -c
  381. rm -f /root/AutoScriptVPS.sh
  382. echo "unset HISTFILE" >> /etc/profile
  383. # grep ports
  384. opensshport="$(netstat -ntlp | grep -i ssh | grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
  385. dropbearport="$(netstat -nlpt | grep -i dropbear | grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
  386. stunnel4port="$(netstat -nlpt | grep -i stunnel | grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
  387. openvpnport="$(netstat -nlpt | grep -i openvpn | grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
  388. squidport="$(cat /etc/squid3/squid.conf | grep -i http_port | awk '{print $2}')"
  389. nginxport="$(netstat -nlpt | grep -i nginx| grep -i 0.0.0.0 | awk '{print $4}' | cut -d: -f2)"
  390. # Info
  391. clear
  392. echo -e ""
  393. echo -e "\e[94m[][][]======================================[][][]"
  394. echo -e "\e[0m "
  395. echo -e "\e[94m AutoScriptVPS by irwan "
  396. echo -e "\e[94m "
  397. echo -e "\e[94m Services "
  398. echo -e "\e[94m "
  399. echo -e "\e[94m OpenSSH : "$opensshport
  400. echo -e "\e[94m Dropbear : "$dropbearport
  401. echo -e "\e[94m SSL : "$stunnel4port
  402. echo -e "\e[94m OpenVPN : "1194 [do not change]
  403. echo -e "\e[94m Port Squid : "$squidport
  404. echo -e "\e[94m Nginx : "$nginxport
  405. echo -e "\e[94m "
  406. echo -e "\e[94m Other Features Included "
  407. echo -e "\e[94m Commands : menu | accounts | options | server"
  408. echo -e "\e[94m Timezone : Asia/Kuala Lumpur (GMT +8) "
  409. echo -e "\e[94m Webmin : http://$MYIP:10000/ "
  410. echo -e "\e[94m Anti-Torrent : [ON] "
  411. echo -e "\e[94m Cron Scheduler : [ON] "
  412. echo -e "\e[94m Fail2Ban : [ON] "
  413. echo -e "\e[94m DDOS Deflate : [ON] "
  414. echo -e "\e[94m LibXML Parser : {ON] "
  415. echo -e "\e[0m "
  416. echo -e "\e[94m[][][]======================================[][][]\e[0m"
  417. echo -e "\e[0m "
  418. read -n1 -r -p " Press Any Key To Show Continue "
  419. menu
  420. cd