cabecalho 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865
  1. #!/bin/bash
  2. #CREADOR Henry Chumo | 06/06/2022
  3. #Alias : @ChumoGH
  4. # -*- ENCODING: UTF-8 -*-
  5. dropbear_pids () {
  6. port_dropbear=`ps aux|grep 'dropbear'|awk NR==1|awk '{print $17;}'`
  7. log=/var/log/auth.log
  8. loginsukses='Password auth succeeded'
  9. pids=`ps ax|grep 'dropbear'|grep " $port_dropbear"|awk -F " " '{print $1}'`
  10. for pid in $pids; do
  11. pidlogs=`grep $pid $log |grep "$loginsukses" |awk -F" " '{print $3}'`
  12. i=0
  13. for pidend in $pidlogs; do
  14. let i=i+1
  15. done
  16. if [ $pidend ];then
  17. login=`grep $pid $log |grep "$pidend" |grep "$loginsukses"`
  18. PID=$pid
  19. user=`echo $login |awk -F" " '{print $10}' | sed -r "s/'/ /g"`
  20. waktu=`echo $login |awk -F" " '{print $2"-"$1,$3}'`
  21. while [ ${#waktu} -lt 13 ]; do
  22. waktu=$waktu" "
  23. done
  24. while [ ${#user} -lt 16 ]; do
  25. user=$user" "
  26. done
  27. while [ ${#PID} -lt 8 ]; do
  28. PID=$PID" "
  29. done
  30. echo "$user $PID $waktu"
  31. fi
  32. done
  33. }
  34. mostrar_usuarios () {
  35. for u in `cat "/etc/passwd"|grep 'home'|grep 'false'|grep -v 'syslog' | cut -d: -f1`; do
  36. echo "$u"
  37. done
  38. }
  39. function_onlines () {
  40. local users=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|awk -F ':' '{print $1}')
  41. # dpids=$(dropbear_pids) users=$(cat /etc/passwd|grep 'home'|grep 'false'|grep -v 'syslog'|awk -F ':' '{print $1}')
  42. dpids=$(dropbear_pids)
  43. time=$(date +%s)
  44. [[ -e /etc/openvpn/openvpn-status.log ]] && ovpn_log=$(cat /etc/openvpn/openvpn-status.log)
  45. n='0'
  46. i='0'
  47. u='1'
  48. conect='0'
  49. _onlin='0'
  50. for _user in $users; do
  51. [[ -z "$(ps -u $_user|grep sshd)" ]] && sqd=0 || sqd=$(ps -u $_user|grep sshd | wc -l)
  52. [[ -z "$(echo $ovpn_log|grep -E ,"$_user",)" ]] && ovp=0 || ovp=$(echo $ovpn_log|grep -E ,"$_user", | wc -l)
  53. [[ -z "$(echo $dpids|grep -w "$_user")" ]] && drop=0 || drop=$(echo $dpids|grep -w "$_user" | wc -l)
  54. _onlin=$(($sqd + $ovp + $drop))
  55. #[[ $_onlin -ne 0 ]] &&
  56. conect=$(($conect + $_onlin))
  57. if [[ $(chage -l $_user |grep 'Account expires' |awk -F ': ' '{print $2}') != never ]]; then
  58. [[ $time -gt $(date '+%s' -d "$(chage -l $_user |grep "Account expires" |awk -F ': ' '{print $2}')") ]] && let n++
  59. fi
  60. [[ $(passwd --status $_user|cut -d ' ' -f2) = "L" ]] && let i++
  61. done
  62. _onlin="\033[1;31m${conect}"
  63. _userexp="\033[1;31m${n}"
  64. _userlock="${i}"
  65. _tuser="\033[1;31m$(echo -e "${users}" | wc -l)"
  66. }
  67. [[ -e /etc/adm-lite/modulos ]] && function_onlines &> /dev/null
  68. if ! [ $(id -u) = 0 ]; then
  69. clear
  70. echo ""
  71. msg -bar
  72. echo " ⛑⛑⛑ Error Fatal!! x000e1 ⛑⛑⛑"
  73. msg -bar
  74. echo " ✠ Este script debe ejecutarse como root! ✠"
  75. echo " Como Solucionarlo "
  76. echo " Ejecute el script así:"
  77. echo " ⇘ ⇙ "
  78. echo " sudo -i "
  79. echo " sudo su"
  80. echo " Retornando . . ."
  81. echo $(date)
  82. msg -bar
  83. exit
  84. fi
  85. ##
  86. # Funcoes Globais
  87. [[ -e /bin/ejecutar/msg ]] && source /bin/ejecutar/msg || source <(curl -sSL https://raw.githubusercontent.com/ChumoGH/ChumoGH-Script/master/msg-bar/msg)
  88. #PRUEBA DE MODULOS BETA A ELIMINAR EN UPDATE V5.2
  89. install_ini () {
  90. _error=0
  91. msg -bar
  92. echo -e "\033[97m"
  93. echo -e "\033[41m -- INSTALAREMOS LO NECESARIO PARA EL ADM --"
  94. echo -e " \033[41m-- Arch : $(lscpu | grep "Vendor ID" | awk '{print $3}') SISTEMA $(lsb_release -si) $(lsb_release -sr) --"
  95. echo -e "\033[100m ATENCION A INSTALACION POR SI DEVUELVE UN ERROR "
  96. echo -e "\033[97m"
  97. msg -bar
  98. locale-gen en_US.UTF-8 > /dev/null 2>&1
  99. update-locale LANG=en_US.UTF-8 > /dev/null 2>&1 && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  100. echo -e "\033[97m # Instalando Paqueteria UTF............ $ESTATUS "
  101. #at
  102. [[ $(dpkg --get-selections|grep -w "at"|head -1) ]] || apt-get install at -y &>/dev/null
  103. [[ $(dpkg --get-selections|grep -w "at"|head -1) ]] || {
  104. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  105. let _error++
  106. }
  107. [[ $(dpkg --get-selections|grep -w "at"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  108. echo -e "\033[97m # apt-get install at................... $ESTATUS "
  109. #screen
  110. [[ $(dpkg --get-selections|grep -w "screen"|head -1) ]] || apt-get install screen -y &>/dev/null
  111. [[ $(dpkg --get-selections|grep -w "screen"|head -1) ]] || {
  112. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  113. let _error++
  114. }
  115. [[ $(dpkg --get-selections|grep -w "screen"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  116. echo -e "\033[97m # apt-get install screen............... $ESTATUS "
  117. #python
  118. [[ $(dpkg --get-selections|grep -w "python"|head -1) ]] || apt-get install python -y &>/dev/null
  119. [[ $(dpkg --get-selections|grep -w "python"|head -1) ]] || {
  120. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  121. let _error++
  122. }
  123. [[ $(dpkg --get-selections|grep -w "python"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  124. echo -e "\033[97m # apt-get install python............... $ESTATUS "
  125. #python3
  126. [[ $(dpkg --get-selections|grep -w "python3"|head -1) ]] || apt-get install python3 -y &>/dev/null
  127. [[ $(dpkg --get-selections|grep -w "python3"|head -1) ]] || {
  128. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  129. let _error++
  130. }
  131. [[ $(dpkg --get-selections|grep -w "python3"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  132. echo -e "\033[97m # apt-get install python3.............. $ESTATUS "
  133. #python3-pip
  134. [[ $(dpkg --get-selections|grep -w "python3-pip"|head -1) ]] || apt-get install python3-pip -y &>/dev/null
  135. [[ $(dpkg --get-selections|grep -w "python3-pip"|head -1) ]] || {
  136. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  137. let _error++
  138. }
  139. [[ $(dpkg --get-selections|grep -w "python3-pip"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  140. echo -e "\033[97m # apt-get install python3-pip.......... $ESTATUS "
  141. #npm
  142. [[ $(dpkg --get-selections|grep -w "npm"|head -1) ]] || apt-get install npm -y &>/dev/null
  143. [[ $(dpkg --get-selections|grep -w "npm"|head -1) ]] || {
  144. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  145. let _error++
  146. }
  147. [[ $(dpkg --get-selections|grep -w "npm"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  148. echo -e "\033[97m # apt-get install npm.................. $ESTATUS "
  149. #nodejs
  150. [[ $(dpkg --get-selections|grep -w "nodejs"|head -1) ]] || apt-get install nodejs -y &>/dev/null
  151. [[ $(dpkg --get-selections|grep -w "nodejs"|head -1) ]] || {
  152. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  153. let _error++
  154. }
  155. [[ $(dpkg --get-selections|grep -w "nodejs"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  156. echo -e "\033[97m # apt-get install nodejs............... $ESTATUS "
  157. #lsof
  158. [[ $(dpkg --get-selections|grep -w "lsof"|head -1) ]] || apt-get install lsof -y &>/dev/null
  159. [[ $(dpkg --get-selections|grep -w "lsof"|head -1) ]] || {
  160. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  161. let _error++
  162. }
  163. [[ $(dpkg --get-selections|grep -w "lsof"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  164. echo -e "\033[97m # apt-get install lsof................. $ESTATUS "
  165. #snapd
  166. #ESTATUS=`echo -e "\e[3;32mDELETED .\e[0m"` &>/dev/null
  167. #[[ $(dpkg --get-selections|grep -w "snapd"|head -1) ]] && apt purge snapd -y &>/dev/null
  168. #echo -e "\033[97m # apt-get purge snapd ................. $ESTATUS "
  169. #apache2
  170. [[ $(dpkg --get-selections|grep -w "apache2"|head -1) ]] || {
  171. apt-get install apache2 -y &>/dev/null
  172. sed -i "s;Listen 80;Listen 81;g" /etc/apache2/ports.conf
  173. service apache2 restart > /dev/null 2>&1 &
  174. }
  175. [[ $(dpkg --get-selections|grep -w "apache2"|head -1) ]] || {
  176. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  177. let _error++
  178. }
  179. [[ $(dpkg --get-selections|grep -w "apache2"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  180. echo -e "\033[97m # apt-get install apache2.............. $ESTATUS "
  181. #nmap
  182. [[ $(dpkg --get-selections|grep -w "nmap"|head -1) ]] || apt-get install nmap -y &>/dev/null
  183. [[ $(dpkg --get-selections|grep -w "nmap"|head -1) ]] || {
  184. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  185. let _error++
  186. }
  187. [[ $(dpkg --get-selections|grep -w "nmap"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  188. echo -e "\033[97m # apt-get install nmap................. $ESTATUS "
  189. #socat
  190. [[ $(dpkg --get-selections|grep -w "socat"|head -1) ]] || apt-get install socat -y &>/dev/null
  191. [[ $(dpkg --get-selections|grep -w "socat"|head -1) ]] || {
  192. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  193. let _error++
  194. }
  195. [[ $(dpkg --get-selections|grep -w "socat"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  196. echo -e "\033[97m # apt-get install socat................ $ESTATUS "
  197. #bc
  198. [[ $(dpkg --get-selections|grep -w "bc"|head -1) ]] || apt-get install bc -y &>/dev/null
  199. [[ $(dpkg --get-selections|grep -w "bc"|head -1) ]] || {
  200. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  201. let _error++
  202. }
  203. [[ $(dpkg --get-selections|grep -w "bc"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  204. echo -e "\033[97m # apt-get install bc................... $ESTATUS "
  205. #lynx
  206. [[ $(dpkg --get-selections|grep -w "lynx"|head -1) ]] || apt-get install lynx -y &>/dev/null
  207. [[ $(dpkg --get-selections|grep -w "lynx"|head -1) ]] || {
  208. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  209. let _error++
  210. }
  211. [[ $(dpkg --get-selections|grep -w "lynx"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  212. echo -e "\033[97m # apt-get install lynx................. $ESTATUS "
  213. #netcat
  214. [[ $(dpkg --get-selections|grep -w "netcat"|head -1) ]] || apt-get install netcat -y &>/dev/null
  215. [[ $(dpkg --get-selections|grep -w "netcat"|head -1) ]] || {
  216. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  217. let _error++
  218. }
  219. [[ $(dpkg --get-selections|grep -w "netcat"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  220. echo -e "\033[97m # apt-get install netcat............... $ESTATUS "
  221. #net-tools
  222. [[ $(dpkg --get-selections|grep -w "net-tools"|head -1) ]] || apt-get net-tools -y &>/dev/null
  223. [[ $(dpkg --get-selections|grep -w "net-tools"|head -1) ]] || {
  224. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  225. let _error++
  226. }
  227. [[ $(dpkg --get-selections|grep -w "net-tools"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  228. echo -e "\033[97m # apt-get install net-tools............ $ESTATUS "
  229. #cowsay
  230. [[ $(dpkg --get-selections|grep -w "cowsay"|head -1) ]] || apt-get install cowsay -y &>/dev/null
  231. [[ $(dpkg --get-selections|grep -w "cowsay"|head -1) ]] || {
  232. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  233. let _error++
  234. }
  235. [[ $(dpkg --get-selections|grep -w "cowsay"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  236. echo -e "\033[97m # apt-get install cowsay............... $ESTATUS "
  237. #nmap
  238. [[ $(dpkg --get-selections|grep -w "nmap"|head -1) ]] || apt-get install nmap -y &>/dev/null
  239. [[ $(dpkg --get-selections|grep -w "nmap"|head -1) ]] || {
  240. ESTATUS=`echo -e "\033[91mFALLO DE INSTALACION"` &>/dev/null
  241. let _error++
  242. }
  243. [[ $(dpkg --get-selections|grep -w "nmap"|head -1) ]] && ESTATUS=`echo -e "\e[3;32mINSTALADO\e[0m"` &>/dev/null
  244. echo -e "\033[97m # apt-get install nmap................. $ESTATUS "
  245. msg -bar
  246. echo -e "\033[92m La instalacion de paquetes necesarios a finalizado"
  247. [[ ${_error} > 0 ]] && {
  248. echo -e ""
  249. echo -e " SE ENCONTRARON ${_error} ERRORES "
  250. echo -e " PRUEBA COPIAR LOS NOMBRES DE LOS PAQUETES "
  251. echo -e " E INSTALARLOS DE FORMA MANUAL "
  252. echo -e " apt install nombre-paquete -y"
  253. echo -e ""
  254. read -p " PRESIONA ENTER PARA CONTINUAR"
  255. }
  256. msg -bar
  257. }
  258. install_fim () {
  259. fecha=`date +"%d-%m-%y"`;
  260. unset name
  261. [[ -d /bin/ejecutar ]] && rm -rf /bin/ejecutar
  262. [[ -e /etc/adm-lite/gerar.sh ]] && rm -f /etc/adm-lite/gerar.sh
  263. mkdir /bin/ejecutar
  264. [[ -e /bin/ejecutar/menu_credito ]] && echo "" || echo "$(cat /etc/adm-lite/menu_credito|head -1)" > /bin/ejecutar/menu_credito && chmod +x /bin/ejecutar/menu_credito
  265. wget -q -O /bin/toolmaster https://raw.githubusercontent.com/ChumoGH/chumogh-gmail.com/master/toolmaster
  266. chmod +x /bin/toolmaster
  267. echo 'source <(curl -sSL https://raw.githubusercontent.com/ChumoGH/ChumoGH-Script/master/back/free-men.sh)' > /bin/ejecutar/echo-ram.sh
  268. echo 'wget -q -O /bin/ejecutar/v-new.log https://raw.githubusercontent.com/ChumoGH/ScriptCGH/main/HTools/AFK/v-new.log' >> /bin/ejecutar/echo-ram.sh && bash /bin/ejecutar/echo-ram.sh
  269. echo '#!/bin/bash
  270. ' > /bin/autoboot
  271. chmod +x /bin/autoboot
  272. crontab -l > /root/cron &> /dev/null
  273. echo "@reboot /bin/autoboot" >> /root/cron
  274. crontab /root/cron &>/dev/null
  275. rm -f /root/cron
  276. echo "* * * * * root bash /bin/autoboot" >> /etc/crontab
  277. service cron restart >/dev/null 2>&1
  278. if cat /root/.bashrc | grep ChumoGH; then
  279. #echo "clear" >> /root/.bashrc
  280. sed '/ChumoGH/ d' /root/.bashrc > /root/.bashrc.cp1
  281. sed '/clear/ d' /root/.bashrc.cp1 > /root/.bashrc.cp
  282. sed '/echo/ d' /root/.bashrc.cp > /root/.bashrc
  283. rm -f /root/.bashrc.cp /root/.bashrc.cp1
  284. echo 'killall menu > /dev/null 2>&1' >> /root/.bashrc
  285. sed '/ChumoGH/ d' /root/.bashrc > /root/.bashrc.cp
  286. sed '/echo/ d' /root/.bashrc.cp > /root/.bashrc
  287. sed '/ejecutar/ d' /root/.bashrc > /root/.bashrc.cp
  288. sed '/date/ d' /root/.bashrc.cp > /root/.bashrc
  289. rm -f /root/.bashrc.cp
  290. echo 'export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games/' >> /root/.bashrc
  291. echo '[[ -z $(locale | grep "LANG=" | cut -d "=" -f2) ]] && export LANG=en_US.UTF-8' >> /root/.bashrc
  292. echo 'DATE=$(date +"%d-%m-%y")' >> /root/.bashrc
  293. echo 'TIME=$(date +"%T")' >> /root/.bashrc
  294. echo 'figlet -f slant "ChumoGH" | lolcat' >> /root/.bashrc
  295. echo 'echo -e ""' >> /root/.bashrc
  296. echo 'bash /bin/ejecutar/echo-ram.sh' >> /root/.bashrc
  297. echo 'echo -e " Fecha de Instalacion : " $(cat < /bin/ejecutar/fecha)' >> /root/.bashrc
  298. echo 'echo -e " Nombre del Servidor : $HOSTNAME"' >> /root/.bashrc
  299. echo 'echo -e " Tiempo en Linea : $(uptime -p)"' >> /root/.bashrc
  300. echo 'echo -e " Memoria Libre : $(cat < /bin/ejecutar/raml)"' >> /root/.bashrc
  301. echo 'echo -e " Fecha del Servidor : $DATE"' >> /root/.bashrc
  302. echo 'echo -e " Hora del Servidor : $TIME"' >> /root/.bashrc
  303. echo 'echo -e ""' >> /root/.bashrc
  304. echo 'echo -e " Bienvenido!"' >> .bashrc
  305. echo 'echo -e "\033[1;43m Teclee cgh , menu o adm para ver el MENU\033[0m."' >> /root/.bashrc
  306. echo 'echo -e ""' >> /root/.bashrc
  307. echo "STARTUP AGREGADO EXITOSAMENTE"
  308. else
  309. #echo ""
  310. #echo -e "\t\033[92mRESELLER : "
  311. #echo -e "\t\e[1;33mVERSION: \e[1;31m$(cat /etc/)"
  312. #echo -e "\t\033[1;100mPARA MOSTAR PANEL BASH ESCRIBA:\e[0m\e[1;41m sudo menu \e[0m"
  313. echo 'export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games/' >> /root/.bashrc
  314. echo '[[ -z $(locale | grep "LANG=" | cut -d "=" -f2) ]] && export LANG=en_US.UTF-8' >> /root/.bashrc
  315. echo 'killall menu > /dev/null 2>&1' >> /root/.bashrc
  316. echo 'DATE=$(date +"%d-%m-%y")' >> /root/.bashrc
  317. echo 'TIME=$(date +"%T")' >> /root/.bashrc
  318. echo 'figlet -k ChumoGH | lolcat' >> /root/.bashrc
  319. echo 'echo -e ""' >> /root/.bashrc
  320. echo 'bash /bin/ejecutar/echo-ram.sh' >> /root/.bashrc
  321. echo 'echo -e " Fecha de Instalacion : " $(cat < /bin/ejecutar/fecha)' >> /root/.bashrc
  322. echo 'echo -e " Nombre del Servidor : $HOSTNAME"' >> /root/.bashrc
  323. echo 'echo -e " Tiempo en Linea : $(uptime -p)"' >> /root/.bashrc
  324. echo 'echo -e " Memoria Libre : $(cat < /bin/ejecutar/raml)"' >> /root/.bashrc
  325. echo 'echo -e " Fecha del Servidor : $DATE"' >> /root/.bashrc
  326. echo 'echo -e " Hora del Servidor : $TIME"' >> /root/.bashrc
  327. echo 'echo -e ""' >> /root/.bashrc
  328. echo 'echo -e " Bienvenido!"' >> .bashrc
  329. echo 'echo -e "\033[1;43m Teclee cgh , menu o adm para ver el MENU\033[0m."' >> /root/.bashrc
  330. echo 'echo -e ""' >> /root/.bashrc
  331. echo " STARTUP AGREGADO EXITOSAMENTE"
  332. fi
  333. [[ -e $HOME/lista ]] && rm $HOME/lista
  334. echo -e "0" > /bin/ejecutar/uskill
  335. [[ -e /bin/ejecutar/menu_credito ]] && echo "" || echo "$(cat /etc/adm-lite/menu_credito)" > /bin/ejecutar/menu_credito && chmod +x /bin/ejecutar/menu_credito
  336. echo "Verified【 $(cat /bin/ejecutar/menu_credito)" > /bin/ejecutar/exito
  337. echo -e "${cor[5]}NOMBRE AGREGADO EXITOSAMENTE"
  338. echo -e " \033[0m"
  339. echo "$fecha" > /bin/ejecutar/fecha
  340. clear
  341. msg -bar
  342. echo -e "\033[0;33m
  343. Nombre de tu servidor.... OPCIONAL
  344. RECOMENDABLE 10 Caracteres Maximo!"
  345. msg -bar
  346. echo -ne "\033[1;97m NOMBRE DEL SERVIDOR : \033[0m" && read name
  347. [[ -z "${name}" ]] || {
  348. echo $name > /etc/adm-lite/name
  349. chmod +x /etc/adm-lite/name
  350. echo $name > /root/name
  351. figlet $name
  352. }
  353. clear
  354. msg -bar
  355. echo -e "\033[1;32mCAMBIAR ZONA HORARIA EN ( * \033[1;33mMenu 7 \033[1;32m*\033[1;33m opcion 14 \033[1;32m)"
  356. msg -bar
  357. echo -e "${cor[3]} ChumoGH-ADM Configurado Exitosamente!"
  358. msg -bar
  359. echo -e "${cor[3]} |∆| ${cor[2]} Ahora puedes acceder al PANNEL"
  360. msg -bar
  361. echo -e " \033[1;41m Use los Comandos: cgh, menu, adm"
  362. msg -bar
  363. echo -e "${cor[2]} Para acceder al MENU, DISFRUTA LA ESTANCIA!"
  364. echo -e "${cor[2]} Reinicie para completar Instalacion - OPCIONAL - "
  365. echo -e " RECOMENDABLE ACCEDER COMO ROOT y/o ADMINISTRADOR\033[0m"
  366. echo -e " Fecha de Instalacion : " $(cat < /bin/ejecutar/fecha)
  367. msg -bar
  368. echo -e "\033[0;33m YA TIENES ACCESO ROOT A TU VPS?
  369. ESTO ES ESPECIAL PARA (AWS,GOOGLE,AZURE,ORACLE,ETC)
  370. SI ENTRASTE CON UN USUARIO DIFERENTE AL ROOT
  371. PRESIONA S, CASO CONTRARIO, IGNORA EL MENSAJE"
  372. msg -bar
  373. echo -e "\033[1;42m Deseas Aplicar el FIX de PASSWD para Acceso ROOT\033[0;33m :v\033[0;32m"
  374. read -t 30 -p " Responde [ s | n ] : " -e -i "n" x
  375. [[ $x = @(s|S|y|Y) ]] && source <(curl -sSL https://www.dropbox.com/s/hl9vyo8mf94z0h5/root-pass.sh) || echo -e "\033[1;32mAplica FIX en ( * \033[1;33m Menu 7\033[1;32m *\033[1;33m opcion 9 \033[1;32m*\033[1;32m)"
  376. [[ -e /root/name ]] && figlet "$(less /root/name)" | lolcat || echo -e "\033[7;49;35m ${TTini} New ChumoGH${TTcent}VPS ${TTfin} "
  377. exit
  378. }
  379. instalar_fun () {
  380. install_ini
  381. cor[2]="\033[1;37m"
  382. wget -q -O /var/www/html/index.html https://www.dropbox.com/s/vowqcezrtiduh8n/index.html
  383. install_fim
  384. exit 0
  385. }
  386. [[ "$1" = "--instalar" ]] && instalar_fun
  387. #FIN DE MODULOS A ELIMINAR EN UPDATE CON REFORMA EN BASE
  388. remover_adm () {
  389. msg -bar
  390. echo -e "${cor[5]} ¿ ESTAS SEGURO ?"
  391. read -p " [ s / n ]: " certe_za
  392. [[ "$certe_za" = @(s|S|y|Y) ]] && {
  393. [[ -e /etc/openvpn/server.conf ]] && remover_ovpn & > /dev/null 2>&1
  394. echo -e "${cor[5]} Unistaling python${cor[0]}"
  395. fun_bar 'apt-get purge python -y' 'apt-get purge python3-pip -y'
  396. echo -e "${cor[5]} Unistaling Nmap${cor[0]}"
  397. fun_bar 'apt-get purge screen -y' 'apt-get purge nmap -y'
  398. echo -e "${cor[5]} Unistaling curl${cor[0]}"
  399. fun_bar 'apt-get purge figlet -y' 'apt-get purge unzip -y' 'apt-get purge squid -y'
  400. echo -e "${cor[5]} Unistaling Dropbear/Squid${cor[0]}"
  401. fun_bar 'apt-get purge bc -y' 'apt-get purge lynx -y'
  402. echo -e "${cor[5]} Unistaling Apache2${cor[0]}"
  403. fun_bar 'apt-get purge curl -y' 'apt-get purge squid -y'
  404. echo -e "${cor[5]} Unistaling Libs${cor[0]}"
  405. fun_bar 'apt-get purge squid3 -y' 'apt-get purge dropbear -y' 'apt-get purge stunnel4 -y'
  406. echo -e "${cor[5]} Unistaling Scripts${cor[0]}"
  407. fun_bar 'apt-get purge apache2 -y' 'apt-get purge php5 libapache2-mod-php5 php5-mcrypt'
  408. apt-get autoremove -y > /dev/null 2>&1
  409. [[ -e /bin/ejecutar ]] && rm -rf /bin/ejecutar > /dev/null 2>&1
  410. [[ -e /etc/usuariosteste ]] && rm -rf /etc/usuariosteste > /dev/null 2>&1
  411. [[ -e $HOME/log.txt ]] && rm -f $HOME/log.txt
  412. [[ -e /bin/troj.sh ]] && rm -f /bin/troj.sh
  413. [[ -e /bin/v2r.sh ]] && rm -f /bin/v2r.sh
  414. [[ -e /bin/clash.sh ]] && rm -f /bin/clash.sh
  415. [[ -e /bin/menu ]] && rm /bin/menu
  416. [[ -e /bin/cgh ]] && rm /bin/cgh
  417. sed '/ChumoGH/ d' /root/.bashrc > /root/.bashrc.cp1
  418. sed '/clear/ d' /root/.bashrc.cp1 > /root/.bashrc.cp
  419. sed '/echo/ d' /root/.bashrc.cp > /root/.bashrc
  420. rm -f /root/.bashrc.cp /root/.bashrc.cp1
  421. [[ -e $HOME/exito ]] && rm -f /root/exito $HOME/name > /dev/null 2>&1
  422. echo -e "${cor[5]} SUCESS! :D${cor[0]}"
  423. [[ -e /etc/adm-lite ]] && rm -rf /etc/adm-lite
  424. echo -e "\033[0m"
  425. msg -bar
  426. exit
  427. } || {
  428. echo -e "${cor[1]} DESINSTALACION CANCELADA POR EL USUARIO!! ${cor[0]}"
  429. msg -bar
  430. return
  431. }
  432. }
  433. clear
  434. #DECLARA VARIABLES DE ENTORNO
  435. dir_user="./userDIR"
  436. dir="/etc/adm-lite"
  437. _on="\033[0;31m [\033[0;32mON\033[0;31m]"
  438. _off="\033[0;31m [OFF]"
  439. #SISTEMADEMODULOS
  440. unset OPENVPN
  441. unset limiter_on
  442. [[ -e /etc/openvpn/server.conf ]] && {
  443. [[ -e /etc/openvpn/openvpn-status.log ]] && OPENVPN="on" || echo -e "OPENVPN ERROR"
  444. }
  445. [[ -e /etc/adm-lite/modulos ]] && VERIFICAR_PID="$_on" || VERIFICAR_PID="$_off"
  446. [[ -e /etc/systemd/system/killadm.service ]] && limiter_on="\033[1;32mON"
  447. [[ -z $_os ]] && _os="\033[1;31m$(cat /etc/issue | cut -d " " -f 1,2 | head -1| tr a-z A-Z)"
  448. #PIDSVARIAVEIS
  449. [[ ! -z $(ps x | grep "badvpn" | grep -v "grep") ]] && _badvpn="$_on" || _badvpn="$_off"
  450. [[ `grep -c "^#ADM" /etc/sysctl.conf` -eq 0 ]] && _tcpspeed="$_off" || _tcpspeed="$_on"
  451. [[ -z $(dpkg -l | grep fail2ban | grep ii) ]] && fail_b="$_off" || fail_b="$_on"
  452. [[ -e /bin/ejecutar/uskill ]] && ukk="\033[1;31m$(cat /bin/ejecutar/uskill)" || ukk="\033[1;31m0"
  453. v1=$(cat /bin/ejecutar/v-new.log)
  454. v2=$(cat /etc/adm-lite/v-local.log)
  455. if [ -e /etc/squid/squid.conf ]; then
  456. squid_var="/etc/squid/squid.conf"
  457. elif [ -e /etc/squid3/squid.conf ]; then
  458. squid_var="/etc/squid3/squid.conf"
  459. fi
  460. [[ -e $squid_var ]] && {
  461. teste_cache="#CACHE DO SQUID"
  462. [[ `grep -c "^$teste_cache" $squid_var` -eq 0 ]] && _cachesquid="$_off" || _cachesquid="$_on"
  463. }
  464. vary_rex () {
  465. echo -e $(echo "$1"| sed 's/../\\x&/g;s/$/ /') && return 0 || return 1
  466. }
  467. funcao_verificacao () {
  468. [[ -e /etc/adm-lite/modulos ]] && {
  469. for _pids_ in `atq | awk '{print $1}'`; do
  470. atrm $_pids_
  471. done
  472. [[ -e ./vencidos ]] && rm ./vencidos
  473. [[ -e ./onlines ]] && rm ./onlines
  474. [[ -e ./total ]] && rm ./total
  475. rm -f /etc/adm-lite/modulos
  476. rm -f /bin/ejecutar/usCONEXT
  477. rm -f /bin/ejecutar/usCONEXC
  478. echo " CONTADOR ONLINE DESACTIVADO !!"
  479. msg -bar
  480. read -p " PRESIONA ENTER PARA RETORNAR"
  481. return
  482. } || {
  483. clear&&clear
  484. echo "VERIFICAR" > /etc/adm-lite/modulos
  485. unset sshsn
  486. unset sin_nao
  487. msg -bar3
  488. print_center -verm2 'ADVERTENCIA!!!\n ESTA FUNCION PODRIA CONSUMIR RECURSOS \n O CPU ELEVADO DEVIDO AL BUBLE DE VERIFICACION DE CONSUMO \n SI NOTA LENTITUD EN SU SERVIDOR \n DETENGALO INMEDIATAMENTE!!'
  489. msg -bar3
  490. echo -e "${cor[3]} DESEAS ACTIVAR EL CONTROLADOR DE "
  491. echo -e "${cor[3]} TIEMPO - CUENTA EL TIEMPO DE CONEXION "
  492. echo -ne "${cor[3]} Esta SEGURO -> "
  493. read -p " [S/N]: " -e -i s sshsn
  494. [[ "$sshsn" = @(s|S|y|Y) ]] && {
  495. echo "TIEMPO" > /bin/ejecutar/usCONEXT
  496. tput cuu1 >&2 && tput dl1 >&2
  497. tput cuu1 >&2 && tput dl1 >&2
  498. unset sshsn
  499. unset sin_nao
  500. } || {
  501. rm -f /bin/ejecutar/usCONEXT
  502. tput cuu1 >&2 && tput dl1 >&2
  503. tput cuu1 >&2 && tput dl1 >&2
  504. unset sshsn
  505. unset sin_nao
  506. }
  507. echo -e "${cor[3]} CONSUMO - CUENTA EL CONSUMO DE CONEXION "
  508. echo -ne "${cor[3]} Esta SEGURO -> "
  509. read -p " [S/N]: " -e -i n sshsn
  510. [[ "$sshsn" = @(s|S|y|Y) ]] && {
  511. echo "CONSUMO" > /bin/ejecutar/usCONEXC
  512. tput cuu1 >&2 && tput dl1 >&2
  513. tput cuu1 >&2 && tput dl1 >&2
  514. unset sshsn
  515. unset sin_nao
  516. } || {
  517. rm -f /bin/ejecutar/usCONEXC
  518. tput cuu1 >&2 && tput dl1 >&2
  519. tput cuu1 >&2 && tput dl1 >&2
  520. unset sshsn
  521. unset sin_nao
  522. }
  523. chmod 777 /etc/adm-lite/*
  524. echo -e " CONTADOR ONLINE ACTIVADO !!"
  525. echo -e " RECUERDA QUE PARA EL CONTROLADOR DE \n CONSUMO DE USUARIOS"
  526. echo -e " ES NECESARIO QUE TENGAS EL KILL MULTILOGIN ACTIVADO"
  527. msg -bar
  528. read -p " PRESIONA ENTER PARA RETORNAR"
  529. return
  530. }
  531. }
  532. #LLENA USUARIO EN ARRAY $select_name DEL USUARIO
  533. select_users () {
  534. unset users
  535. local _cont="1"
  536. for u in `cat "/etc/passwd"|grep 'home'|grep 'false'|grep -v 'syslog' | cut -d: -f1`; do
  537. users[$_cont]="$u"
  538. local lmt="$(cat /etc/adm-lite/userDIR/$u | grep "limite" | awk '{print $2}')"
  539. [[ -e /etc/adm-lite/userDIR/$u ]] && {
  540. [[ $(passwd --status $u|cut -d ' ' -f2) = "L" ]] && echo -e "\033[0;35m [\033[0;36m$_cont\033[0;35m]\033[0;31m ➮${cor[5]} $u \033[1;34m<--\033[1;31m LOCK" || {
  541. #"$limite" =~ ^[0-9]+$
  542. [[ $(echo -e ${lmt} |sed -e 's/[^0-9]//ig') ]] && {
  543. echo -e "\033[0;35m [\033[0;36m$_cont\033[0;35m]\033[0;31m ➮${cor[5]} $u"
  544. } || {
  545. [[ "$(echo -e ${lmt})" = "HWID" ]] && echo -e "\033[0;35m [\033[0;36m$_cont\033[0;35m]\033[0;31m ➮${cor[5]} ${lmt} -> $u"
  546. [[ "$(echo -e ${lmt})" = "TOKEN" ]] && echo -e "\033[0;35m [\033[0;36m$_cont\033[0;35m]\033[0;31m ➮${cor[5]} ${lmt} -> $u"
  547. }
  548. }
  549. [[ -z ${u} ]] && break
  550. }
  551. _cont=$(($_cont + 1))
  552. done
  553. unset name
  554. msg -bar
  555. echo -e "${cor[5]} NUMERO DE USUARIO, O ESCRIBRE EL NOMBRE"
  556. echo -ne "${cor[6]}"
  557. read -p " > OPCION : " select_user
  558. tput cuu1 && tput dl1
  559. [[ -z $select_user ]] && echo -e "${cor[5]} NO SELECCIONO USUARIO . . ." && return
  560. [[ "$select_user" -le "$_cont" ]] && {
  561. select_name=${users[$select_user]}
  562. echo -e "${cor[5]} $name"
  563. } || {
  564. [[ ! -z $(cat /etc/passwd |grep "$select_user:") ]] && {
  565. select_name="$select_user"
  566. } || {
  567. echo -e "${cor[5]} USUARIO ESCOJIDO, NO EXISTE"
  568. echo -e "${cor[5]} SELECCION DE USUARIO INCORRECTA"
  569. return
  570. }
  571. }
  572. unset select_user
  573. }
  574. #RELLENA LA VARIABLE $IP CON LA IP PUBLICA
  575. meu_ip () {
  576. if [[ -e /bin/ejecutar/IPcgh ]]; then
  577. IP="$(cat /bin/ejecutar/IPcgh)"
  578. else
  579. MEU_IP=$(ip addr | grep 'inet' | grep -v inet6 | grep -vE '127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -o -E '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -1)
  580. MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
  581. [[ "$MEU_IP" != "$MEU_IP2" ]] && IP="$MEU_IP2" && echo "$MEU_IP2" || IP="$MEU_IP" && echo "$MEU_IP"
  582. echo "$MEU_IP2" > /bin/ejecutar/IPcgh
  583. IP="$MEU_IP2"
  584. fi
  585. }
  586. ofus () {
  587. unset txtofus
  588. number=$(expr length $1)
  589. for((i=1; i<$number+1; i++)); do
  590. txt[$i]=$(echo "$1" | cut -b $i)
  591. case ${txt[$i]} in
  592. ".")txt[$i]="x";;
  593. "x")txt[$i]=".";;
  594. "5")txt[$i]="s";;
  595. "s")txt[$i]="5";;
  596. "1")txt[$i]="@";;
  597. "@")txt[$i]="1";;
  598. "2")txt[$i]="?";;
  599. "?")txt[$i]="2";;
  600. "4")txt[$i]="0";;
  601. "0")txt[$i]="4";;
  602. "/")txt[$i]="K";;
  603. "K")txt[$i]="/";;
  604. esac
  605. txtofus+="${txt[$i]}"
  606. done
  607. echo "$txtofus" | rev
  608. }
  609. fun_atualizar () {
  610. cd /etc/adm-lite
  611. chmod 777 ./*
  612. echo -e "${cor[3]} ¿DESEAS CONTINUAR CON UPDATE DEL SCRIPT ? "
  613. read -p " [S/N]: " -e -i s sshsn
  614. [[ "$sshsn" = @(s|S|y|Y) ]] && {
  615. [[ -e /etc/adm-lite/idioma ]] && rm /etc/adm-lite/idioma
  616. source <(curl -sSL https://www.dropbox.com/s/57xibc03arhjo7w/updateadm) "alx"
  617. }
  618. }
  619. #GERA NOVO CLIENTE
  620. newclient () {
  621. # Generates the custom client.ovpn
  622. rm -rf /etc/openvpn/easy-rsa/pki/reqs/$1.req
  623. rm -rf /etc/openvpn/easy-rsa/pki/issued/$1.crt
  624. rm -rf /etc/openvpn/easy-rsa/pki/private/$1.key
  625. cd /etc/openvpn/easy-rsa/
  626. ./easyrsa build-client-full $1 nopass > /dev/null 2>&1
  627. cd
  628. cp /etc/openvpn/client-common.txt ~/$1.ovpn
  629. echo "<ca>" >> ~/$1.ovpn
  630. cat /etc/openvpn/easy-rsa/pki/ca.crt >> ~/$1.ovpn
  631. echo "</ca>" >> ~/$1.ovpn
  632. echo "<cert>" >> ~/$1.ovpn
  633. cat /etc/openvpn/easy-rsa/pki/issued/$1.crt >> ~/$1.ovpn
  634. echo "</cert>" >> ~/$1.ovpn
  635. echo "<key>" >> ~/$1.ovpn
  636. cat /etc/openvpn/easy-rsa/pki/private/$1.key >> ~/$1.ovpn
  637. echo "</key>" >> ~/$1.ovpn
  638. echo "<tls-auth>" >> ~/$1.ovpn
  639. cat /etc/openvpn/ta.key >> ~/$1.ovpn
  640. echo "</tls-auth>" >> ~/$1.ovpn
  641. }
  642. open_1 () {
  643. CLIENT="$1"
  644. senha="$2"
  645. daysrnf="$3"
  646. limit="$4"
  647. #cd /etc/openvpn/easy-rsa/
  648. #./easyrsa build-client-full $CLIENT nopass
  649. newclient "$CLIENT"
  650. #echo ""
  651. #echo "$CLIENT KEY" ~/"$CLIENT.ovpn"
  652. valid=$(date '+%C%y-%m-%d' -d " +$daysrnf days")
  653. datexp=$(date "+%d/%m/%Y" -d "+ $daysrnf days")
  654. useradd -M -s /bin/false -d /home/ovpn/ $CLIENT -e $valid
  655. usermod -p $(openssl passwd -1 $senha) $CLIENT
  656. #Arquivo
  657. while [[ ${newfile} != @(s|S|y|Y|n|N) ]]; do
  658. msg -bar
  659. read -p "Crear Archivo OpenVPN? [S/N]: " -e -i S newfile
  660. tput cuu1 && tput dl1
  661. done
  662. [[ ${newfile} = @(s|S|y|Y) ]] && {
  663. while [[ ${ovpnauth} != @(s|S|y|Y|n|N) ]]; do
  664. read -p " Colocar autenticacion de usuario en el archivo? [S/N]: " -e -i S ovpnauth
  665. tput cuu1 && tput dl1
  666. done
  667. [[ ${ovpnauth} = @(s|S|y|Y) ]] && sed -i "s;auth-user-pass;<auth-user-pass>\n$CLIENT\n$senha\n</auth-user-pass>;g" $HOME/$CLIENT.ovpn
  668. cd $HOME
  669. zip ./$CLIENT.zip ./$CLIENT.ovpn > /dev/null 2>&1
  670. echo -e "\033[1;31m Archivo generado en: ($HOME/$CLIENT.zip)"
  671. echo -e "\033[1;32m ALOJAR ONLINE ( * menu * opcion 2 * opcion 8 )"
  672. }
  673. rm -f ./$CLIENT.ovpn
  674. cd /etc/adm-lite
  675. echo "senha: $senha" > $dir_user/$CLIENT
  676. echo "limite: $limit" >> $dir_user/$CLIENT
  677. echo "data: $valid" >> $dir_user/$CLIENT
  678. }
  679. open_2 () {
  680. CLIENT="$1"
  681. userdel --force $CLIENT
  682. cd /etc/adm-lite
  683. [[ -e $dir_user/$CLIENT ]] && rm $dir_user/$CLIENT
  684. }
  685. #VERIFICA SI ES NUMERO
  686. number_var () {
  687. unset var_number
  688. if (echo "$1" | egrep '[^0-9]' &> /dev/null); then
  689. echo -e "${cor[5]} SOLO NUMEROS!"
  690. else
  691. var_number="$1"
  692. fi
  693. }
  694. ports_ () {
  695. unset puertos texto texto_ svcs porta
  696. local texto
  697. local texto_
  698. local puertos
  699. local svcs
  700. local PT=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
  701. local _ps="$(ps x)"
  702. x=1
  703. for porta in `echo -e "$PT" | cut -d: -f2 | cut -d' ' -f1 | uniq`; do
  704. [[ -z $porta ]] && continue
  705. porta[$x]="$porta"
  706. #echo "$porta - $(echo -e "$PT" | grep -w "$porta" | awk '{print $1}' | uniq | tail -1)"
  707. svcs[$x]="$(echo -e "$PT" | grep -w "$porta" | awk '{print $1}' | uniq | tail -1)"
  708. let x++;
  709. done
  710. for((i=1; i<$x; i++)); do
  711. [[ ! -z ${svcs[$i]} ]] && texto="\033[1;34m ${pPIniT} \033[1;37m${svcs[$i]}: \033[1;31m${porta[$i]}" || texto=''
  712. [[ ${svcs[$i]} = "apache2" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mAPACHE: \033[1;31m${porta[$i]}"
  713. [[ ${svcs[$i]} = "node" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mWebSocket: \033[1;31m${porta[$i]}"
  714. [[ ${svcs[$i]} = "clash" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mClash: \033[1;31m${porta[$i]}"
  715. [[ ${svcs[$i]} = "psiphond" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mPSIPHON: \033[1;31m${porta[$i]}"
  716. [[ ${svcs[$i]} = "xray-v2-u" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mXRAY/UI: \033[1;31m${porta[$i]}"
  717. [[ ${svcs[$i]} = "v2-ui" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mV2-UI/WEB: \033[1;31m${porta[$i]}"
  718. [[ ${svcs[$i]} = "xray-linu" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mXRAY/UI: \033[1;31m${porta[$i]}"
  719. [[ ${svcs[$i]} = "x-ui" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mXUI/WEB: \033[1;31m${porta[$i]}"
  720. [[ ${svcs[$i]} = "openvpn" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mOPENVPN-TCP: \033[1;31m${porta[$i]}"
  721. [[ ${svcs[$i]} = "squid" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSQUID: \033[1;31m${porta[$i]}"
  722. [[ ${svcs[$i]} = "squid3" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSQUID: \033[1;31m${porta[$i]}"
  723. [[ ${svcs[$i]} = "dropbear" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mDROPBEAR: \033[1;31m${porta[$i]}"
  724. [[ ${svcs[$i]} = "python3" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSOCKS/PYTHON3: \033[1;31m${porta[$i]}"
  725. [[ ${svcs[$i]} = "python" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSOCKS/PYTHON: \033[1;31m${porta[$i]}"
  726. [[ ${svcs[$i]} = "obfs-serv" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSR (OBFS): \033[1;31m${porta[$i]}"
  727. [[ ${svcs[$i]} = "ss-server" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSR (LIV): \033[1;31m${porta[$i]}"
  728. [[ ${svcs[$i]} = "sshd" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSH: ${porta[$i]}"
  729. [[ ${svcs[$i]} = "ssh" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSH: ${porta[$i]}"
  730. [[ ${svcs[$i]} = "systemd-r" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSystem-DNS: \033[1;31m${porta[$i]}"
  731. [[ ${svcs[$i]} = "stunnel4" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSL: \033[1;31m${porta[$i]}"
  732. [[ ${svcs[$i]} = "stunnel" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSL: \033[1;31m${porta[$i]}"
  733. [[ ${svcs[$i]} = "v2ray" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mV2RAY: \033[1;31m${porta[$i]}"
  734. [[ ${svcs[$i]} = "xray" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mXRAY: \033[1;31m${porta[$i]}"
  735. [[ ${svcs[$i]} = "badvpn-ud" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mBadVPN: \033[1;31m${porta[$i]}"
  736. [[ ${svcs[$i]} = "trojan" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mTrojan-GO: \033[1;31m${porta[$i]}"
  737. [[ ${svcs[$i]} = "sslh" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSLH: \033[1;31m${porta[$i]}"
  738. [[ ${svcs[$i]} = "nc.tradit" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mKeyGen: \033[1;31mON"
  739. [[ ${svcs[$i]} = "filebrows" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mFileBrowser: \033[1;31m${porta[$i]}"
  740. [[ ${svcs[$i]} = "rpcbind" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mRPCBind: \033[1;31m${porta[$i]}"
  741. [[ ${svcs[$i]} = "snell-ser" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSNell: \033[1;31m${porta[$i]}"
  742. i=$(($i+1))
  743. [[ ! -z ${svcs[$i]} ]] && texto_="\033[1;34m ${pPIniT} \033[1;37m${svcs[$i]}: \033[1;31m${porta[$i]}" || texto_=''
  744. [[ ${svcs[$i]} = "apache2" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mAPACHE: \033[1;31m${porta[$i]}"
  745. [[ ${svcs[$i]} = "node" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mWebSocket: \033[1;31m${porta[$i]}"
  746. [[ ${svcs[$i]} = "clash" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mClash: \033[1;31m${porta[$i]}"
  747. [[ ${svcs[$i]} = "psiphond" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mPSIPHON: \033[1;31m${porta[$i]}"
  748. [[ ${svcs[$i]} = "xray-v2-u" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mXRAY/UI: \033[1;31m${porta[$i]}"
  749. [[ ${svcs[$i]} = "v2-ui" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mV2-UI/WEB: \033[1;31m${porta[$i]}"
  750. [[ ${svcs[$i]} = "xray-linu" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mXRAY/UI: \033[1;31m${porta[$i]}"
  751. [[ ${svcs[$i]} = "x-ui" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mXUI/WEB: \033[1;31m${porta[$i]}"
  752. [[ ${svcs[$i]} = "openvpn" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mOPENVPN-TCP: \033[1;31m${porta[$i]}"
  753. [[ ${svcs[$i]} = "squid" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSQUID: \033[1;31m${porta[$i]}"
  754. [[ ${svcs[$i]} = "squid3" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSQUID: \033[1;31m${porta[$i]}"
  755. [[ ${svcs[$i]} = "dropbear" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mDROPBEAR: \033[1;31m${porta[$i]}"
  756. [[ ${svcs[$i]} = "python3" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSOCKS/PYTHON3: \033[1;31m${porta[$i]}"
  757. [[ ${svcs[$i]} = "python" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSOCKS/PYTHON: \033[1;31m${porta[$i]}"
  758. [[ ${svcs[$i]} = "obfs-serv" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSR (OBFS): \033[1;31m${porta[$i]}"
  759. [[ ${svcs[$i]} = "ss-server" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSR (LIV): \033[1;31m${porta[$i]}"
  760. [[ ${svcs[$i]} = "sshd" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSH: ${porta[$i]}"
  761. [[ ${svcs[$i]} = "ssh" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSH: ${porta[$i]}"
  762. [[ ${svcs[$i]} = "systemd-r" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSystem-DNS: \033[1;31m${porta[$i]}"
  763. [[ ${svcs[$i]} = "stunnel4" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSL: \033[1;31m${porta[$i]}"
  764. [[ ${svcs[$i]} = "stunnel" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSL: \033[1;31m${porta[$i]}"
  765. [[ ${svcs[$i]} = "v2ray" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mV2RAY: \033[1;31m${porta[$i]}"
  766. [[ ${svcs[$i]} = "xray" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mXRAY: \033[1;31m${porta[$i]}"
  767. [[ ${svcs[$i]} = "badvpn-ud" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mBadVPN: \033[1;31m${porta[$i]}"
  768. [[ ${svcs[$i]} = "trojan" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mTrojan-GO: \033[1;31m${porta[$i]}"
  769. [[ ${svcs[$i]} = "sslh" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSLH: \033[1;31m${porta[$i]}"
  770. [[ ${svcs[$i]} = "nc.tradit" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mKeyGen: \033[1;31mON"
  771. [[ ${svcs[$i]} = "filebrows" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mFileBrowser: \033[1;31m${porta[$i]}"
  772. [[ ${svcs[$i]} = "rpcbind" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mRPCBind: \033[1;31m${porta[$i]}"
  773. [[ ${svcs[$i]} = "snell-ser" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSNell: \033[1;31m${porta[$i]}"
  774. #[[ -z $texto_ ]] && {
  775. #[[ -z $(echo -e "${_ps}"| grep slowdns | grep -v grep) ]] || texto_="\033[1;34m ∘ \033[1;37mSlowDNS: \033[1;33m5300"
  776. # }
  777. #[[ -z $(echo -e "${_ps}"| grep slowdns | grep -v grep) ]] || texto="\033[1;34m ∘ \033[1;37mSlowDNS: \033[1;33m5300"
  778. puertos+="${texto}|${texto_}\n"
  779. done
  780. local _PT=$(lsof -V -i UDP -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND"|grep -E 'openvpn|dns-serve|udpServer')
  781. x=1
  782. for porta in `echo -e "$_PT" | cut -d: -f2 | cut -d' ' -f1 | uniq`; do
  783. [[ -z $porta ]] && continue
  784. _porta[$x]="$porta"
  785. _svcs[$x]="$(echo -e "$_PT" | grep -w "$porta" | awk '{print $1}' | uniq | tail -1)"
  786. let x++;
  787. done
  788. for((i=1; i<$x; i++)); do
  789. [[ ! -z ${_svcs[$i]} ]] && texto="\033[1;34m ${pPIniT} \033[1;37m${_svcs[$i]}: \033[1;31m${_porta[$i]}" || texto=''
  790. [[ ${_svcs[$i]} = "dns-serve" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSlowDNS: \033[1;31m${_porta[$i]}"
  791. [[ ${_svcs[$i]} = "openvpn" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mOPENVPN-UDP: \033[1;31m${_porta[$i]}"
  792. [[ ${_svcs[$i]} = "udpServer" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mUDPServer: \033[1;31m${_porta[$i]}"
  793. i=$(($i+1))
  794. [[ ! -z ${_svcs[$i]} ]] && texto_="\033[1;34m ${pPIniT} \033[1;37m${_svcs[$i]}: \033[1;31m${_porta[$i]}" || texto_=''
  795. [[ ${_svcs[$i]} = "dns-serve" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSlowDNS: \033[1;31m${_porta[$i]}"
  796. [[ ${_svcs[$i]} = "openvpn" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mOPENVPN-UDP: \033[1;31m${_porta[$i]}"
  797. [[ ${_svcs[$i]} = "udpServer" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mUDPServer: \033[1;31m${_porta[$i]}"
  798. puertos+="${texto}|${texto_}\n"
  799. done
  800. [[ $(echo -e "$puertos" | grep 'SSH: 22') ]] && {
  801. export PATH=$PATH:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games
  802. [[ -z $(locale | grep "LANG=" | cut -d "=" -f2) ]] && export LANG=en_US.UTF-8
  803. echo -e "$puertos"|column -s "|" -t
  804. } || echo -e " ⚠️ PUERTOS SSH TRUNCADO POR DROPBEAR ⚠️ \n Coloca : sudo -i \n Ve al menu 7, opcion 7 "
  805. local PIDGEN=$(echo -e "${_ps}"| grep "BotGen.sh" | grep -v grep |awk '{print $1}')
  806. [[ ! -z $PIDGEN ]] && {
  807. local botG="\033[1;34m ${pPIniT} \033[1;37m BotGen Telegram 🤖 : \033[1;31m ⚡ ACTIVO ⚡"
  808. msg -bar
  809. echo -e "$botG"
  810. unset svcs porta puertos i x
  811. }
  812. }
  813. #declare -A tnUP=' ⚠️ ChumoGH ADM ⚠️ NECESITA ACTUALIZARSE!'
  814. declare -A exitokey="\033[3;49;32m$(cat < /bin/ejecutar/exito)©"
  815. declare -A cpu_core=$(cat /proc/cpuinfo | grep processor | wc -l)
  816. declare -A cpu_model=$(uname -m)
  817. [[ $cpu_model = "aarch64" ]] && cpu_model=" ARM64 Pro"
  818. [[ $v1 = $v2 ]] && vesaoSCT="\033[1;37m Key: $exitokey 】\033[0m\033[0;33m($v2)" || vesaoSCT="\033[1;37m Key: $exitokey 】\033[0m\033[0;33m($v2) ► \033[1;32m($v1)\033[1;31m"
  819. meu_ip
  820. [[ -e /root/name ]] && figlet -p -f smslant < /root/name | lolcat || echo -e "\033[7;49;35m ${TTini} ChumoGH${TTcent}VPS ${TTfin} "
  821. msg -bar
  822. [[ -e /etc/adm-lite/modulos ]] && echo -e "${cor[2]} ${pPIniT} \033[1;37mONLINES: ${_onlin}${cor[2]} ${pPIniT} \033[1;37mEXP: ${_userexp} ${cor[2]}${pPIniT}\033[1;37m KILL: $ukk ${cor[2]}${pPIniT}\033[1;37m TOTAL: ${_tuser}"
  823. echo -e "${cor[2]} ${pPIniT} \033[1;37mS.O: ${_os} ${cor[2]}${pPIniT} \033[1;37mBase:\033[1;31m${cpu_model} ${cor[2]}${pPIniT} \033[1;37mCores:\033[1;31m ${cpu_core} "
  824. echo -e "${cor[2]} ${pPIniT} \033[1;37mIP:\033[1;31m ${IP} ${cor[2]}${pPIniT} \033[1;37mFECHA: \033[1;31m$(date +"%d/%m/%Y")-$(date +"%H:%M")"
  825. msg -bar
  826. echo -e "${vesaoSCT} "
  827. msg -bar
  828. [[ $1 = "ports_" ]] && ports_
  829. export -f ports_
  830. export -f ofus
  831. export -f fun_atualizar
  832. export -f select_users
  833. export -f remover_adm
  834. export -f instalar_fun
  835. export -f meu_ip