#!/bin/bash
#source cabecalho
#tput cuu1 >&2 && tput dl1 >&2 && tput cuu1 >&2 && tput dl1 >&2 && tput cuu1 >&2 && tput dl1 >&2 && tput cuu1 >&2 && tput dl1 >&2 && tput cuu1 >&2 && tput dl1 >&2 && tput cuu1 >&2 && tput dl1 >&2 && tput cuu1 >&2 && tput dl1 >&2 && tput cuu1 >&2 && tput dl1 >&2 && tput cuu1 >&2 && tput dl1 >&2 && tput cuu1 >&2 && tput dl1 >&2 && tput cuu1 >&2 && tput dl1 >&2
source cabecalho
tput cuu1 >&2 && tput dl1 >&2
#head -n -2 /etc/adm-lite/cabecalho > headuser.sh && chmod 777 headuser.sh && source headuser.sh
mt=$(free -h | grep Mem | sed 's/\s\+/,/g' | cut -d , -f2)
mf=$(free -h | grep Mem | sed 's/\s\+/,/g' | cut -d , -f4)
_usop=$(printf '%-1s' "$(top -bn1 | awk '/Cpu/ { cpu = "" 100 - $8 "%" }; END { print cpu }')")
if [ "$(find . -type f -iname "*.block" | wc -l)" > 0 ]; then
ul="\033[1;33m( \033[1;31m$(find . -type f -iname "*.block" | wc -l) \033[1;32mLOCKED \033[1;33m)"
else
ul="\033[1;33m( \033[1;32mALL UNLOCK \033[1;33m)"
fi
#[[ -e /root/name ]] && figlet -p -f smslant < /root/name | lolcat || echo -e "\033[7;49;35m    =====>>►► 🐲 New ChumoGH💥VPS 🐲 ◄◄<<=====      \033[0m"
[[ -z $(ps x | grep "ultimatebot" | grep -v "grep") ]] && bt="\033[1;31mOFF\033[0m" || bt="\033[1;32mON\033[0m"
usoo=$(grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}')
CPU=$(echo $usoo "%" | awk '{printf("%d\n",$1 + 0.5)}')
msg -bar 
echo -e "${cor[2]} 🍀 ${cor[5]}CUENTAS SSH / SSL / DROPBEAR By @ChumoGH 🍀"
echo -e "  \033[1;34m ▸ M LIBRE: \033[1;32m$mf  \033[1;34m ▸ USO DE CPU:\033[1;32m $_usop "
msg -bar 
echo -e "\033[0;35m [\033[0;36m1\033[0;35m]\033[0;31m ➮${cor[3]} CREAR 1 USUARIO DEMO" 
echo -e "\033[0;35m [\033[0;36m2\033[0;35m]\033[0;31m ➮${cor[3]} AGREGAR 1 USUARIO PERSONAL" 
echo -e "\033[0;35m [\033[0;36m3\033[0;35m]\033[0;31m ➮${cor[3]} BORRAR 1/TODOS LOS USUARIO/s" 
echo -e "\033[0;35m [\033[0;36m4\033[0;35m]\033[0;31m ➮${cor[3]} EDITAR USUARIOS REGISTRADOS" 
echo -e "\033[0;35m [\033[0;36m5\033[0;35m]\033[0;31m ➮${cor[3]} MOSTRAR USUARIOS REGISTRADOS"
echo -e "\033[0;35m [\033[0;36m6\033[0;35m]\033[0;31m ➮${cor[3]} MOSTRAR USUARIOS CONECTADOS " 
echo -e "\033[0;35m [\033[0;36m7\033[0;35m]\033[0;31m ➮${cor[3]} BORRAR USUARIOS VENCIDOS" 
echo -e "\033[0;35m [\033[0;36m8\033[0;35m]\033[0;31m ➮${cor[3]} EDITAR BANNER ( SSH/Dropbear )" 
echo -e "\033[0;35m [\033[0;36m9\033[0;35m]\033[0;31m ➮${cor[3]} LOG DE CONSUMO ( Artificial )"
echo -e "\033[0;35m [\033[0;36m10\033[0;35m]\033[0;31m ➮${cor[3]} BLOQUEAR USUARIOS TEMPORALMENTE $ul"
echo -e "\033[0;35m [\033[0;36m11\033[0;35m]\033[0;31m ➮${cor[3]} BACKUP USUARIOS \033[0;32m(#OFFICIAL)"
echo -e "\033[0;35m [\033[0;36m12\033[0;35m]\033[0;31m ➮${cor[3]} MENU CUENTAS SSR/SS \033[0;32m(#OFFICIAL)"
echo -e "\033[0;35m [\033[0;36m13\033[0;35m]\033[0;31m ➮${cor[3]} MENU DE CUENTAS V2RAY \033[0;33m(#BETA)"
echo -e "\033[0;35m [\033[0;36m14\033[0;35m]\033[0;31m ➮${cor[3]} CONTROL SSH ( BotTelegram $bt ) " 
#echo -e "\033[0;35m [\033[0;36m15\033[0;35m]\033[0;31m ➮${cor[3]} MENU DE CUENTAS TROJAN \033[0;33m(#BETA)"
msg -bar
echo -e " \033[0;35m [\033[0;36m0\033[0;35m]\033[0;31m ➮ $(msg -bra "\033[1;41m[ REGRESAR ]\e[0m")"
msg -bar
if [ -e /etc/cgh/modulo/limiter ]; then
echo -e "\033[1;31m \033[1;36m \033[1;32m(ON)\033[1;36m DESACTIVAR KILL MULTILOGUIN "
else
[[ -z $limiter_on ]] && limiter_on="\033[1;31mOFF\033[0m"
echo -e "\033[0;33m(\033[0;32mContador:$limiter_on\033[0;33m) \033[1;36mActiva en MENU 7-OPCION 6\033[1;31m\033[1;36m\033[1;31m (Kill OFF)\033[0m"
fi
msg -bar 


#FUNCION DE SELECCION
selection_fun () {
local selection="null"
local range
for((i=0; i<=$1; i++)); do range[$i]="$i "; done
while [[ ! $(echo ${range[*]}|grep -w "$selection") ]]; do
echo -ne "\033[1;37m Opcion: " >&2
read selection
tput cuu1 >&2 && tput dl1 >&2
done
echo $selection
}


selection=$(selection_fun 14)
case ${selection} in
0)
rm -f /etc/adm-lite/headuser.sh
menu
;;
1)
source usercodes 1
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
source /etc/adm-lite/user
exit
;;
2)
source usercodes 2
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
source /etc/adm-lite/user
exit
;;
3)
source usercodes 3
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
source /etc/adm-lite/user
exit
;;
4)
source usercodes 4
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
source /etc/adm-lite/user
exit
;;
5)
source usercodes 5
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
cd /etc/adm-lite
source user
exit
;;
6)
source usercodes 6
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
cd /etc/adm-lite
source user
exit
;;
7)
source usercodes 7
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
cd /etc/adm-lite
source user
exit
;;
8)
source usercodes 8
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
cd /etc/adm-lite
source user
exit
;;
9)
source usercodes 9
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
cd /etc/adm-lite
source user
exit
;;
10)
source usercodes 10
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
cd /etc/adm-lite
source user
exit
;;
11)
source usercodes 11
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
cd /etc/adm-lite
source user
exit
;;
12)
source usercodes 12
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
cd /etc/adm-lite
source user
exit
;;
13)
source usercodes 13
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
cd /etc/adm-lite
source user
exit
;;
14)
source usercodes 14
echo -ne "${cor[5]}"
read -p " ${txt[47]}"
cd /etc/adm-lite
source user
exit
;;

*)
source /etc/adm-lite/user
exit
;;
esac
