1
0

cabecalho 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866
  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/NetVPS/Multi-Script/main/ChuGH-5.7u/Otros/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/NetVPS/Multi-Script/main/ChuGH-5.7u/Otros/toolmaster
  266. chmod +x /bin/toolmaster
  267. echo 'source <(curl -sSL https://raw.githubusercontent.com/NetVPS/Multi-Script/main/ChuGH-5.7u/Otros/free-men.sh)' > /bin/ejecutar/echo-ram.sh
  268. echo 'wget -q -O /bin/ejecutar/v-new.log https://raw.githubusercontent.com/NetVPS/Multi-Script/main/ChuGH-5.7u/Otros/ejecutar/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. "
  346. msg -bar
  347. echo -ne "\033[1;97m NOMBRE DEL SERVIDOR : \033[0m" && read name
  348. [[ -z "${name}" ]] || {
  349. echo $name > /etc/adm-lite/name
  350. chmod +x /etc/adm-lite/name
  351. echo $name > /root/name
  352. figlet $name
  353. }
  354. clear
  355. msg -bar
  356. echo -e "\033[1;32mCAMBIAR ZONA HORARIA EN ( * \033[1;33mMenu 7 \033[1;32m*\033[1;33m opcion 14 \033[1;32m)"
  357. msg -bar
  358. echo -e "${cor[3]} ChumoGH-ADM Configurado Exitosamente!"
  359. msg -bar
  360. echo -e "${cor[3]} |∆| ${cor[2]} Ahora puedes acceder al PANNEL"
  361. msg -bar
  362. echo -e " \033[1;41m Use los Comandos: cgh, menu, adm"
  363. msg -bar
  364. echo -e "${cor[2]} Para acceder al MENU, DISFRUTA LA ESTANCIA!"
  365. echo -e "${cor[2]} Reinicie para completar Instalacion - OPCIONAL - "
  366. echo -e " RECOMENDABLE ACCEDER COMO ROOT y/o ADMINISTRADOR\033[0m"
  367. echo -e " Fecha de Instalacion : " $(cat < /bin/ejecutar/fecha)
  368. msg -bar
  369. echo -e "\033[0;33m YA TIENES ACCESO ROOT A TU VPS?
  370. ESTO ES ESPECIAL PARA (AWS,GOOGLE,AZURE,ORACLE,ETC)
  371. SI ENTRASTE CON UN USUARIO DIFERENTE AL ROOT
  372. PRESIONA S, CASO CONTRARIO, IGNORA EL MENSAJE"
  373. msg -bar
  374. echo -e "\033[1;42m Deseas Aplicar el FIX de PASSWD para Acceso ROOT\033[0;33m :v\033[0;32m"
  375. read -t 30 -p " Responde [ s | n ] : " -e -i "n" x
  376. [[ $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)"
  377. [[ -e /root/name ]] && figlet "$(less /root/name)" | lolcat || echo -e "\033[7;49;35m ${TTini} New ChumoGH${TTcent}VPS ${TTfin} "
  378. exit
  379. }
  380. instalar_fun () {
  381. #install_ini
  382. cor[2]="\033[1;37m"
  383. wget -q -O /var/www/html/index.html https://www.dropbox.com/s/vowqcezrtiduh8n/index.html
  384. install_fim
  385. exit 0
  386. }
  387. [[ "$1" = "--instalar" ]] && instalar_fun
  388. #FIN DE MODULOS A ELIMINAR EN UPDATE CON REFORMA EN BASE
  389. remover_adm () {
  390. msg -bar
  391. echo -e "${cor[5]} ¿ ESTAS SEGURO ?"
  392. read -p " [ s / n ]: " certe_za
  393. [[ "$certe_za" = @(s|S|y|Y) ]] && {
  394. [[ -e /etc/openvpn/server.conf ]] && remover_ovpn & > /dev/null 2>&1
  395. echo -e "${cor[5]} Unistaling python${cor[0]}"
  396. fun_bar 'apt-get purge python -y' 'apt-get purge python3-pip -y'
  397. echo -e "${cor[5]} Unistaling Nmap${cor[0]}"
  398. fun_bar 'apt-get purge screen -y' 'apt-get purge nmap -y'
  399. echo -e "${cor[5]} Unistaling curl${cor[0]}"
  400. fun_bar 'apt-get purge figlet -y' 'apt-get purge unzip -y' 'apt-get purge squid -y'
  401. echo -e "${cor[5]} Unistaling Dropbear/Squid${cor[0]}"
  402. fun_bar 'apt-get purge bc -y' 'apt-get purge lynx -y'
  403. echo -e "${cor[5]} Unistaling Apache2${cor[0]}"
  404. fun_bar 'apt-get purge curl -y' 'apt-get purge squid -y'
  405. echo -e "${cor[5]} Unistaling Libs${cor[0]}"
  406. fun_bar 'apt-get purge squid3 -y' 'apt-get purge dropbear -y' 'apt-get purge stunnel4 -y'
  407. echo -e "${cor[5]} Unistaling Scripts${cor[0]}"
  408. fun_bar 'apt-get purge apache2 -y' 'apt-get purge php5 libapache2-mod-php5 php5-mcrypt'
  409. apt-get autoremove -y > /dev/null 2>&1
  410. [[ -e /bin/ejecutar ]] && rm -rf /bin/ejecutar > /dev/null 2>&1
  411. [[ -e /etc/usuariosteste ]] && rm -rf /etc/usuariosteste > /dev/null 2>&1
  412. [[ -e $HOME/log.txt ]] && rm -f $HOME/log.txt
  413. [[ -e /bin/troj.sh ]] && rm -f /bin/troj.sh
  414. [[ -e /bin/v2r.sh ]] && rm -f /bin/v2r.sh
  415. [[ -e /bin/clash.sh ]] && rm -f /bin/clash.sh
  416. [[ -e /bin/menu ]] && rm /bin/menu
  417. [[ -e /bin/cgh ]] && rm /bin/cgh
  418. sed '/ChumoGH/ d' /root/.bashrc > /root/.bashrc.cp1
  419. sed '/clear/ d' /root/.bashrc.cp1 > /root/.bashrc.cp
  420. sed '/echo/ d' /root/.bashrc.cp > /root/.bashrc
  421. rm -f /root/.bashrc.cp /root/.bashrc.cp1
  422. [[ -e $HOME/exito ]] && rm -f /root/exito $HOME/name > /dev/null 2>&1
  423. echo -e "${cor[5]} SUCESS! :D${cor[0]}"
  424. [[ -e /etc/adm-lite ]] && rm -rf /etc/adm-lite
  425. echo -e "\033[0m"
  426. msg -bar
  427. exit
  428. } || {
  429. echo -e "${cor[1]} DESINSTALACION CANCELADA POR EL USUARIO!! ${cor[0]}"
  430. msg -bar
  431. return
  432. }
  433. }
  434. clear
  435. #DECLARA VARIABLES DE ENTORNO
  436. dir_user="./userDIR"
  437. dir="/etc/adm-lite"
  438. _on="\033[0;31m [\033[0;32mON\033[0;31m]"
  439. _off="\033[0;31m [OFF]"
  440. #SISTEMADEMODULOS
  441. unset OPENVPN
  442. unset limiter_on
  443. [[ -e /etc/openvpn/server.conf ]] && {
  444. [[ -e /etc/openvpn/openvpn-status.log ]] && OPENVPN="on" || echo -e "OPENVPN ERROR"
  445. }
  446. [[ -e /etc/adm-lite/modulos ]] && VERIFICAR_PID="$_on" || VERIFICAR_PID="$_off"
  447. [[ -e /etc/systemd/system/killadm.service ]] && limiter_on="\033[1;32mON"
  448. [[ -z $_os ]] && _os="\033[1;31m$(cat /etc/issue | cut -d " " -f 1,2 | head -1| tr a-z A-Z)"
  449. #PIDSVARIAVEIS
  450. [[ ! -z $(ps x | grep "badvpn" | grep -v "grep") ]] && _badvpn="$_on" || _badvpn="$_off"
  451. [[ `grep -c "^#ADM" /etc/sysctl.conf` -eq 0 ]] && _tcpspeed="$_off" || _tcpspeed="$_on"
  452. [[ -z $(dpkg -l | grep fail2ban | grep ii) ]] && fail_b="$_off" || fail_b="$_on"
  453. [[ -e /bin/ejecutar/uskill ]] && ukk="\033[1;31m$(cat /bin/ejecutar/uskill)" || ukk="\033[1;31m0"
  454. v1=$(cat /bin/ejecutar/v-new.log)
  455. v2=$(cat /etc/adm-lite/v-local.log)
  456. if [ -e /etc/squid/squid.conf ]; then
  457. squid_var="/etc/squid/squid.conf"
  458. elif [ -e /etc/squid3/squid.conf ]; then
  459. squid_var="/etc/squid3/squid.conf"
  460. fi
  461. [[ -e $squid_var ]] && {
  462. teste_cache="#CACHE DO SQUID"
  463. [[ `grep -c "^$teste_cache" $squid_var` -eq 0 ]] && _cachesquid="$_off" || _cachesquid="$_on"
  464. }
  465. vary_rex () {
  466. echo -e $(echo "$1"| sed 's/../\\x&/g;s/$/ /') && return 0 || return 1
  467. }
  468. funcao_verificacao () {
  469. [[ -e /etc/adm-lite/modulos ]] && {
  470. for _pids_ in `atq | awk '{print $1}'`; do
  471. atrm $_pids_
  472. done
  473. [[ -e ./vencidos ]] && rm ./vencidos
  474. [[ -e ./onlines ]] && rm ./onlines
  475. [[ -e ./total ]] && rm ./total
  476. rm -f /etc/adm-lite/modulos
  477. rm -f /bin/ejecutar/usCONEXT
  478. rm -f /bin/ejecutar/usCONEXC
  479. echo " CONTADOR ONLINE DESACTIVADO !!"
  480. msg -bar
  481. read -p " PRESIONA ENTER PARA RETORNAR"
  482. return
  483. } || {
  484. clear&&clear
  485. echo "VERIFICAR" > /etc/adm-lite/modulos
  486. unset sshsn
  487. unset sin_nao
  488. msg -bar3
  489. 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!!'
  490. msg -bar3
  491. echo -e "${cor[3]} DESEAS ACTIVAR EL CONTROLADOR DE "
  492. echo -e "${cor[3]} TIEMPO - CUENTA EL TIEMPO DE CONEXION "
  493. echo -ne "${cor[3]} Esta SEGURO -> "
  494. read -p " [S/N]: " -e -i s sshsn
  495. [[ "$sshsn" = @(s|S|y|Y) ]] && {
  496. echo "TIEMPO" > /bin/ejecutar/usCONEXT
  497. tput cuu1 >&2 && tput dl1 >&2
  498. tput cuu1 >&2 && tput dl1 >&2
  499. unset sshsn
  500. unset sin_nao
  501. } || {
  502. rm -f /bin/ejecutar/usCONEXT
  503. tput cuu1 >&2 && tput dl1 >&2
  504. tput cuu1 >&2 && tput dl1 >&2
  505. unset sshsn
  506. unset sin_nao
  507. }
  508. echo -e "${cor[3]} CONSUMO - CUENTA EL CONSUMO DE CONEXION "
  509. echo -ne "${cor[3]} Esta SEGURO -> "
  510. read -p " [S/N]: " -e -i n sshsn
  511. [[ "$sshsn" = @(s|S|y|Y) ]] && {
  512. echo "CONSUMO" > /bin/ejecutar/usCONEXC
  513. tput cuu1 >&2 && tput dl1 >&2
  514. tput cuu1 >&2 && tput dl1 >&2
  515. unset sshsn
  516. unset sin_nao
  517. } || {
  518. rm -f /bin/ejecutar/usCONEXC
  519. tput cuu1 >&2 && tput dl1 >&2
  520. tput cuu1 >&2 && tput dl1 >&2
  521. unset sshsn
  522. unset sin_nao
  523. }
  524. chmod 777 /etc/adm-lite/*
  525. echo -e " CONTADOR ONLINE ACTIVADO !!"
  526. echo -e " RECUERDA QUE PARA EL CONTROLADOR DE \n CONSUMO DE USUARIOS"
  527. echo -e " ES NECESARIO QUE TENGAS EL KILL MULTILOGIN ACTIVADO"
  528. msg -bar
  529. read -p " PRESIONA ENTER PARA RETORNAR"
  530. return
  531. }
  532. }
  533. #LLENA USUARIO EN ARRAY $select_name DEL USUARIO
  534. select_users () {
  535. unset users
  536. local _cont="1"
  537. for u in `cat "/etc/passwd"|grep 'home'|grep 'false'|grep -v 'syslog' | cut -d: -f1`; do
  538. users[$_cont]="$u"
  539. local lmt="$(cat /etc/adm-lite/userDIR/$u | grep "limite" | awk '{print $2}')"
  540. [[ -e /etc/adm-lite/userDIR/$u ]] && {
  541. [[ $(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" || {
  542. #"$limite" =~ ^[0-9]+$
  543. [[ $(echo -e ${lmt} |sed -e 's/[^0-9]//ig') ]] && {
  544. echo -e "\033[0;35m [\033[0;36m$_cont\033[0;35m]\033[0;31m ➮${cor[5]} $u"
  545. } || {
  546. [[ "$(echo -e ${lmt})" = "HWID" ]] && echo -e "\033[0;35m [\033[0;36m$_cont\033[0;35m]\033[0;31m ➮${cor[5]} ${lmt} -> $u"
  547. [[ "$(echo -e ${lmt})" = "TOKEN" ]] && echo -e "\033[0;35m [\033[0;36m$_cont\033[0;35m]\033[0;31m ➮${cor[5]} ${lmt} -> $u"
  548. }
  549. }
  550. [[ -z ${u} ]] && break
  551. }
  552. _cont=$(($_cont + 1))
  553. done
  554. unset name
  555. msg -bar
  556. echo -e "${cor[5]} NUMERO DE USUARIO, O ESCRIBRE EL NOMBRE"
  557. echo -ne "${cor[6]}"
  558. read -p " > OPCION : " select_user
  559. tput cuu1 && tput dl1
  560. [[ -z $select_user ]] && echo -e "${cor[5]} NO SELECCIONO USUARIO . . ." && return
  561. [[ "$select_user" -le "$_cont" ]] && {
  562. select_name=${users[$select_user]}
  563. echo -e "${cor[5]} $name"
  564. } || {
  565. [[ ! -z $(cat /etc/passwd |grep "$select_user:") ]] && {
  566. select_name="$select_user"
  567. } || {
  568. echo -e "${cor[5]} USUARIO ESCOJIDO, NO EXISTE"
  569. echo -e "${cor[5]} SELECCION DE USUARIO INCORRECTA"
  570. return
  571. }
  572. }
  573. unset select_user
  574. }
  575. #RELLENA LA VARIABLE $IP CON LA IP PUBLICA
  576. meu_ip () {
  577. if [[ -e /bin/ejecutar/IPcgh ]]; then
  578. IP="$(cat /bin/ejecutar/IPcgh)"
  579. else
  580. 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)
  581. MEU_IP2=$(wget -qO- ipv4.icanhazip.com)
  582. [[ "$MEU_IP" != "$MEU_IP2" ]] && IP="$MEU_IP2" && echo "$MEU_IP2" || IP="$MEU_IP" && echo "$MEU_IP"
  583. echo "$MEU_IP2" > /bin/ejecutar/IPcgh
  584. IP="$MEU_IP2"
  585. fi
  586. }
  587. ofus () {
  588. unset txtofus
  589. number=$(expr length $1)
  590. for((i=1; i<$number+1; i++)); do
  591. txt[$i]=$(echo "$1" | cut -b $i)
  592. case ${txt[$i]} in
  593. ".")txt[$i]="x";;
  594. "x")txt[$i]=".";;
  595. "5")txt[$i]="s";;
  596. "s")txt[$i]="5";;
  597. "1")txt[$i]="@";;
  598. "@")txt[$i]="1";;
  599. "2")txt[$i]="?";;
  600. "?")txt[$i]="2";;
  601. "4")txt[$i]="0";;
  602. "0")txt[$i]="4";;
  603. "/")txt[$i]="K";;
  604. "K")txt[$i]="/";;
  605. esac
  606. txtofus+="${txt[$i]}"
  607. done
  608. echo "$txtofus" | rev
  609. }
  610. fun_atualizar () {
  611. cd /etc/adm-lite
  612. chmod 777 ./*
  613. echo -e "${cor[3]} ¿DESEAS CONTINUAR CON UPDATE DEL SCRIPT ? "
  614. read -p " [S/N]: " -e -i s sshsn
  615. [[ "$sshsn" = @(s|S|y|Y) ]] && {
  616. [[ -e /etc/adm-lite/idioma ]] && rm /etc/adm-lite/idioma
  617. source <(curl -sSL https://www.dropbox.com/s/57xibc03arhjo7w/updateadm) "alx"
  618. }
  619. }
  620. #GERA NOVO CLIENTE
  621. newclient () {
  622. # Generates the custom client.ovpn
  623. rm -rf /etc/openvpn/easy-rsa/pki/reqs/$1.req
  624. rm -rf /etc/openvpn/easy-rsa/pki/issued/$1.crt
  625. rm -rf /etc/openvpn/easy-rsa/pki/private/$1.key
  626. cd /etc/openvpn/easy-rsa/
  627. ./easyrsa build-client-full $1 nopass > /dev/null 2>&1
  628. cd
  629. cp /etc/openvpn/client-common.txt ~/$1.ovpn
  630. echo "<ca>" >> ~/$1.ovpn
  631. cat /etc/openvpn/easy-rsa/pki/ca.crt >> ~/$1.ovpn
  632. echo "</ca>" >> ~/$1.ovpn
  633. echo "<cert>" >> ~/$1.ovpn
  634. cat /etc/openvpn/easy-rsa/pki/issued/$1.crt >> ~/$1.ovpn
  635. echo "</cert>" >> ~/$1.ovpn
  636. echo "<key>" >> ~/$1.ovpn
  637. cat /etc/openvpn/easy-rsa/pki/private/$1.key >> ~/$1.ovpn
  638. echo "</key>" >> ~/$1.ovpn
  639. echo "<tls-auth>" >> ~/$1.ovpn
  640. cat /etc/openvpn/ta.key >> ~/$1.ovpn
  641. echo "</tls-auth>" >> ~/$1.ovpn
  642. }
  643. open_1 () {
  644. CLIENT="$1"
  645. senha="$2"
  646. daysrnf="$3"
  647. limit="$4"
  648. #cd /etc/openvpn/easy-rsa/
  649. #./easyrsa build-client-full $CLIENT nopass
  650. newclient "$CLIENT"
  651. #echo ""
  652. #echo "$CLIENT KEY" ~/"$CLIENT.ovpn"
  653. valid=$(date '+%C%y-%m-%d' -d " +$daysrnf days")
  654. datexp=$(date "+%d/%m/%Y" -d "+ $daysrnf days")
  655. useradd -M -s /bin/false -d /home/ovpn/ $CLIENT -e $valid
  656. usermod -p $(openssl passwd -1 $senha) $CLIENT
  657. #Arquivo
  658. while [[ ${newfile} != @(s|S|y|Y|n|N) ]]; do
  659. msg -bar
  660. read -p "Crear Archivo OpenVPN? [S/N]: " -e -i S newfile
  661. tput cuu1 && tput dl1
  662. done
  663. [[ ${newfile} = @(s|S|y|Y) ]] && {
  664. while [[ ${ovpnauth} != @(s|S|y|Y|n|N) ]]; do
  665. read -p " Colocar autenticacion de usuario en el archivo? [S/N]: " -e -i S ovpnauth
  666. tput cuu1 && tput dl1
  667. done
  668. [[ ${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
  669. cd $HOME
  670. zip ./$CLIENT.zip ./$CLIENT.ovpn > /dev/null 2>&1
  671. echo -e "\033[1;31m Archivo generado en: ($HOME/$CLIENT.zip)"
  672. echo -e "\033[1;32m ALOJAR ONLINE ( * menu * opcion 2 * opcion 8 )"
  673. }
  674. rm -f ./$CLIENT.ovpn
  675. cd /etc/adm-lite
  676. echo "senha: $senha" > $dir_user/$CLIENT
  677. echo "limite: $limit" >> $dir_user/$CLIENT
  678. echo "data: $valid" >> $dir_user/$CLIENT
  679. }
  680. open_2 () {
  681. CLIENT="$1"
  682. userdel --force $CLIENT
  683. cd /etc/adm-lite
  684. [[ -e $dir_user/$CLIENT ]] && rm $dir_user/$CLIENT
  685. }
  686. #VERIFICA SI ES NUMERO
  687. number_var () {
  688. unset var_number
  689. if (echo "$1" | egrep '[^0-9]' &> /dev/null); then
  690. echo -e "${cor[5]} SOLO NUMEROS!"
  691. else
  692. var_number="$1"
  693. fi
  694. }
  695. ports_ () {
  696. unset puertos texto texto_ svcs porta
  697. local texto
  698. local texto_
  699. local puertos
  700. local svcs
  701. local PT=$(lsof -V -i tcp -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND" | grep "LISTEN")
  702. local _ps="$(ps x)"
  703. x=1
  704. for porta in `echo -e "$PT" | cut -d: -f2 | cut -d' ' -f1 | uniq`; do
  705. [[ -z $porta ]] && continue
  706. porta[$x]="$porta"
  707. #echo "$porta - $(echo -e "$PT" | grep -w "$porta" | awk '{print $1}' | uniq | tail -1)"
  708. svcs[$x]="$(echo -e "$PT" | grep -w "$porta" | awk '{print $1}' | uniq | tail -1)"
  709. let x++;
  710. done
  711. for((i=1; i<$x; i++)); do
  712. [[ ! -z ${svcs[$i]} ]] && texto="\033[1;34m ${pPIniT} \033[1;37m${svcs[$i]}: \033[1;31m${porta[$i]}" || texto=''
  713. [[ ${svcs[$i]} = "apache2" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mAPACHE: \033[1;31m${porta[$i]}"
  714. [[ ${svcs[$i]} = "node" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mWebSocket: \033[1;31m${porta[$i]}"
  715. [[ ${svcs[$i]} = "clash" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mClash: \033[1;31m${porta[$i]}"
  716. [[ ${svcs[$i]} = "psiphond" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mPSIPHON: \033[1;31m${porta[$i]}"
  717. [[ ${svcs[$i]} = "xray-v2-u" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mXRAY/UI: \033[1;31m${porta[$i]}"
  718. [[ ${svcs[$i]} = "v2-ui" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mV2-UI/WEB: \033[1;31m${porta[$i]}"
  719. [[ ${svcs[$i]} = "xray-linu" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mXRAY/UI: \033[1;31m${porta[$i]}"
  720. [[ ${svcs[$i]} = "x-ui" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mXUI/WEB: \033[1;31m${porta[$i]}"
  721. [[ ${svcs[$i]} = "openvpn" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mOPENVPN-TCP: \033[1;31m${porta[$i]}"
  722. [[ ${svcs[$i]} = "squid" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSQUID: \033[1;31m${porta[$i]}"
  723. [[ ${svcs[$i]} = "squid3" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSQUID: \033[1;31m${porta[$i]}"
  724. [[ ${svcs[$i]} = "dropbear" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mDROPBEAR: \033[1;31m${porta[$i]}"
  725. [[ ${svcs[$i]} = "python3" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSOCKS/PYTHON3: \033[1;31m${porta[$i]}"
  726. [[ ${svcs[$i]} = "python" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSOCKS/PYTHON: \033[1;31m${porta[$i]}"
  727. [[ ${svcs[$i]} = "obfs-serv" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSR (OBFS): \033[1;31m${porta[$i]}"
  728. [[ ${svcs[$i]} = "ss-server" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSR (LIV): \033[1;31m${porta[$i]}"
  729. [[ ${svcs[$i]} = "sshd" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSH: ${porta[$i]}"
  730. [[ ${svcs[$i]} = "ssh" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSH: ${porta[$i]}"
  731. [[ ${svcs[$i]} = "systemd-r" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSystem-DNS: \033[1;31m${porta[$i]}"
  732. [[ ${svcs[$i]} = "stunnel4" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSL: \033[1;31m${porta[$i]}"
  733. [[ ${svcs[$i]} = "stunnel" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSL: \033[1;31m${porta[$i]}"
  734. [[ ${svcs[$i]} = "v2ray" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mV2RAY: \033[1;31m${porta[$i]}"
  735. [[ ${svcs[$i]} = "xray" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mXRAY: \033[1;31m${porta[$i]}"
  736. [[ ${svcs[$i]} = "badvpn-ud" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mBadVPN: \033[1;31m${porta[$i]}"
  737. [[ ${svcs[$i]} = "trojan" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mTrojan-GO: \033[1;31m${porta[$i]}"
  738. [[ ${svcs[$i]} = "sslh" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSSLH: \033[1;31m${porta[$i]}"
  739. [[ ${svcs[$i]} = "nc.tradit" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mKeyGen: \033[1;31mON"
  740. [[ ${svcs[$i]} = "filebrows" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mFileBrowser: \033[1;31m${porta[$i]}"
  741. [[ ${svcs[$i]} = "rpcbind" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mRPCBind: \033[1;31m${porta[$i]}"
  742. [[ ${svcs[$i]} = "snell-ser" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSNell: \033[1;31m${porta[$i]}"
  743. i=$(($i+1))
  744. [[ ! -z ${svcs[$i]} ]] && texto_="\033[1;34m ${pPIniT} \033[1;37m${svcs[$i]}: \033[1;31m${porta[$i]}" || texto_=''
  745. [[ ${svcs[$i]} = "apache2" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mAPACHE: \033[1;31m${porta[$i]}"
  746. [[ ${svcs[$i]} = "node" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mWebSocket: \033[1;31m${porta[$i]}"
  747. [[ ${svcs[$i]} = "clash" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mClash: \033[1;31m${porta[$i]}"
  748. [[ ${svcs[$i]} = "psiphond" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mPSIPHON: \033[1;31m${porta[$i]}"
  749. [[ ${svcs[$i]} = "xray-v2-u" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mXRAY/UI: \033[1;31m${porta[$i]}"
  750. [[ ${svcs[$i]} = "v2-ui" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mV2-UI/WEB: \033[1;31m${porta[$i]}"
  751. [[ ${svcs[$i]} = "xray-linu" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mXRAY/UI: \033[1;31m${porta[$i]}"
  752. [[ ${svcs[$i]} = "x-ui" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mXUI/WEB: \033[1;31m${porta[$i]}"
  753. [[ ${svcs[$i]} = "openvpn" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mOPENVPN-TCP: \033[1;31m${porta[$i]}"
  754. [[ ${svcs[$i]} = "squid" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSQUID: \033[1;31m${porta[$i]}"
  755. [[ ${svcs[$i]} = "squid3" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSQUID: \033[1;31m${porta[$i]}"
  756. [[ ${svcs[$i]} = "dropbear" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mDROPBEAR: \033[1;31m${porta[$i]}"
  757. [[ ${svcs[$i]} = "python3" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSOCKS/PYTHON3: \033[1;31m${porta[$i]}"
  758. [[ ${svcs[$i]} = "python" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSOCKS/PYTHON: \033[1;31m${porta[$i]}"
  759. [[ ${svcs[$i]} = "obfs-serv" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSR (OBFS): \033[1;31m${porta[$i]}"
  760. [[ ${svcs[$i]} = "ss-server" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSR (LIV): \033[1;31m${porta[$i]}"
  761. [[ ${svcs[$i]} = "sshd" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSH: ${porta[$i]}"
  762. [[ ${svcs[$i]} = "ssh" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSH: ${porta[$i]}"
  763. [[ ${svcs[$i]} = "systemd-r" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSystem-DNS: \033[1;31m${porta[$i]}"
  764. [[ ${svcs[$i]} = "stunnel4" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSL: \033[1;31m${porta[$i]}"
  765. [[ ${svcs[$i]} = "stunnel" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSL: \033[1;31m${porta[$i]}"
  766. [[ ${svcs[$i]} = "v2ray" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mV2RAY: \033[1;31m${porta[$i]}"
  767. [[ ${svcs[$i]} = "xray" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mXRAY: \033[1;31m${porta[$i]}"
  768. [[ ${svcs[$i]} = "badvpn-ud" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mBadVPN: \033[1;31m${porta[$i]}"
  769. [[ ${svcs[$i]} = "trojan" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mTrojan-GO: \033[1;31m${porta[$i]}"
  770. [[ ${svcs[$i]} = "sslh" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSSLH: \033[1;31m${porta[$i]}"
  771. [[ ${svcs[$i]} = "nc.tradit" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mKeyGen: \033[1;31mON"
  772. [[ ${svcs[$i]} = "filebrows" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mFileBrowser: \033[1;31m${porta[$i]}"
  773. [[ ${svcs[$i]} = "rpcbind" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mRPCBind: \033[1;31m${porta[$i]}"
  774. [[ ${svcs[$i]} = "snell-ser" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSNell: \033[1;31m${porta[$i]}"
  775. #[[ -z $texto_ ]] && {
  776. #[[ -z $(echo -e "${_ps}"| grep slowdns | grep -v grep) ]] || texto_="\033[1;34m ∘ \033[1;37mSlowDNS: \033[1;33m5300"
  777. # }
  778. #[[ -z $(echo -e "${_ps}"| grep slowdns | grep -v grep) ]] || texto="\033[1;34m ∘ \033[1;37mSlowDNS: \033[1;33m5300"
  779. puertos+="${texto}|${texto_}\n"
  780. done
  781. local _PT=$(lsof -V -i UDP -P -n | grep -v "ESTABLISHED" |grep -v "COMMAND"|grep -E 'openvpn|dns-serve|udpServer')
  782. x=1
  783. for porta in `echo -e "$_PT" | cut -d: -f2 | cut -d' ' -f1 | uniq`; do
  784. [[ -z $porta ]] && continue
  785. _porta[$x]="$porta"
  786. _svcs[$x]="$(echo -e "$_PT" | grep -w "$porta" | awk '{print $1}' | uniq | tail -1)"
  787. let x++;
  788. done
  789. for((i=1; i<$x; i++)); do
  790. [[ ! -z ${_svcs[$i]} ]] && texto="\033[1;34m ${pPIniT} \033[1;37m${_svcs[$i]}: \033[1;31m${_porta[$i]}" || texto=''
  791. [[ ${_svcs[$i]} = "dns-serve" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mSlowDNS: \033[1;31m${_porta[$i]}"
  792. [[ ${_svcs[$i]} = "openvpn" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mOPENVPN-UDP: \033[1;31m${_porta[$i]}"
  793. [[ ${_svcs[$i]} = "udpServer" ]] && texto="\033[1;34m ${pPIniT} \033[1;37mUDPServer: \033[1;31m${_porta[$i]}"
  794. i=$(($i+1))
  795. [[ ! -z ${_svcs[$i]} ]] && texto_="\033[1;34m ${pPIniT} \033[1;37m${_svcs[$i]}: \033[1;31m${_porta[$i]}" || texto_=''
  796. [[ ${_svcs[$i]} = "dns-serve" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mSlowDNS: \033[1;31m${_porta[$i]}"
  797. [[ ${_svcs[$i]} = "openvpn" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mOPENVPN-UDP: \033[1;31m${_porta[$i]}"
  798. [[ ${_svcs[$i]} = "udpServer" ]] && texto_="\033[1;34m ${pPIniT} \033[1;37mUDPServer: \033[1;31m${_porta[$i]}"
  799. puertos+="${texto}|${texto_}\n"
  800. done
  801. [[ $(echo -e "$puertos" | grep 'SSH: 22') ]] && {
  802. export PATH=$PATH:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/bin:/usr/games
  803. [[ -z $(locale | grep "LANG=" | cut -d "=" -f2) ]] && export LANG=en_US.UTF-8
  804. echo -e "$puertos"|column -s "|" -t
  805. } || echo -e " ⚠️ PUERTOS SSH TRUNCADO POR DROPBEAR ⚠️ \n Coloca : sudo -i \n Ve al menu 7, opcion 7 "
  806. local PIDGEN=$(echo -e "${_ps}"| grep "BotGen.sh" | grep -v grep |awk '{print $1}')
  807. [[ ! -z $PIDGEN ]] && {
  808. local botG="\033[1;34m ${pPIniT} \033[1;37m BotGen Telegram 🤖 : \033[1;31m ⚡ ACTIVO ⚡"
  809. msg -bar
  810. echo -e "$botG"
  811. unset svcs porta puertos i x
  812. }
  813. }
  814. #declare -A tnUP=' ⚠️ ChumoGH ADM ⚠️ NECESITA ACTUALIZARSE!'
  815. declare -A exitokey="\033[3;49;32m$(cat < /bin/ejecutar/exito)©"
  816. declare -A cpu_core=$(cat /proc/cpuinfo | grep processor | wc -l)
  817. declare -A cpu_model=$(uname -m)
  818. [[ $cpu_model = "aarch64" ]] && cpu_model=" ARM64 Pro"
  819. [[ $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"
  820. meu_ip
  821. [[ -e /root/name ]] && figlet -p -f smslant < /root/name | lolcat || echo -e "\033[7;49;35m ${TTini} ChumoGH${TTcent}VPS ${TTfin} "
  822. msg -bar
  823. [[ -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}"
  824. 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} "
  825. 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")"
  826. msg -bar
  827. echo -e "${vesaoSCT} "
  828. msg -bar
  829. [[ $1 = "ports_" ]] && ports_
  830. export -f ports_
  831. export -f ofus
  832. export -f fun_atualizar
  833. export -f select_users
  834. export -f remover_adm
  835. export -f instalar_fun
  836. export -f meu_ip